Commit 455dcee9 authored by Robert Ricci's avatar Robert Ricci

Added support for the new current_reloads table - this table is intended

to contain a list of reloads currently in processes. It is filled by
os_load, and is cleared out by the tmcd 'reset' command or by nfree.
The tmcd 'loadaddr' command now uses this table instead of the reloads table.

Also added Frisbee support to sched_reload, and changed the Frisbee command
line option to os_load to '-r' to avoid a conflict with sched_reload's '-f'
option.
parent 525ed62f
......@@ -163,6 +163,14 @@ foreach my $n (@node_names) {
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
&& $error++);
# Clean out the current_reloads table
$cmd = "delete from current_reloads where node_id='$'";
$sth = $dbh->query($cmd)
|| (print "Failed Command:\n$cmd\nError string is:".$dbh->errstr."\n"
&& $error++);
}
$cmd = "unlock tables";
......
......@@ -17,15 +17,15 @@ use Getopt::Std;
#
sub usage()
{
print STDOUT "Usage: os_load [-sw] [-f] <imageid> <node> [node ...]\n".
print STDOUT "Usage: os_load [-sw] [-r] <imageid> <node> [node ...]\n".
"Use -s to setup reload only, but do not issue a reboot\n".
"Use -w to block waiting for nodes to finish reloading\n".
" (-s and -w are mutually exclusive)\n".
"Use -l to get a list of images you are permitted to load\n" .
"Use -f to use (highly experimental) frisbee support instead of netdisk\n";
"Use -r to use Frisbee support instead of netdisk\n";
exit(-1);
}
my $optlist = "sldwf";
my $optlist = "sldwr";
#
# Configure variables
......@@ -50,6 +50,7 @@ my $BOSSADDR = "boss.emulab.net";
my $USERADDR = "users.emulab.net";
my $NETDISKOSID = "NETDISK-STD";
my $FRISBEEPATH = "boss.emulab.net:/tftpboot/pxeboot.frisbee";
my $FRISBEELAUNCHER = "$TB/sbin/frisbeelauncher";
my $nodereboot = "$TB/bin/node_reboot";
my $ping = "/sbin/ping";
my $dbg = 0;
......@@ -90,7 +91,7 @@ if (defined($options{"s"})) {
if (defined($options{"w"})) {
$waitmode = 1;
}
if (defined($options{"f"})) {
if (defined($options{"r"})) {
$frisbee = 1;
}
if ($waitmode && $setuponly) {
......@@ -205,6 +206,11 @@ foreach my $node (@nodes) {
"where node_id='$pc'");
}
# Put it in the current_reloads table so that nodes can find out which
# OS to load
DBQueryFatal("replace into current_reloads ".
"(node_id, image_id) values ('$pc', '$imageid')");
#
# Assign partition table entries for each partition in the image.
# This is complicated by the fact that an image that covers only
......@@ -238,8 +244,7 @@ foreach my $node (@nodes) {
DBQueryFatal("update nodes set ".
"next_pxe_boot_path='$FRISBEEPATH'" .
"where node_id='$pc'");
# XXX: Need to pass image somehow
system "$FRISBEELAUNCHER $imageid" and die "Unable to launch frisbee daemon\n";
} else {
DBQueryFatal("update nodes set ".
"next_boot_osid='$NETDISKOSID',".
......
......@@ -14,10 +14,11 @@ sub usage()
{
print STDOUT "Usage: sched_reload [-f | -p] <imageid> <node> [node ...]\n".
"Use the -f to force reload. Fail if node cannot be reserved.\n".
"Use the -p to pend reload for the reload daemon.\n";
"Use the -p to pend reload for the reload daemon.\n" .
"Use the -r use Frisbee rather than netdisk (experimental).\n";
exit(-1);
}
my $optlist = "fp";
my $optlist = "fpr";
#
# Configure variables
......@@ -44,6 +45,7 @@ my $error = 0;
my $debug = 0;
my $force = 0;
my $pend = 0;
my $frisbee = 0;
my @nodes = ();
my @row;
......@@ -70,6 +72,10 @@ if (defined($options{"f"})) {
if (defined($options{"p"})) {
$pend = $options{"p"};
}
if (defined($options{"r"})) {
$frisbee = 1;
$osload .= " -r ";
}
if ($pend and $force) {
usage();
}
......
......@@ -1878,6 +1878,15 @@ doreset(int sock, struct in_addr ipaddr, char *rdata, int tcp)
"next_pxe_boot_path!", nodeid);
return 1;
}
syslog(LOG_INFO, "doreset: %s: Clearing current_reloads",
nodeid);
if (mydb_update("delete from current_reloads "
"where node_id='%s'", nodeid)) {
syslog(LOG_ERR, "doreset: %s: DB Error clearing "
"current_reloads!", nodeid);
return 1;
}
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