Commit b7da57f5 authored by Kevin Atkinson's avatar Kevin Atkinson

Make nodereboot respect the waittime arg, and wait 10 minutes for PLC.

Currently nodereboot in libreboot essentially ignores the waittime
arg because it forks and calls node_reboot to do the real work, but
doesn't pass on the waittime to it.  Fix this by adding a "-W"
option to node_reboot in order to specify the waittime.

Use this to extend the waittime for a PLC node to come up from 6 minutes to 10.
parent 8a0ced58
...@@ -346,7 +346,7 @@ sub nodereboot($$) ...@@ -346,7 +346,7 @@ sub nodereboot($$)
# #
foreach my $node ( @batch ) { foreach my $node ( @batch ) {
$pids{$node} = RebootNode($nodeobjects{$node}, $reconfig, $pids{$node} = RebootNode($nodeobjects{$node}, $reconfig,
$killmode, $rebootmode, $prepare); $killmode, $rebootmode, $prepare, $waittime);
} }
} }
...@@ -434,7 +434,7 @@ sub nodereboot($$) ...@@ -434,7 +434,7 @@ sub nodereboot($$)
if ($waitmode) { if ($waitmode) {
my $waitstart = time; my $waitstart = time;
print STDOUT "reboot: Waiting for nodes to come up.\n" print STDOUT "reboot: Waiting ($waittime s) for nodes to come up.\n"
if (!$silent); if (!$silent);
# Wait for events to filter through stated! If we do not wait, then we # Wait for events to filter through stated! If we do not wait, then we
...@@ -996,6 +996,8 @@ sub nodereboot_exec($$) ...@@ -996,6 +996,8 @@ sub nodereboot_exec($$)
if (exists($args->{'freemode'}) && $args->{'freemode'}); if (exists($args->{'freemode'}) && $args->{'freemode'});
$cmdline .= " -c" $cmdline .= " -c"
if (exists($args->{'reconfig'}) && $args->{'reconfig'}); if (exists($args->{'reconfig'}) && $args->{'reconfig'});
$cmdline .= " -W$args->{waittime}"
if (exists($args->{'waittime'}) && $args->{'waittime'});
$cmdline .= " @{ $args->{'nodelist'}}"; $cmdline .= " @{ $args->{'nodelist'}}";
$asyncmode = $args->{'asyncmode'} if (exists($args->{'asyncmode'})); $asyncmode = $args->{'asyncmode'} if (exists($args->{'asyncmode'}));
......
...@@ -32,8 +32,8 @@ sub usage() ...@@ -32,8 +32,8 @@ sub usage()
exit(-1); exit(-1);
} }
# The hidden -r option runs this in "realmode", ie don't send an event, but # The hidden -r option runs this in "realmode", ie don't send an event, but
# really do the work instead. # really do the work instead. Hidden -W option specifies the waittime.
my $optlist = "dfe:wrkacbps"; my $optlist = "dfe:wrkacbpsW:";
my $debug = 0; my $debug = 0;
my $silent = 0; my $silent = 0;
my $powercycle = 0; my $powercycle = 0;
...@@ -43,6 +43,7 @@ my $killmode = 0; ...@@ -43,6 +43,7 @@ my $killmode = 0;
my $reconfig = 0; my $reconfig = 0;
my $rebootmode = 0; my $rebootmode = 0;
my $prepare = 0; my $prepare = 0;
my $waittime;
# #
# Configure variables # Configure variables
...@@ -125,6 +126,9 @@ if (defined($options{"r"})) { ...@@ -125,6 +126,9 @@ if (defined($options{"r"})) {
if (defined($options{"c"})) { if (defined($options{"c"})) {
$reconfig = 1; $reconfig = 1;
} }
if (defined($options{"W"})) {
$waittime = $options{"W"};
}
if (defined($options{"a"})) { if (defined($options{"a"})) {
usage() usage()
...@@ -248,6 +252,7 @@ $args{'realmode'} = $realmode; ...@@ -248,6 +252,7 @@ $args{'realmode'} = $realmode;
$args{'killmode'} = $killmode; $args{'killmode'} = $killmode;
$args{'reconfig'} = $reconfig; $args{'reconfig'} = $reconfig;
$args{'prepare'} = $prepare; $args{'prepare'} = $prepare;
$args{'waittime'} = $waittime if defined $waittime;
$args{'nodelist'} = [ @nodes ]; $args{'nodelist'} = [ @nodes ];
exit(nodereboot(\%args, \%status)); exit(nodereboot(\%args, \%status));
...@@ -106,7 +106,7 @@ my $dolastload = 1; ...@@ -106,7 +106,7 @@ my $dolastload = 1;
# Protos # Protos
sub SetupReload($$$); sub SetupReload($$$);
sub FirewallSetup($); sub FirewallSetup($);
sub os_setup_one($$$); sub os_setup_one($$$;$);
# un-taint path # un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
...@@ -616,7 +616,7 @@ if ($plabinelab) { ...@@ -616,7 +616,7 @@ if ($plabinelab) {
my $node = $plcnode; my $node = $plcnode;
TBDebugTimeStamp("rebooting/reloading PLC node"); TBDebugTimeStamp("rebooting/reloading PLC node");
if (!os_setup_one($node, $plcimage, "PLC")) { if (!os_setup_one($node, $plcimage, "PLC", 10*60)) {
tbwarn "PLC node $node failed to boot". tbwarn "PLC node $node failed to boot".
"This has been reported to testbed-ops."; "This has been reported to testbed-ops.";
SENDMAIL($TBOPS, "1 node is down", SENDMAIL($TBOPS, "1 node is down",
...@@ -1577,9 +1577,9 @@ sub FirewallSetup($) ...@@ -1577,9 +1577,9 @@ sub FirewallSetup($)
# Setup a single node, waiting for completion (reload, reboot) # Setup a single node, waiting for completion (reload, reboot)
# before returning. # before returning.
# #
sub os_setup_one($$$) sub os_setup_one($$$;$)
{ {
my ($node,$image,$msgstr) = @_; my ($node,$image,$msgstr,$reboot_waittime) = @_;
# #
# XXX this is probably not entirely right. # XXX this is probably not entirely right.
...@@ -1658,8 +1658,9 @@ sub os_setup_one($$$) ...@@ -1658,8 +1658,9 @@ sub os_setup_one($$$)
my %reboot_args = (); my %reboot_args = ();
my $reboot_failures = {}; my $reboot_failures = {};
$reboot_args{'debug'} = $dbg; $reboot_args{'debug'} = $dbg;
$reboot_args{'waitmode'} = 1; $reboot_args{'waitmode'} = 1;
$reboot_args{'waittime'} = $reboot_waittime;
$reboot_args{'nodelist'} = [ @nodelist ]; $reboot_args{'nodelist'} = [ @nodelist ];
if (nodereboot(\%reboot_args, $reboot_failures) != 0) { if (nodereboot(\%reboot_args, $reboot_failures) != 0) {
......
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