Commit 68bbc562 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Fix bug in revision 1.101 and restore to head.

parent 984379c6
...@@ -568,6 +568,17 @@ sub GetTicket($;$) ...@@ -568,6 +568,17 @@ sub GetTicket($;$)
} }
my $pid = $slice_experiment->pid(); my $pid = $slice_experiment->pid();
my $eid = $slice_experiment->eid(); my $eid = $slice_experiment->eid();
#
# Mark the experiment locally as coming from the cooked interface.
# This changes what tmcd returns to the local nodes.
#
if (exists($rspec->{'generated_by'}) &&
$rspec->{'generated_by'} eq "libvtop") {
$slice_experiment->Update({"geniflags" =>
$Experiment::EXPT_GENIFLAGS_EXPT|
$Experiment::EXPT_GENIFLAGS_COOKED});
}
# #
# Create a virt topology object. We are going to load this up as we # Create a virt topology object. We are going to load this up as we
...@@ -603,6 +614,7 @@ sub GetTicket($;$) ...@@ -603,6 +614,7 @@ sub GetTicket($;$)
my %ifacemap = (); my %ifacemap = ();
my %nodemap = (); my %nodemap = ();
my @nodeids = (); my @nodeids = ();
my %lannodes = ();
my @dealloc; my @dealloc;
# Try to make the output format mimic the input, until everybody # Try to make the output format mimic the input, until everybody
...@@ -655,6 +667,12 @@ sub GetTicket($;$) ...@@ -655,6 +667,12 @@ sub GetTicket($;$)
!GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) && !GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) &&
$manager_uuid ne $ENV{'MYUUID'}); $manager_uuid ne $ENV{'MYUUID'});
# Skip lan nodes; they are fake.
next
if (exists($ref->{'node_type'}) &&
exists($ref->{'node_type'}->{'type_name'}) &&
$ref->{'node_type'}->{'type_name'} eq "lan");
my $node = LookupNode($resource_uuid); my $node = LookupNode($resource_uuid);
if (!defined($node)) { if (!defined($node)) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef, $response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
...@@ -703,6 +721,18 @@ sub GetTicket($;$) ...@@ -703,6 +721,18 @@ sub GetTicket($;$)
!GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) && !GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) &&
$manager_uuid ne $ENV{'MYUUID'}); $manager_uuid ne $ENV{'MYUUID'});
#
# Lan nodes are fake and do not go into the virt topo. Need
# to remember them though, for when we do the links below.
# They are still in the returned ticket though.
#
if (exists($ref->{'node_type'}) &&
exists($ref->{'node_type'}->{'type_name'}) &&
$ref->{'node_type'}->{'type_name'} eq "lan") {
$lannodes{$node_nickname} = $ref;
next;
}
if (defined($virtualization_type)) { if (defined($virtualization_type)) {
if ($virtualization_type eq "emulab-vnode") { if ($virtualization_type eq "emulab-vnode") {
if (defined($virtualization_subtype)) { if (defined($virtualization_subtype)) {
...@@ -871,22 +901,39 @@ sub GetTicket($;$) ...@@ -871,22 +901,39 @@ sub GetTicket($;$)
my $linknum = 1; my $linknum = 1;
foreach my $linkref (@{$rspec->{'link'}}) { foreach my $linkref (@{$rspec->{'link'}}) {
my $nickname = $linkref->{"nickname"} || $linkref->{"virtual_id"}; my $lanname = $linkref->{"nickname"} || $linkref->{"virtual_id"};
my $istunnel = (exists($linkref->{'link_type'}) && my $istunnel = (exists($linkref->{'link_type'}) &&
$linkref->{'link_type'} eq "tunnel"); $linkref->{'link_type'} eq "tunnel");
my $interfaces = $linkref->{'linkendpoints'} || my $interfaces = $linkref->{'linkendpoints'} ||
$linkref->{'interface_ref'}; $linkref->{'interface_ref'};
my $ifacenum = 1; my $ifacenum = 1;
if (!defined($nickname)) { if (!defined($lanname)) {
$response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef, $response = GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Must provide a virtual_id for links"); "Must provide a virtual_id for links");
goto bad; goto bad;
} }
#
# Ick. Before we create the virt_lan_lans entry, we have to check
# inside to see if one of the interfaces is connected to a lan
# node. In this case, we want to reuse (if its been created) the
# lan name, rather then a bunch of links with one interface, which
# would result in a bogus topology.
#
if (!$istunnel) { if (!$istunnel) {
$virtexperiment->NewTableRow("virt_lan_lans", foreach my $ref (@{ $interfaces }) {
{"vname" => $nickname}); my $node_nickname = $ref->{'virtual_node_id'} ||
$ref->{'node_nickname'};
if (exists($lannodes{$node_nickname})) {
$lanname = $node_nickname;
}
}
if (!defined($virtexperiment->Find("virt_lan_lans", $lanname))) {
$virtexperiment->NewTableRow("virt_lan_lans",
{"vname" => $lanname});
}
} }
foreach my $ref (@{ $interfaces }) { foreach my $ref (@{ $interfaces }) {
...@@ -898,16 +945,25 @@ sub GetTicket($;$) ...@@ -898,16 +945,25 @@ sub GetTicket($;$)
if (!defined($node_nickname)) { if (!defined($node_nickname)) {
$response = $response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef, GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$nickname: Need node id for links"); "$lanname: Need node id for links");
goto bad; goto bad;
} }
if (!defined($iface_id)) { if (!defined($iface_id)) {
$response = $response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef, GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$nickname: Need interface id for links"); "$lanname: Need interface id for links");
goto bad; goto bad;
} }
#
# Look for links that are really lans; one of the interfaces
# is on a fake lan node, which we caught above. Just skip it
# since in the virt topo, a lan is just a link with more then
# two nodes.
#
next
if (exists($lannodes{$node_nickname}));
if ($istunnel) { if ($istunnel) {
# Might be the other side. Skip for now; might bite later. # Might be the other side. Skip for now; might bite later.
next next
...@@ -919,7 +975,7 @@ sub GetTicket($;$) ...@@ -919,7 +975,7 @@ sub GetTicket($;$)
if (!exists($ifacemap{$node_nickname})) { if (!exists($ifacemap{$node_nickname})) {
$response = $response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef, GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$nickname: No such virtual_node_id: ". "$lanname: No such virtual_node_id: ".
"$node_nickname"); "$node_nickname");
goto bad; goto bad;
} }
...@@ -930,7 +986,7 @@ sub GetTicket($;$) ...@@ -930,7 +986,7 @@ sub GetTicket($;$)
if (!exists($ifacemap{$node_nickname}->{$iface_id})) { if (!exists($ifacemap{$node_nickname}->{$iface_id})) {
$response = $response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef, GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$nickname: No such interface on component: ". "$lanname: No such interface on component: ".
"$node_nickname:$iface_id"); "$node_nickname:$iface_id");
goto bad; goto bad;
} }
...@@ -954,7 +1010,7 @@ sub GetTicket($;$) ...@@ -954,7 +1010,7 @@ sub GetTicket($;$)
if (exists($linkref->{'bandwidth'})); if (exists($linkref->{'bandwidth'}));
$virtexperiment->NewTableRow("virt_lans", $virtexperiment->NewTableRow("virt_lans",
{"vname" => $nickname, {"vname" => $lanname,
"vnode" => $node_nickname, "vnode" => $node_nickname,
"vport" => $iface_vport, "vport" => $iface_vport,
"trivial_ok" => 1, "trivial_ok" => 1,
...@@ -1092,7 +1148,10 @@ sub GetTicket($;$) ...@@ -1092,7 +1148,10 @@ sub GetTicket($;$)
} }
# Store the virt topo again since we changed it above. # Store the virt topo again since we changed it above.
$virtexperiment->Dump(); $virtexperiment->Dump();
$virtexperiment->Store(); if ($virtexperiment->Store()) {
$response = GeniResponse->Create(GENIRESPONSE_ERROR, undef);
goto bad;
}
print Dumper($rspec); print Dumper($rspec);
...@@ -1369,6 +1428,7 @@ sub SliverWork($$) ...@@ -1369,6 +1428,7 @@ sub SliverWork($$)
my %nodemap = (); my %nodemap = ();
my %linkmap = (); my %linkmap = ();
my %newnodes = (); my %newnodes = ();
my %lannodes = ();
my %colomap = (); my %colomap = ();
my @allocated= (); my @allocated= ();
my @freenodes= (); my @freenodes= ();
...@@ -1460,6 +1520,18 @@ sub SliverWork($$) ...@@ -1460,6 +1520,18 @@ sub SliverWork($$)
!GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) && !GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) &&
$manager_uuid ne $ENV{'MYUUID'}); $manager_uuid ne $ENV{'MYUUID'});
#
# Lan nodes are fake and do not go into the virt topo. Need
# to remember them though, for when we do the links below.
# They are still in the ticket though.
#
if (exists($ref->{'node_type'}) &&
exists($ref->{'node_type'}->{'type_name'}) &&
$ref->{'node_type'}->{'type_name'} eq "lan") {
$lannodes{$node_nickname} = $ref;
next;
}
my $node = LookupNode($resource_uuid); my $node = LookupNode($resource_uuid);
if (!defined($node)) { if (!defined($node)) {
$message = "Bad resource_uuid $resource_uuid"; $message = "Bad resource_uuid $resource_uuid";
...@@ -1695,6 +1767,10 @@ sub SliverWork($$) ...@@ -1695,6 +1767,10 @@ sub SliverWork($$)
!GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) && !GeniHRN::Equal( $manager_uuid, $ENV{'MYURN'} ) &&
$manager_uuid ne $ENV{'MYUUID'}); $manager_uuid ne $ENV{'MYUUID'});
# Skip lan nodes; they are fake.
next
if (exists($lannodes{$virtual_id}));
# #
# For a map of the interfaces. # For a map of the interfaces.
# #
...@@ -1861,6 +1937,16 @@ sub SliverWork($$) ...@@ -1861,6 +1937,16 @@ sub SliverWork($$)
foreach my $ifaceref (@{ $interfaces }) { foreach my $ifaceref (@{ $interfaces }) {
my $iface_id = $ifaceref->{'virtual_interface_id'}; my $iface_id = $ifaceref->{'virtual_interface_id'};
my $node_id = $ifaceref->{'virtual_node_id'}; my $node_id = $ifaceref->{'virtual_node_id'};
#
# Look for links that are really lans; one of the interfaces
# is on a fake lan node, which we caught above. Just skip it
# since in the virt topo, a lan is just a link with more then
# two nodes.
#
next
if (exists($lannodes{$node_id}));
my $nodesliver = $nodemap{$node_id}; my $nodesliver = $nodemap{$node_id};
if (!defined($nodesliver)) { if (!defined($nodesliver)) {
...@@ -3145,6 +3231,14 @@ sub SliverStatus($) ...@@ -3145,6 +3231,14 @@ sub SliverStatus($)
$details{$node_uuid} = "failed"; $details{$node_uuid} = "failed";
$detailsNew{$hrn} = "failed"; $detailsNew{$hrn} = "failed";
$summary = "failed"; $summary = "failed";
my $bootlog;
my $nodeid = $node->node_id();
if ($node->GetBootLog(\$bootlog) == 0) {
print STDERR "\n\n";
print STDERR "--------------- $nodeid BootLog -------------\n";
print STDERR "$bootlog\n";
}
} }
else { else {
$details{$node_uuid} = "notready"; $details{$node_uuid} = "notready";
......
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