Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
aa8016ef
Commit
aa8016ef
authored
Jul 25, 2012
by
Mike Hibler
Browse files
Fix the "other" libosload to reflect the imageinfo change.
parent
4109cb4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
tbsetup/libosload_new.pm.in
View file @
aa8016ef
#
!/usr/bin/perl -wT
#
#
EMULAB
-
COPYRIGHT
#
Copyright
(
c
)
2000
-
201
1
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2000
-
201
2
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!
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment