Commit 9d1c26f3 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor bug fix to XML stuff; convert manifest into XML

parent 8848b2ad
......@@ -34,6 +34,7 @@ use GeniRegistry;
use GeniUtil;
use GeniCM;
use GeniHRN;
use GeniXML;
use libtestbed qw(SENDMAIL);
use emutil;
# Hate to import all this crap; need a utility library.
......@@ -525,8 +526,10 @@ sub StartSliver($)
my $slice_urn = $argref->{'slice_urn'};
my $sliver_urns = $argref->{'component_urns'};
my $credentials = $argref->{'credentials'};
my $manifest = $argref->{'manifest'};
return SliverAction("start", $slice_urn, $sliver_urns, $credentials);
return SliverAction("start",
$slice_urn, $sliver_urns, $credentials, $manifest);
}
sub StopSliver($)
......@@ -536,7 +539,8 @@ sub StopSliver($)
my $sliver_urns = $argref->{'component_urns'};
my $credentials = $argref->{'credentials'};
return SliverAction("stop", $slice_urn, $sliver_urns, $credentials);
return SliverAction("stop",
$slice_urn, $sliver_urns, $credentials, undef);
}
sub RestartSliver($)
......@@ -545,13 +549,15 @@ sub RestartSliver($)
my $slice_urn = $argref->{'slice_urn'};
my $sliver_urns = $argref->{'component_urns'};
my $credentials = $argref->{'credentials'};
my $manifest = $argref->{'manifest'};
return SliverAction("restart", $slice_urn, $sliver_urns, $credentials);
return SliverAction("restart",
$slice_urn, $sliver_urns, $credentials, $manifest);
}
sub SliverAction($$$$)
sub SliverAction($$$$$)
{
my ($action, $slice_urn, $sliver_urns, $credentials) = @_;
my ($action, $slice_urn, $sliver_urns, $credentials, $manifest) = @_;
my $response;
if (! (defined($credentials) &&
......@@ -567,6 +573,15 @@ sub SliverAction($$$$)
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN, undef,
"Insufficient privilege");
if (defined($manifest)) {
$manifest = GeniXML::Parse($manifest);
if (!defined($manifest)) {
print STDERR "Error reading manifest\n";
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Bad manifest");
}
}
#
# For now, only allow top level aggregate or the slice
#
......@@ -651,6 +666,15 @@ sub SliverAction($$$$)
goto bad
if (GeniResponse::IsResponse($response));
if ($action eq "start" && defined($manifest)) {
if ($aggregate->ProcessManifest($manifest)) {
$response = GeniResponse->Create(GENIRESPONSE_ERROR,
undef,
"Error processing manifest");
goto bad;
}
}
$response = &$PerformAction($aggregate, $action);
goto bad
if (GeniResponse::IsResponse($response));
......@@ -683,6 +707,14 @@ sub SliverAction($$$$)
push(@slivers, $sliver);
}
foreach my $sliver (@slivers) {
if ($action eq "start" && defined($manifest)) {
if ($sliver->ProcessManifest($manifest)) {
$response = GeniResponse->Create(GENIRESPONSE_ERROR,
undef,
"Error processing manifest for $sliver");
goto bad;
}
}
$response = &$PerformAction($sliver, $action);
goto bad
if (GeniResponse::IsResponse($response));
......
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