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