Commit 7ce00088 authored by Mike Hibler's avatar Mike Hibler

Update OS command line on delay nodes if node is reloaded with a new OS.

Every once in a while, I change the version of FreeBSD running on a delay
node (with os_load) and it would blow up because the command line to boot
the delay kernel with would be wrong.

Note that this is not a general fix for default command lines, it is limited
to delay node kernels.
parent 0c84b674
......@@ -472,12 +472,38 @@ sub osload ($$) {
}
#
# Change the node's default command line as necessary.
# XXX we only do this for delay nodes.
#
if ($defosid && $nodeobject->erole() eq "delaynode") {
my $osinfo = OSinfo->Lookup($defosid);
if ($osinfo) {
my ($ocmdline,$ncmdline);
$ocmdline = $nodeobject->def_boot_cmd_line();
$ocmdline = ""
if (!defined($ocmdline));
$osinfo->OSBootCmd("delay", \$ncmdline);
$ncmdline = ""
if (!defined($ncmdline));
if ($ocmdline ne $ncmdline) {
print "osload ($node): Changing cmdline: ".
"'$ocmdline' -> '$ncmdline'\n";
if (!DBQueryWarn("update nodes set ".
"def_boot_cmd_line='$ncmdline' ".
"where node_id='$node'")) {
tbwarn "$node: Could not update command line";
}
}
}
}
#
# Setup swapinfo now after partitions have initialized but before
# we setup the one-shot frisbee load.
#
if ($swapinfo) {
print "osload: Updating image signature.\n";
print "osload ($node): Updating image signature.\n";
osload_setupswapinfo(undef, undef, $node);
}
......
......@@ -1794,6 +1794,28 @@ sub SetBootOS($$)
}
}
#
# Change the node's default command line as necessary.
# XXX we only do this for delay nodes.
#
if ($nodeobject->erole() eq "delaynode") {
my ($ocmdline,$ncmdline);
$ocmdline = $nodeobject->def_boot_cmd_line();
$ocmdline = ""
if (!defined($ocmdline));
$osinfo->OSBootCmd("delay", \$ncmdline);
$ncmdline = ""
if (!defined($ncmdline));
if ($ocmdline ne $ncmdline) {
print "$self SetBootOS($node_id): changing default command line to '$ncmdline'\n";
if (!DBQueryWarn("update nodes set ".
"def_boot_cmd_line='$ncmdline' ".
"where node_id='$node_id'")) {
tbwarn "$self SetBootOS($node_id): could not update command line";
}
}
}
return 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