Commit d0cd4035 authored by David Johnson's avatar David Johnson

Allow forced reload for node types that are not rebootable.

Sometimes we want to mark some node types as not rebootable by default,
but we end up needing to power cycle them occasionally.  For instance, if
we're going to be flashing switches, we don't want any other Emulab
service power cycling them if they are in some unknown state -- only the
service flashing them should be able to power cycle them, because only it
knows what state the node is in.

Tracking node operational state across daemons (or just across fork
boundaries) is a more complex project, and it's not clear it's really
needed, aside from special cases like flashing switches.

So, we just do a little end-around the rebootable attribute.
parent e3bd42ea
......@@ -126,6 +126,7 @@ sub nodereboot($$)
my $reconfig = 0;
my $asyncmode = 0;
my $pipemode = 0;
my $force = 0;
$powercycle = $args->{'powercycle'} if (exists($args->{'powercycle'}));
$rebootmode = $args->{'rebootmode'} if (exists($args->{'rebootmode'}));
......@@ -137,6 +138,7 @@ sub nodereboot($$)
$prepare = $args->{'prepare'} if (exists($args->{'prepare'}));
$reconfig = $args->{'reconfig'} if (exists($args->{'reconfig'}));
$asyncmode = $args->{'asyncmode'} if (exists($args->{'asyncmode'}));
$force = $args->{'force'} if (exists($args->{'force'}));
#
# If pipeno is specified in the environment, we write the results to
......@@ -175,7 +177,7 @@ sub nodereboot($$)
my $rebootable = $nodeobject->rebootable();
$nodeobjects{$node} = $nodeobject;
push(@temp,$node) if $rebootable;
push(@temp,$node) if ($rebootable || $force);
}
@nodes = @temp;
# END XXX
......@@ -1003,6 +1005,8 @@ sub nodereboot_exec($$)
if (exists($args->{'reconfig'}) && $args->{'reconfig'});
$cmdline .= " -W$args->{waittime}"
if (exists($args->{'waittime'}) && $args->{'waittime'});
$cmdline .= " -F"
if (exists($args->{'force'}));
$cmdline .= " @{ $args->{'nodelist'}}";
$asyncmode = $args->{'asyncmode'} if (exists($args->{'asyncmode'}));
......
......@@ -28,12 +28,13 @@ sub usage()
"Use the -b option to reboot nodes in PXEWAIT mode\n" .
"Use the -a option to reboot all free nodes\n".
"Use the -c option to reconfig nodes instead of rebooting\n".
"Use the -f option to power cycle (and not wait for nodes to die)\n");
"Use the -f option to power cycle (and not wait for nodes to die)\n".
"Use the -F option to reboot even if the type is marked nonrebootable\n");
exit(-1);
}
# The hidden -r option runs this in "realmode", ie don't send an event, but
# really do the work instead. Hidden -W option specifies the waittime.
my $optlist = "dfe:wrkacbpsW:";
my $optlist = "dfe:wrkacbpsW:F";
my $debug = 0;
my $silent = 0;
my $powercycle = 0;
......@@ -43,6 +44,7 @@ my $killmode = 0;
my $reconfig = 0;
my $rebootmode = 0;
my $prepare = 0;
my $force = 0;
my $waittime;
#
......@@ -129,6 +131,9 @@ if (defined($options{"c"})) {
if (defined($options{"W"})) {
$waittime = $options{"W"};
}
if (defined($options{"F"})) {
$force = 1;
}
if (defined($options{"a"})) {
usage()
......@@ -253,6 +258,7 @@ $args{'killmode'} = $killmode;
$args{'reconfig'} = $reconfig;
$args{'prepare'} = $prepare;
$args{'waittime'} = $waittime if defined $waittime;
$args{'force'} = $force;
$args{'nodelist'} = [ @nodes ];
exit(nodereboot(\%args, \%status));
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