Commit 1c5fd925 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Update manifest with new users after BindToSlice.

parent 949b6bd1
......@@ -854,6 +854,41 @@ sub GetManifest($$)
return $xml;
}
#
# Store a manifest back.
#
sub UpdateManifest($$)
{
my ($self, $manifest) = @_;
my $slice_uuid = $self->slice_uuid();
my $manifest_string = DBQuoteSpecial(GeniXML::Serialize($manifest));
#
# We need the current idx.
#
my $query_result =
DBQueryWarn("select idx from geni_manifests ".
"where slice_uuid='$slice_uuid'");
return -1
if (!$query_result);
if ($query_result->numrows) {
my ($idx) = $query_result->fetchrow_array();
DBQueryWarn("update geni_manifests set ".
" manifest=$manifest_string " .
"where idx=$idx")
or return -1;
}
else {
DBQueryWarn("replace into geni_manifests set ".
" manifest=$manifest_string, " .
" idx=NULL, slice_uuid='$slice_uuid', created=now()")
or return -1;
}
return 0;
}
#
# Process the manifest. Just hand off to the slivers.
#
......
......@@ -1748,6 +1748,25 @@ sub BindToSlice($)
$slice->UnLock();
return GeniResponse->Create(GENIRESPONSE_ERROR());
}
#
# Update the manifest.
#
my $manifest = $aggregate->GetManifest(0);
foreach my $ref (GeniXML::FindNodes("n:node",
$manifest)->get_nodelist()) {
my $sliver_id = GeniXML::GetSliverId($ref);
my $sliver = GeniSliver->Lookup($sliver_id);
next
if (!defined($sliver));
my $node_manifest = $sliver->AnnotateManifest();
if (defined($node_manifest)) {
# And store into the new manifest.
GeniXML::ReplaceNode($ref, $node_manifest);
}
}
$aggregate->UpdateManifest($manifest);
}
$slice->UnLock();
return GeniResponse->Create(GENIRESPONSE_SUCCESS);
......
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