Commit 000f737d authored by Mike Hibler's avatar Mike Hibler

Make sure "os_select -c" doesn't fail if all osids are already clear.

Otherwise this blows up the swapout of a firewalled elabinelab.
parent 4a4dcaa2
......@@ -2798,10 +2798,19 @@ sub ResetNextOpMode($$)
# screwed since we will not be able to figure out the opmode.
#
my ($bootosid, $bootopmode) = TBBootWhat($nodeid, $debug);
if (!$bootosid) {
if (!defined($bootosid)) {
print STDERR "Bootwhat query failed for $nodeid!\n";
return -1;
}
#
# If it returned 0 the node is in PXEWAIT.
# For the node to do anything useful going forward, someone will
# have to first set one of the osids with os_select.
#
if ($bootosid == 0) {
return 0;
}
print STDERR "Bootwhat says: $nodeid => $bootosid,$bootopmode\n"
if ($debug);
......
......@@ -458,7 +458,7 @@ sub TBBootWhat($;$)
if (!$query_result || !$query_result->numrows) {
print("*** Warning: No bootwhat info for $node\n");
return 0;
return undef;
}
my ($def_boot_osid, $def_boot_opmode,
$temp_boot_osid, $temp_boot_opmode,
......@@ -474,8 +474,12 @@ sub TBBootWhat($;$)
return ($def_boot_osid, $def_boot_opmode)
if (defined($def_boot_osid) && $def_boot_osid ne 0);
#
# If all info is clear, the node will boot into PXEWAIT.
# This is not an error.
#
print("*** Warning: node '$node': All boot info was null!\n");
return undef;
return (0, 0);
}
#
......
......@@ -824,6 +824,13 @@ sub stateTransition($$) {
# See if we are in the right mode/osid.
#
my ($bootosid,$bootopmode) = TBBootWhat($node, $debug);
if (!defined($bootosid)) {
info("$node: TBBootWhat say node doesn't exist!?");
next;
} elsif ($bootosid == 0) {
info("$node: should be in PXEWAIT, why are we here?!");
next;
}
info("$node: BootWhat says $bootosid (mode $bootopmode).\n");
DBQueryFatal("update nodes set osid='$bootosid' ".
......
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