Commit 52d99e78 authored by Jonathon Duerig's avatar Jonathon Duerig

Add support for parsing public addresses to CM.

Fix bug in Jacks Editor wrapper on cancel
parent aeb46be8
...@@ -103,6 +103,7 @@ my $debug = 0; ...@@ -103,6 +103,7 @@ my $debug = 0;
"virt_client_service_opts" => [ "vnode", "opt_name", "opt_value" ], "virt_client_service_opts" => [ "vnode", "opt_name", "opt_value" ],
"virt_blockstores" => [ "vname" ], "virt_blockstores" => [ "vname" ],
"virt_blockstore_attributes" => [ "vname", "attrkey" ], "virt_blockstore_attributes" => [ "vname", "attrkey" ],
"virt_address_allocation" => [ "pool_id" ],
); );
# #
...@@ -1277,5 +1278,10 @@ use vars qw(@ISA); ...@@ -1277,5 +1278,10 @@ use vars qw(@ISA);
@ISA = "VirtExperiment::VirtTableRow"; @ISA = "VirtExperiment::VirtTableRow";
use VirtExperiment; use VirtExperiment;
package VirtExperiment::VirtTableRow::virt_address_allocation;
use vars qw(@ISA);
@ISA = "VirtExperiment::VirtTableRow";
use VirtExperiment;
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
1; 1;
...@@ -750,6 +750,23 @@ sub GetTicketAuxAux($$$$$$$$$$) ...@@ -750,6 +750,23 @@ sub GetTicketAuxAux($$$$$$$$$$)
"vname" => "ns", "vname" => "ns",
"objecttype" => "6"}); "objecttype" => "6"});
#
# Look for toplevel address pools
#
my $address_pools = GeniXML::GetAddressPools($rspec);
foreach my $pool (@{ $address_pools }) {
if ($pool->{'type'} ne "any") {
$response = GeniResponse->Create(GENIRESPONSE_ERROR, undef, "Only public address pools of type any are supported");
goto bad;
}
print STDERR 'DEBUG: Adding row to virt_address_allocation';
$virtexperiment->NewTableRow("virt_address_allocation",
{"pool_id" => $pool->{'client_id'},
"count" => $pool->{'count'},
"restriction" => $pool->{'type'},
"version" => "ipv4" });
}
# #
# Look for toplevel elabinelab section. # Look for toplevel elabinelab section.
# #
......
...@@ -42,7 +42,7 @@ GetManagerId GetColocate GetSubnodeOf GetStartupCommand GetTarball ...@@ -42,7 +42,7 @@ GetManagerId GetColocate GetSubnodeOf GetStartupCommand GetTarball
GetVirtualizationType SetVirtualizationSubtype GetVirtualizationSubtype GetVirtualizationType SetVirtualizationSubtype GetVirtualizationSubtype
GetExclusive SetExclusive GetLinkManager SetText GetText Serialize GetExclusive SetExclusive GetLinkManager SetText GetText Serialize
CreateDocument AddElement RemoveChild PolicyExists GetMask CreateDocument AddElement RemoveChild PolicyExists GetMask
GetDiskImage IsUntaggedLan IsTaggedLan GetHopLinkID GetCapabilitySection GetDiskImage IsUntaggedLan IsTaggedLan GetAddressPools GetHopLinkID GetCapabilitySection
GetSuggestedVlanFromHop GetAvailableVlanFromHop SetVlanTagInHop); GetSuggestedVlanFromHop GetAvailableVlanFromHop SetVlanTagInHop);
use English; use English;
...@@ -987,6 +987,26 @@ sub IsTaggedLan($) ...@@ -987,6 +987,26 @@ sub IsTaggedLan($)
return $result; return $result;
} }
sub GetAddressPools($)
{
my ($rspec) = @_;
my $result = [];
my @pools = FindNodesNS("n:routable_pool", $rspec,
$EMULAB_NS)->get_nodelist();
foreach my $pool (@pools) {
my $client_id = GetText("client_id", $pool);
my $count = GetText("count", $pool);
my $type = GetText("type", $pool);
push(@{ $result },
{
"client_id" => $client_id,
"count" => $count,
"type" => $type
});
}
return $result;
}
sub GetSharedLanName($) sub GetSharedLanName($)
{ {
my ($iface) = @_; my ($iface) = @_;
......
...@@ -136,8 +136,10 @@ function (_, editModalString) ...@@ -136,8 +136,10 @@ function (_, editModalString)
var expression = /^\s*$/; var expression = /^\s*$/;
if (this.xml && ! expression.exec(this.xml)) if (this.xml && ! expression.exec(this.xml))
{ {
console.log('before: ', this.xml);
var rspec = $.parseXML(this.xml); var rspec = $.parseXML(this.xml);
convertNamespace(rspec.documentElement); convertNamespace(rspec.documentElement);
console.log('after: ', rspec.documentElement.outerHTML);
this.input.trigger('change-topology', this.input.trigger('change-topology',
[{ rspec: rspec.documentElement.outerHTML }]); [{ rspec: rspec.documentElement.outerHTML }]);
} }
...@@ -184,7 +186,7 @@ function (_, editModalString) ...@@ -184,7 +186,7 @@ function (_, editModalString)
{ {
this.root.find('#quickvm_editmodal').modal('hide'); this.root.find('#quickvm_editmodal').modal('hide');
if (this.cancel_callback() != null) { if (this.cancel_callback !== null) {
this.cancel_callback(); this.cancel_callback();
} }
} }
......
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