Commit 4b8a9915 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

More changes to cooked mode for PLC. Better URN handling.

parent a60fa581
...@@ -200,8 +200,8 @@ sub MapResources($$$$$) ...@@ -200,8 +200,8 @@ sub MapResources($$$$$)
# If so, must convert it to something assign can grok. # If so, must convert it to something assign can grok.
# #
if ($resource->IsSFA()) { if ($resource->IsSFA()) {
$advertisement = ConvertAdSFAtoPG($advertisement, $advertisement = ConvertSFAtoPG($advertisement, "ad",
$resource->manager_urn()); $resource->manager_urn());
return -1 return -1
if (!defined($advertisement)); if (!defined($advertisement));
$advertisement = GeniXML::Serialize($advertisement, 1); $advertisement = GeniXML::Serialize($advertisement, 1);
...@@ -573,8 +573,8 @@ sub MapResourcesNew($$$$$) ...@@ -573,8 +573,8 @@ sub MapResourcesNew($$$$$)
# If so, must convert it to something assign can grok. # If so, must convert it to something assign can grok.
# #
if ($resource->IsSFA()) { if ($resource->IsSFA()) {
$advertisement = ConvertAdSFAtoPG($advertisement, $advertisement = ConvertSFAtoPG($advertisement, "ad",
$resource->manager_urn()); $resource->manager_urn());
return -1 return -1
if (!defined($advertisement)); if (!defined($advertisement));
$advertisement = GeniXML::Serialize($advertisement, 1); $advertisement = GeniXML::Serialize($advertisement, 1);
...@@ -1059,6 +1059,24 @@ sub GetTickets($) ...@@ -1059,6 +1059,24 @@ sub GetTickets($)
# #
$object = $resource->Manifest(); $object = $resource->Manifest();
#
# Convert SFA manifest to rspec format.
#
if ($object && $resource->IsSFA()) {
my $tmp = ConvertSFAtoPG($object, "manifest",
$resource->manager_urn());
if (!defined($tmp) ||
$resource->UpdateManifest($tmp)) {
print STDERR "Could not store manifest for $resource\n";
$errors++;
$object = undef;
}
else {
# reload.
$object = $tmp;
}
}
# File the rspec away since that is what we have. # File the rspec away since that is what we have.
if ($resource->UpdateRspec($resource->stashedrspec())) { if ($resource->UpdateRspec($resource->stashedrspec())) {
print STDERR "Could not store rspec for $resource\n"; print STDERR "Could not store rspec for $resource\n";
...@@ -2378,9 +2396,9 @@ sub AddLinkToRspec($$) ...@@ -2378,9 +2396,9 @@ sub AddLinkToRspec($$)
return $rspeclink; return $rspeclink;
} }
sub ConvertAdSFAtoPG($$) sub ConvertSFAtoPG($$$)
{ {
my ($rspec, $manager_urn) = @_; my ($rspec, $type, $manager_urn) = @_;
# Parse if a string. # Parse if a string.
if (! ref($rspec)) { if (! ref($rspec)) {
...@@ -2426,14 +2444,17 @@ sub ConvertAdSFAtoPG($$) ...@@ -2426,14 +2444,17 @@ sub ConvertAdSFAtoPG($$)
$rspecnode->setAttribute('component_uuid', $urn); $rspecnode->setAttribute('component_uuid', $urn);
$rspecnode->setAttribute('component_urn', $urn); $rspecnode->setAttribute('component_urn', $urn);
$rspecnode->setAttribute('component_name', "$id:$name"); $rspecnode->setAttribute('component_name', "$id:$name");
my $tmp = addChildToRspec($doc, $rspecnode, 'node_type');
$tmp->setAttribute("type_name", "pc"); if ($type eq "ad") {
$tmp->setAttribute("type_slots", "1"); my $tmp = addChildToRspec($doc, $rspecnode, 'node_type');
$tmp->setAttribute("type_name", "pc");
$tmp = addChildToRspec($doc, $rspecnode, 'available'); $tmp->setAttribute("type_slots", "1");
$tmp->appendText("true");
$tmp = addChildToRspec($doc, $rspecnode, 'exclusive'); $tmp = addChildToRspec($doc, $rspecnode, 'available');
$tmp->appendText("true"); $tmp->appendText("true");
$tmp = addChildToRspec($doc, $rspecnode, 'exclusive');
$tmp->appendText("true");
}
} }
} }
} }
......
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