Commit aa8016ef authored by Mike Hibler's avatar Mike Hibler
Browse files

Fix the "other" libosload to reflect the imageinfo change.

parent 4109cb4b
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
#
# Osload library. Basically the backend to the osload script, but also used
......@@ -953,30 +953,22 @@ sub GetImageInfo($$$)
if (! -R $imagepath) {
#
# If the image doesn't exist and we are in an inner elab,
# make sure real boss has it and see how big it is.
# There are two reasons why a legit image might not be readable.
# One is that we are in an elabinelab and the image has just not
# been downloaded yet. The other is that we are attempting to
# access a shared (via the grantimage mechanism) image which the
# caller cannot directly access.
#
# Note that we don't actually pre-fetch the image here,
# that will be done automatically when the image is first requested.
# For either case, making a proxy query request via frisbee will
# tell us whether the image is accessible and, if so, its size.
# "imageinfo" makes that call for us.
#
if ($ELABINELAB) {
my $frisimageid = $rowref->{'pid'} . "/" . $rowref->{'imagename'};
my $attr = `$FRISBEE -S $OUTERBOSS -Q $frisimageid`;
if ($attr =~ /error=0/) {
if ($attr =~ /size=(\d+)/) {
$imagesize = $1;
} else {
$imagesize = 1 * 1024 * 1024 * 1024;
}
} else {
tberror "Query to $OUTERBOSS for info on $image failed!";
$$rowrefptr = 'BADIMAGE';
return -1;
}
}
else {
tberror "$imagepath does not exist or cannot be read!";
my $frisimageid = $rowref->{'pid'} . "/" . $rowref->{'imagename'};
my $sizestr = `$IMAGEINFO -qs -N $node $frisimageid`;
if ($sizestr =~ /^(\d+)$/) {
$imagesize = $1;
} else {
tberror "$image: access not allowed or image does not exist.";
$$rowrefptr = 'BADIMAGE';
return -1;
}
......@@ -984,17 +976,6 @@ sub GetImageInfo($$$)
else {
(undef,undef,undef,undef,undef,undef,undef,$imagesize,
undef,undef,undef,undef,undef) = stat($imagepath);
#
# A zero-length image cannot be right and will result in much confusion
# if allowed to pass: the image load will succeed, but the disk will be
# unchanged, making it appear that os_load loaded the default image.
#
if ($imagesize == 0) {
tberror "$imagepath is empty!";
$$rowrefptr = 'BADIMAGE';
return -1;
}
}
# cache as long as we just looked!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment