Commit 4fc9c0d2 authored by Mike Hibler's avatar Mike Hibler

Clean out the obvious bitrot in the NSE code.

The NSE tutorial example at least swaps in now.
NSE is running and generating traffic as well.
parent 84ef9202
......@@ -261,6 +261,7 @@ sub virtnodetype($) { return $virt_nodes{$_[0]}->{"type"}; }
sub virtnodename($) { return $virt_nodes{$_[0]}->{"vname"}; }
sub virtnodeelabrole($) { return $virt_nodes{$_[0]}->{"inner_elab_role"}; }
sub virtnodeplabrole($) { return $virt_nodes{$_[0]}->{"plab_role"}; }
sub virtnodeosname($) { return $virt_nodes{$_[0]}->{"__osname"}; }
sub virtnodeosid($) { return $virt_nodes{$_[0]}->{"__osid"}; }
sub virtnodesetosid($$) { return $virt_nodes{$_[0]}->{"__osid"} = $_[1]; }
sub virtnodeparent($) { return $virt_nodes{$_[0]}->{"__parent"}; }
......@@ -584,6 +585,10 @@ sub virtlan_use_linkdelay($$) {
my $cpu_usage;
my $mem_usage;
# XXX woeful NSE hack
my $sim_osid;
my $sim_osname = "FBSD-NSE";
# Allow override of jail/delay osids.
my $jail_osid;
my $delay_osid;
......@@ -2817,10 +2822,10 @@ sub InitPnode($$)
# XXX NSE hack:
if (virtnodeisvnode($vnode) && virtnodeissim($vnode)) {
#
# We can use the Jail hosting OSID for NSE now, but allow override.
# Use special sim_osid if it exists, jail_osid otherwise.
#
if (defined($jail_osid)) {
$osid = $jail_osid;
if (defined($sim_osid)) {
$osid = $sim_osid;
}
else {
$osid = nodejailosid(physnodetype($pnode));
......@@ -3966,6 +3971,7 @@ sub LoadVirtNodes()
#
if (defined($osname) && $osname ne "") {
my $osid;
my $ospid = "??";
if (! ($osid = TBOSID($pid, $osname)) &&
! ($osid = TBOSID(TB_OPSPID, $osname))) {
......@@ -3975,6 +3981,8 @@ sub LoadVirtNodes()
}
# Stash this in the virt_nodes data structure.
$rowref->{"__osid"} = $osid;
TBOsidToPid($osid, \$ospid);
$rowref->{"__osname"} = "$ospid-$osname";
}
#
......@@ -4352,6 +4360,12 @@ sub LoadExperiment()
"Invalid OS $delay_osname in project $pid!");
}
}
if (!defined($sim_osid) && defined($sim_osname)) {
if (! ($sim_osid = TBOSID($pid, $sim_osname)) &&
! ($sim_osid = TBOSID(TB_OPSPID, $sim_osname))) {
$sim_osid = $jail_osid;
}
}
# Keep a desire string we can use to make sure that the node type picked
# for the delay node can load the right OS
if ($delay_osid) {
......@@ -4488,7 +4502,8 @@ sub CreateTopFile()
# XXX Set the OSID until I figure out something.
#
if (! defined(virtnodeosid($parent))) {
virtnodesetosid($parent, "emulab-ops-RHL73-IXPHOST");
my $osid = TBOSID(TB_OPSPID, "RHL73-IXPHOST");
virtnodesetosid($parent, $osid);
}
}
}
......@@ -4522,13 +4537,17 @@ sub CreateTopFile()
if (virtnodeissim($node)) {
$simnodes++;
if (defined(virtnodeosid($node))) {
$osid = virtnodeosid($node);
} else {
$osid = "<SIM>";
}
# XXX apparently all simnodes can do veths
$osid = "<SIM>";
if (!exists($osdoesmlink{$osid})) {
$osdoesmlink{$osid} = 0;
$osdoesveth{$osid} = 1;
$osdoesvlan{$osid} = 0;
$osdoeslinkdelays{$osid} = 0;
$osdoeslinkdelays{$osid} = 1;
}
} else {
if (virtnodeisvirt($node)) {
......@@ -4863,10 +4882,11 @@ sub CreateTopFile()
if (!defined($osid)) {
tbreport(SEV_ERROR, 'node_lacks_linkdelay_support', $node, $lan, $osid);
} elsif (! $osdoeslinkdelays{$osid}) {
my $osname = virtnodeosname($node);
tberror({type => 'primary', severity => SEV_ERROR,
error => ['node_lacks_linkdelay_support', $node, $lan, $osid]},
"$node in link $lan is running an OSID ".
"($osid) that does not support linkdelays ".
"$node in link $lan is running an OS ".
"($osname) that does not support linkdelays ".
"(endnode traffic shaping)\n");
$toperrors++;
}
......
......@@ -272,7 +272,8 @@ sub GenDefsFile($)
"left join virt_nodes as vn on vn.pid=v.pid " .
"and vn.eid=v.eid and vn.vname=v.vname " .
"left join reserved as r on r.node_id=v.node_id " .
"where v.pid='$pid' and v.eid='$eid'");
"where r.erole!='delaynode' and " .
"v.pid='$pid' and v.eid='$eid'");
while (my ($vnode,$vtype,$ipports,$pnode) = $query_result->fetchrow_array()) {
print TCL "set v2pmapinfo($vnode) [list $vtype [list $ipports] $pnode]\n";
}
......
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