Commit f2770fc1 authored by David Johnson's avatar David Johnson
Browse files

Add support for the ExternalNodeManagement feature to geni ossetup path.

parent dab8b9c4
......@@ -1540,6 +1540,22 @@ sub Action($$$;$)
my $pid = $experiment->pid();
my $eid = $experiment->eid();
#
# External node management means that someone else is going to be
# answering DHCP after nodes reboot. For nodes in PXEWAIT, we need
# to make sure they are really rebooted and not just told to check
# in with bootinfo again.
#
# Note that in this path, raw nodes are always rebooted in realmode
# via $NODEREBOOT below, but I leave this in here and force them to
# reboot anyway, just so that the feature doesn't get lost accidentally.
#
my $externalNodeManagement = 0;
if (EmulabFeatures->FeatureEnabled("ExternalNodeManagement",
undef, undef, $experiment)) {
$externalNodeManagement = 1;
}
#
# Look for a firewall that needs to be setup first.
#
......@@ -1797,6 +1813,14 @@ sub Action($$$;$)
#
}
push(@waitpnodes, $node);
#
# If this is an externally-managed experiment, force the
# node to do a real reboot to pick up a new DHCP response.
#
if ($externalNodeManagement) {
$reboots{$node->node_id} = $node;
}
#
# If the node is not imageable, then there is not much to
......@@ -1834,13 +1858,20 @@ sub Action($$$;$)
print STDERR " Mapping $osinfo on $node to $tmp\n";
$osinfo = $tmp;
}
#
# Make sure this OSID is actually loaded on the machine.
#
my $isloaded = $node->IsOSLoaded($osinfo);
if ($isloaded < 0) {
$msg .= "Error determining if $osinfo is loaded on $node";
goto bad;
my $isloaded;
if ($osinfo->mfs()) {
$isloaded = 1;
$reload = 0;
}
else {
#
# Make sure this OSID is actually loaded on the machine.
#
$isloaded = $node->IsOSLoaded($osinfo);
if ($isloaded < 0) {
$msg .= "Error determining if $osinfo is loaded on $node";
goto bad;
}
}
if (!$isloaded || $reload) {
print STDERR " Setting up a reload for $node\n";
......@@ -2241,10 +2272,19 @@ sub Action($$$;$)
# Mark them as being rebooted. See below.
map { $_->_rebooted(1) } values(%reboots);
my $cmdbits = "";
#
# If this is an externally-managed experiment, force the
# node to do a real reboot to pick up a new DHCP response.
#
if ($externalNodeManagement) {
$cmdbits = " -b ";
}
#
# Should waiting be an option?
#
system("$NODEREBOOT @node_ids");
system("$NODEREBOOT $cmdbits @node_ids");
if ($?) {
$msg .= "Failed to reboot @node_ids";
goto bad;
......@@ -2269,9 +2309,20 @@ sub Action($$$;$)
#
# Worked? Set the new state. Needs more thought ...
#
# (Also handle externally-managed node forced state transition,
# since we won't be notified via the normal reboot path.)
#
foreach my $sliver (@slivers) {
$sliver->SetState("started")
if (ref($sliver) eq "GeniSliver::Node");
if (ref($sliver) eq "GeniSliver::Node") {
$sliver->SetState("started");
# XXX: Poke at stated to move along nodes that are going to be
# externally managed. This feels kind of kludgy.
if ($externalNodeManagement) {
my $emnode = Node->Lookup($sliver->resource_id());
$emnode->SetEventState(TBDB_NODESTATE_BOOTING());
}
}
}
my @failed = ();
return -1
......
......@@ -61,6 +61,7 @@ use GeniImage;
use libtestbed;
use emutil;
use EmulabConstants;
use EmulabFeatures;
use libEmulab;
use Lan;
use User;
......@@ -7124,6 +7125,23 @@ sub GeniExperiment($;$)
(defined($creator) ? $creator->urn() : undef),
"protogeni");
$slice->SetExperiment($experiment);
#
# Check for feature to back off and let something else manage the
# nodes in the experiment. Unconditionally mark the experiment since
# this feature is most likely to come from the swapper or project.
# Need to do this before nalloc is called by the mapper.
#
if (EmulabFeatures->FeatureEnabled("ExternalNodeManagement",
$creator,
$experiment->GetGroup(),
$experiment)) {
print STDERR "ExternalNodeManagement feature is set".
" for $slice, $experiment";
EmulabFeatures->Lookup("ExternalNodeManagement")->
Enable($experiment);
}
return $experiment;
}
......
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