Commit 5dcb7973 authored by Leigh Stoller's avatar Leigh Stoller

ElabInElab addition; couple of little changes to allow me to reboot

(real reboot, not bootinfo requery) nodes. I'm using this to move
nodes in PXEWAIT back to outer emulab, thereby avoiding power cycle of
all inner testnodes.
parent fd47f859
......@@ -93,6 +93,7 @@ sub nodereboot($$)
}
my @nodes = @{ $args->{'nodelist'}};
my $powercycle = 0;
my $rebootmode = 0;
my $waitmode = 0;
my $realmode = 1;
my $killmode = 0;
......@@ -102,6 +103,7 @@ sub nodereboot($$)
my $pipemode = 0;
$powercycle = $args->{'powercycle'} if (exists($args->{'powercycle'}));
$rebootmode = $args->{'rebootmode'} if (exists($args->{'rebootmode'}));
$waitmode = $args->{'waitmode'} if (exists($args->{'waitmode'}));
$realmode = $args->{'realmode'} if (exists($args->{'realmode'}));
$killmode = $args->{'killmode'} if (exists($args->{'killmode'}));
......@@ -307,7 +309,8 @@ sub nodereboot($$)
# We need the pid so we can wait for them all before preceeding.
#
foreach my $node ( @batch ) {
$pids{$node} = RebootNode($node, $reconfig, $killmode);
$pids{$node} = RebootNode($node, $reconfig,
$killmode, $rebootmode);
}
}
......@@ -450,7 +453,7 @@ sub nodereboot($$)
# that it can wait on all the children later.
#
sub RebootNode {
my ($pc, $reconfig, $killmode) = @_;
my ($pc, $reconfig, $killmode, $rebootmode) = @_;
my ($status, $syspid, $mypid, $didipod, $nodestate);
if ($reconfig) {
......@@ -499,11 +502,12 @@ sub RebootNode {
#
# The aux program sends the event to stated ...
#
my $reqarg = ($rebootmode ? "-r" : "-q");
my $optarg = ($debug ? "-dd" : "");
print STDERR "reboot ($pc): in $nodestate: sending wakeup command.\n"
if $debug;
system("$bisend $optarg -q $pc");
system("$bisend $optarg $reqarg $pc");
if ($?) {
info("$pc: PXEWAKEUP failed ... power cycle");
print STDERR
......@@ -855,6 +859,8 @@ sub nodereboot_exec($$)
if (exists($args->{'debug'}) && $args->{'debug'});
$cmdline .= " -f"
if (exists($args->{'powercycle'}) && $args->{'powercycle'});
$cmdline .= " -b"
if (exists($args->{'rebootmode'}) && $args->{'rebootmode'});
$cmdline .= " -w"
if (exists($args->{'waitmode'}) && $args->{'waitmode'});
$cmdline .= " -r"
......
......@@ -23,6 +23,7 @@ sub usage()
"Use the -e option to reboot all the nodes in an experiment\n" .
"Use the -w option to to wait for nodes is come back up\n" .
"Use the -k option to power cycle nodes in PXEWAIT mode\n" .
"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");
......@@ -30,13 +31,14 @@ sub usage()
}
# The hidden -r option runs this in "realmode", ie don't send an event, but
# really do the work instead.
my $optlist = "dfe:wrkac";
my $optlist = "dfe:wrkacb";
my $debug = 0;
my $powercycle = 0;
my $waitmode = 0;
my $realmode = 1; # XXX Temporary, until we make event sending the default.
my $killmode = 0;
my $reconfig = 0;
my $rebootmode = 0;
#
# Configure variables
......@@ -80,6 +82,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"b"})) {
$rebootmode = 1;
}
if (defined($options{"f"})) {
$powercycle = 1;
}
......@@ -206,6 +211,7 @@ my %status = ();
$args{'debug'} = $debug;
$args{'powercycle'} = $powercycle;
$args{'rebootmode'} = $rebootmode;
$args{'waitmode'} = $waitmode;
$args{'realmode'} = $realmode;
$args{'killmode'} = $killmode;
......
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