Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Elijah Grubb
emulab-devel
Commits
460d1cc6
Commit
460d1cc6
authored
Oct 08, 2015
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More graceful handling of image tracker errors. Fix a bug that
was causing an undefined variable.
parent
baef9a60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
apt/manage_instance.in
apt/manage_instance.in
+24
-15
No files found.
apt/manage_instance.in
View file @
460d1cc6
...
...
@@ -108,7 +108,7 @@ sub DoLockdown();
sub
DoManifests
();
sub
WriteCredentials
();
sub
StartMonitor
();
sub
DoImageTrackerStuff
($$$$$);
sub
DoImageTrackerStuff
($$$$$
$
);
#
# Parse command arguments. Once we return from getopts, all that should be
...
...
@@ -371,10 +371,19 @@ sub DoSnapshot()
# When cloning, we use the URN returned by the cluster; it is
# the origin of the new image.
#
if
(
!
defined
(
$cloneprofile
)
&&
DoImageTrackerStuff
(
$aggregate
,
$node
,
$project
,
\
$copyback_uuid
,
\
$copyback_urn
))
{
fatal
("
Image tracking error
");
if
(
!
defined
(
$cloneprofile
))
{
my
$rval
=
DoImageTrackerStuff
(
$aggregate
,
$node
,
$project
,
\
$copyback_uuid
,
\
$copyback_urn
,
\
$errmsg
);
if
(
$rval
)
{
if
(
$rval
<
0
)
{
fatal
(
$errmsg
);
}
else
{
$errcode
=
1
;
goto
uerror
;
}
}
}
}
if
(
0
)
{
...
...
@@ -679,9 +688,9 @@ sub DoSnapshot()
exit(
$errcode
);
}
sub DoImageTrackerStuff($$$$$)
sub DoImageTrackerStuff($$$$$
$
)
{
my (
$aggregate
,
$node
,
$project
,
$puuid
,
$purn
) =
@_
;
my (
$aggregate
,
$node
,
$project
,
$puuid
,
$purn
,
$perrmsg
) =
@_
;
my
$node_id
= GeniXML::GetVirtualId(
$node
);
my
$errmsg
;
...
...
@@ -705,7 +714,7 @@ sub DoImageTrackerStuff($$$$$)
if (GeniHRN::IsValid(
$image_token
)) {
my (
$auth
,
$ospid
) = GeniHRN::ParseImage(
$image_token
);
if (!defined(
$ospid
)) {
print STDERR
"
Invalid
image
urn:
$image_token
\
n
"
;
$
$perrmsg
=
"
Invalid
image
urn:
$image_token
"
;
return 1;
}
}
...
...
@@ -731,15 +740,15 @@ sub DoImageTrackerStuff($$$$$)
if (
$ospid
eq TBOPSPID() &&
$auth
ne
"
emulab
.
net
"
) {
$urn
= GeniHRN::GenerateImage(
"
emulab
.
net
"
,
TBOPSPID(),
$os
,
$vers
);
Genixmlrpc->SetContext(APT_Geni::GeniContext());
$blob
= GeniImage::GetImageData(
$urn
,
\$
errmsg);
Genixmlrpc->SetContext(undef);
}
Genixmlrpc->SetContext(APT_Geni::GeniContext());
$blob
= GeniImage::GetImageData(
$urn
,
\$
errmsg);
Genixmlrpc->SetContext(undef);
}
if (!defined(
$blob
)) {
print STDERR
"
Could
not
get
info
from
the
IMS
for
"
.
"
$image_token:
\
n
"
.
$errmsg
.
"
\
n
"
;
return
-
1;
$
$perrmsg
=
"
Could
not
get
info
from
the
image
server
for
"
.
"
$image_token:
\
n
"
.
$errmsg
;
return 1;
}
}
#
...
...
@@ -767,7 +776,7 @@ sub DoImageTrackerStuff($$$$$)
if (lc(
$hrn
->domain()) eq lc(
$aggregate
->domain())) {
my
$projhrn
= GeniHRN->Parse(
$blob
->{'project_urn'});
if (!defined(
$projhrn
)) {
print STDERR
"
Could
not
parse
"
.
$blob
->{'project_urn'} .
"
\
n
"
;
$
$perrmsg
=
"
Could
not
parse
"
.
$blob
->{'project_urn'} .
"
\
n
"
;
return -1;
}
if (lc(
$projhrn
->subauth()) eq lc(
$project
->pid())) {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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