Commit ca561d42 authored by Kirk Webb's avatar Kirk Webb

Add support for disabling dhcp for an experiment/user/group

In support of the collaboration effort with CHPC, I've added a check
and actions for a new feature, ExternalNodeManagment.  When swapping in,
the swapper, group, and experiment are checked for the feature.  Since
there doesn't appear to be a way to ask for an experiment feature in the
parser, I'm punting for now and just letting the experiment inherit this
feature from the user and/or project/group.

The effect of this feature is that nodes will be omitted from the
dhcpd.conf file when allocated to a marked experiment, and put back
in when freed from that experiment.

We will also use this feature to force nodes to reboot even when they
are in PXEWAIT during the OS setup phase.  Ultimately the point is for
something else to take over the boot process and manage the experiment's
nodes for the duration of the experiment.
parent 9bd94e27
......@@ -69,6 +69,9 @@ use lib "@prefix@/lib";
use libdb;
use libtestbed;
use Node;
use Experiment;
use EmulabFeatures;
use EmulabConstants;
#
# PXE boot constants
......@@ -285,7 +288,7 @@ while (<IF>) {
else {
$node_id = $row{"node_id"};
}
# Management ports, nothing special to do.
if ($role eq TBDB_IFACEROLE_MANAGEMENT()) {
my $network = inet_ntoa(inet_aton($ip) &
......@@ -308,6 +311,25 @@ while (<IF>) {
my $tag;
if (defined($row{"pid"})) {
$tag = $row{"pid"} . ":" . $row{"eid"};
#
# Escape hatch for nodes reserved to experiments
# which are marked for external node management.
# Some other entity will be responsible for
# bootstrapping them in this case, so leave them
# out of the DHCP config file. This feature can
# be set on any or all of: swapper, project,
# experiment. Only do this when the experiment is
# swapping in.
#
my $experiment = Experiment->Lookup($row{"pid"},
$row{"eid"});
next
if (defined($experiment)
&& $experiment->state() eq EXPTSTATE_ACTIVATING()
&& EmulabFeatures->FeatureEnabled(
"ExternalNodeManagement", undef, undef,
$experiment));
}
if (defined($tag) && defined($servernodes{$tag}) &&
......
......@@ -49,6 +49,7 @@ my $partial = 0;
my $TB = "@prefix@";
my $consetup = "$TB/libexec/console_setup";
my $exportsetup = "$TB/sbin/exports_setup";
my $makeconf = "$TB/sbin/dhcpd_makeconf";
#
# Testbed Support libraries
......@@ -60,6 +61,7 @@ use Experiment;
use Project;
use User;
use Node;
use EmulabFeatures;
#
# Turn off line buffering on output
......@@ -294,6 +296,17 @@ if ($need_consetup && !$error && @nodes) {
TBDebugTimeStamp("nalloc finished console setup");
}
if (EmulabFeatures->FeatureEnabled("ExternalNodeManagement",
undef, undef,
$experiment)) {
print "ExternalNodeManagement feature is set: Disabling Emulab ".
"management of nodes in $experiment ...\n";
# Shut off dhcp response for nodes in this experiment.
if (system("$makeconf -i -r")) {
print STDERR "WARNING: Failed to reconfigure dhcp!\n";
}
}
#
# Exit with -1 if an error, else the number of nodes that could not
# be allocated.
......
......@@ -67,6 +67,7 @@ use Experiment;
use Node;
use OSinfo;
use Lan;
use EmulabFeatures;
# Local stuff
my $consetup = "$TB/libexec/console_setup";
......@@ -206,6 +207,16 @@ else {
}
}
#
# Trigger a remake of the dhcpd.conf file for any experiment marked
# with the ExternalNodeManagement feature.
#
if (EmulabFeatures->FeatureEnabled("ExternalNodeManagement",
undef, undef,
$experiment)) {
$mustmakeconf = 1;
}
#
# Sanity check. Do not want to release nodes if they have ports that
# are trunked or disabled. Means something went wrong elsewhere and
......
......@@ -1024,6 +1024,21 @@ sub doSwapin($) {
return 1;
}
}
#
# 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",
$this_user,
$group,
$experiment)) {
TBDebugTimeStamp("ExternalNodeManagement feature is set.");
EmulabFeatures->Lookup("ExternalNodeManagement")->
Enable($experiment);
}
print "Mapping to physical reality ...\n";
TBDebugTimeStamp("mapper wrapper started");
......
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