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

Minor bug fix to XML stuff; convert manifest into XML

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