Commit 0e9ba5e7 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Bug fixes. 1) hrn check; allow dashes. 2) Do not add bogus link spec

to ticket when there were no links in the rspec. 3) Print the rspec
out only when there is an error redeeming it, to reduce the amount of
email. 4) Fix check in updatesliver that looks for existing links; was
tearing them down cause the test was wrong.
parent 501ae037
......@@ -119,7 +119,7 @@ sub Resolve($)
# We only want the last token for node lookup.
#
if ($hrn =~ /\./) {
($hrn) = ($hrn =~ /\.(\w*)$/);
($hrn) = ($hrn =~ /\.([-\w]*)$/);
}
$node= Node->Lookup($hrn);
}
......@@ -554,6 +554,9 @@ sub GetTicket($)
# In case the code below fails, before ticket is created.
@dealloc = @nodeids;
}
goto skiplinks
if (!exists($rspec->{'link'}));
#
# Now deal with links for wildcarded nodes. We need to fill in the
# node_uuid.
......@@ -624,6 +627,7 @@ sub GetTicket($)
}
}
}
skiplinks:
#
# Create the ticket.
......@@ -726,6 +730,10 @@ sub RedeemTicket($)
my $response = ModifySliver(undef, $slice, $ticket,
$ticket->rspec(), $impotent, $keys);
$slice->UnLock();
if ($response->{'code'} != GENIRESPONSE_SUCCESS) {
# So we get email.
print STDERR Dumper($ticket->rspec());
}
return $response;
}
......@@ -801,6 +809,10 @@ sub UpdateSliver($)
my $response = ModifySliver($aggregate, $slice,
$credential, $rspec, $impotent, $keys);
$slice->UnLock();
if ($response->{'code'} != GENIRESPONSE_SUCCESS) {
# So we get email.
print STDERR Dumper($rspec);
}
return $response;
}
......@@ -836,7 +848,6 @@ sub ModifySliver($$$$$$)
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"No local experiment for slice");
}
print STDERR Dumper($rspec);
#
# Figure out what nodes to allocate or free.
......@@ -1054,25 +1065,15 @@ sub ModifySliver($$$$$$)
# have changed.
#
foreach my $s (values(%linklist)) {
if (! exists($rspec->{'link'}->{$s->hrn()})) {
# XXX See the constructor in GeniAggregate.
my ($linkname) = ($s->hrn() =~ /\.([-\w]*)$/);
if (!exists($rspec->{'link'}) ||
!exists($rspec->{'link'}->{$linkname})) {
$s->UnProvision();
$s->Delete(0);
next;
}
my $delete = 0;
my @interfaces = ();
if ($s->SliverList(\@interfaces) != 0) {
$message = "Failed to get sliverlist for $s";
goto bad;
}
foreach my $i (@interfaces) {
my $node_uuid = $i->resource_uuid();
my $iface_name = $i->rspec()->{'iface_name'};
my $linkendpoints =
$rspec->{'link'}->{$s->hrn()}->{'linkendpoints'};
}
}
#
......@@ -1221,7 +1222,32 @@ sub ModifySliver($$$$$$)
$message = "Could not find node object for $nodesliver";
goto bad;
}
my $interface = Interface->LookupByIface($nodeobject, $iface_name);
#
# Wildcarded interface.
#
if ($iface_name eq "*") {
my @interfaces;
if ($nodeobject->AllInterfaces(\@interfaces) != 0) {
$message = "Could not get interfaces for $nodeobject";
goto bad;
}
foreach my $interface (@interfaces) {
next
if (!defined($interface->switch_id()));
next
if ($interface->role() ne "expt");
$iface_name = $ref->{'iface_name'} = $interface->iface();
last;
}
if ($iface_name eq "*") {
$message = "Could not map wildcarded interface ".
"for $nodeobject";
goto bad;
}
}
my $interface = Interface->LookupByIface($nodeobject,$iface_name);
if (!defined($interface)) {
$message = "No such interface $iface_name on node $nodeobject";
goto bad;
......
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