Commit 735758ce authored by Mike Hibler's avatar Mike Hibler
Browse files

Minor tweak to "waitmode" in libreboot.

Previously ISUP and TBFAILED were the two states that signified that a
node had rebooted to the satisfaction of libreboot (with waitmode==1).
Add RELOAD/RELOADING to that list since the frisbee MFS never sends either

Required a modification to TBNodeStateWait() to allow waiting for an
op-mode/state combo as well as just a state.

I made this change in anticipation that it would be useful for more
responsive monitoring of failure in tbswap/os_load. But now I am no so sure.
parent f6d9b778
#!/usr/bin/perl -w
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# All rights reserved.
# This library mostly contains old stuff that should phased out in
......@@ -1936,7 +1936,8 @@ sub TBNodeConsoleTail ($$) {
# Wait for a node to hit a certain state. Provide a start time and a max
# wait time.
# wait time. A "state" can actually be "<op-mode>/<state>" in which case
# it will match against both node.op_mode and node.eventstate.
# NB: This function is not as general purpose as it might seem; there are
# not many "terminal" states that you can wait for (like isup).
......@@ -1952,21 +1953,33 @@ sub TBNodeStateWait ($$$$@) {
my $waittime = 0;
my $minutes = 0;
my $needopmode = grep(/\//, @waitstates);
# Wait for the node to finish booting, as recorded in database
while (1) {
my $state;
if (!TBGetNodeEventState($pc, \$state)) {
print "*** Error getting event state for $pc.\n";
my ($state, $opmode);
if (($needopmode && !TBGetNodeOpMode($pc, \$opmode)) ||
!TBGetNodeEventState($pc, \$state)) {
print "*** Error getting event op-mode/state for $pc.\n";
return 1;
if (grep {$_ eq $state} @waitstates) {
$$actual = $state
if (defined($actual));
return 0;
foreach my $wstate (@waitstates) {
if ($needopmode && $wstate =~ /^(.*)\/(.*)$/) {
if (($1 eq TBDB_NODEOPMODE_ANY || $1 eq $opmode) &&
$2 eq $state) {
# note that we return opmode/state
$$actual = "$opmode/$state"
if (defined($actual));
return 0;
} elsif ($state eq $wstate) {
$$actual = $state
if (defined($actual));
return 0;
$waittime = time - $waitstart;
......@@ -503,6 +503,17 @@ sub nodereboot($$)
# could see nodes still in ISUP.
# States that signify that the reboot stage is done.
# For normal reboots this means either that the node came
# or correctly (ISUP) or not (TBFAILED). However, for a reloading
# node there is no ISUP, it either got into the reloading process
# (RELOAD/RELOADING) or it didn't (no explicit report).
my @waitstates = (TBDB_NODESTATE_TBFAILED,
foreach my $node (sort(@nodes)) {
my $actual_state;
......@@ -512,11 +523,14 @@ sub nodereboot($$)
if ($result->{node});
if (!TBNodeStateWait($node, $waitstart, $waittime, \$actual_state,
if ($actual_state eq TBDB_NODESTATE_ISUP) {
print STDOUT "reboot ($node): alive and well.\n";
if (!TBNodeStateWait($node, $waitstart, $waittime,
\$actual_state, @waitstates)) {
if ($actual_state ne TBDB_NODESTATE_TBFAILED) {
if ($actual_state eq TBDB_NODESTATE_ISUP) {
print STDOUT "reboot ($node): alive and well.\n";
} else {
print STDOUT "reboot ($node): alive and reloading.\n";
Node::SetBootStatus($node, NODEBOOTSTATUS_OKAY);
Supports Markdown
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