Commit 258dc8bd authored by Robert Ricci's avatar Robert Ricci

Changed default load type to frisbee. os_load and sched_reload now take

a '-n' option to use netdisk, and will respond properly to changing
TB_DEFAULT_RELOADTYPE in libdb.

os_load also got some fixes for the -w flag when used with Frisbee - it fires
off all nodes at once, rather than two at once.
parent abb71852
......@@ -204,7 +204,7 @@ sub TB_DEFAULT_NODELOGTYPE() { TB_NODELOGTYPE_MISC; }
# Reload Types.
sub TB_RELOADTYPE_NETDISK() { "netdisk"; }
sub TB_RELOADTYPE_FRISBEE() { "frisbee"; }
sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_NETDISK; }
sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_FRISBEE; }
# Experiment priorities.
sub TB_EXPTPRIORITY_LOW() { 0; }
......
......@@ -14,17 +14,18 @@ use Getopt::Std;
#
sub usage()
{
print STDOUT "Usage: os_load [-s | -w] [-r] [-i <imageid>] ".
print STDOUT "Usage: os_load [-s | -w] [-r | -n] [-i <imageid>] ".
"<node> [node ...]\n".
"Use -i to specify an imageid. Use node default otherwise.\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 -r to use Frisbee support instead of netdisk (experimental).\n";
"Use -r to use Frisbee to reload disks.\n" .
"Use -n to use netdisk to reload disks.\n";
exit(-1);
}
my $optlist = "sldwri:";
my $optlist = "sldwrni:";
#
# Configure variables
......@@ -65,7 +66,7 @@ my $setuponly = 0;
my $waitmode = 0;
my $failures = 0;
my $startwait = 0;
my $frisbee = 0;
my $type = TB_DEFAULT_RELOADTYPE;
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
......@@ -95,7 +96,13 @@ if (defined($options{"w"})) {
$waitmode = 1;
}
if (defined($options{"r"})) {
$frisbee = 1;
if (defined($options{"n"})) {
die "Only one of -r or -n should be given\n";
}
$type = TB_RELOADTYPE_FRISBEE;
}
if (defined($options{"n"})) {
$type = TB_RELOADTYPE_NETDISK;
}
if ($waitmode && $setuponly) {
usage();
......@@ -264,17 +271,19 @@ foreach my $node (@nodes) {
print STDOUT "Setting up reload for $node\n";
if (!$TESTMODE) {
if ($frisbee) {
if ($type eq TB_RELOADTYPE_FRISBEE) {
DBQueryFatal("update nodes set ".
"next_pxe_boot_path='$FRISBEEPATH'" .
"where node_id='$node'");
system "$FRISBEELAUNCHER $imageid" and
die "*** Unable to launch frisbee daemon\n";
} else {
} elsif ($type eq TB_RELOADTYPE_NETDISK) {
DBQueryFatal("update nodes set ".
"next_boot_osid='$NETDISKOSID',".
"next_boot_cmd_line='$cmdline' ".
"where node_id='$node'");
} else {
die "Unknown reload type ($type)\n";
}
}
}
......@@ -306,8 +315,17 @@ while (@nodes) {
my @batch = ();
my $i;
for ($i = 0; $i < $MAXLOADS && @nodes > 0; $i++) {
push(@batch, shift(@nodes));
#
# If doing a netdisk load, only do a few at a time. For frisbee, we do
# 'em all
#
if ($type eq TB_RELOADTYPE_NETDISK) {
for ($i = 0; $i < $MAXLOADS && @nodes > 0; $i++) {
push(@batch, shift(@nodes));
}
} elsif ($type eq TB_RELOADTYPE_FRISBEE) {
@batch = @nodes;
@nodes = ();
}
print "Issuing reload/reboot for @batch and then waiting ...\n";
......@@ -388,11 +406,11 @@ sub WaitTillReloadDone {
while (1) {
my ($query_result, @row);
if ($frisbee) {
if ($type eq TB_RELOADTYPE_FRISBEE) {
$query_result =
DBQueryFatal("SELECT next_pxe_boot_path FROM nodes ".
"where node_id='$pc'");
} else {
} elsif ($type eq TB_RELOADTYPE_NETDISK) {
$query_result =
DBQueryFatal("SELECT next_boot_osid FROM nodes ".
"where node_id='$pc'");
......
......@@ -8,21 +8,22 @@ use Getopt::Std;
# testbed:reloading. Otherwise, put the right info into the database, and
# nfree will do it when the node gets freed.
#
# usage: sched_reload [-f | -p] [-r] [-i <imageid>] <node> [node ...]
# usage: sched_reload [-f | -p] [-r|-n] [-i <imageid>] <node> [node ...]
#
sub usage()
{
print STDOUT "Usage: sched_reload [-f | -p] [-r] [-i <imageid>] ".
print STDOUT "Usage: sched_reload [-f | -p] [-r | -n] [-i <imageid>] ".
"<node> [node ...]\n".
" sched_reload <options> -e pid,eid\n".
"Use -i to specify an imageid. Use node default otherwise.\n".
"Use -f to force reload. Fail if node cannot be reserved.\n".
"Use -p to pend reload for the reload daemon.\n".
"Use -e to schedule a reload for all nodes in an experiment.\n".
"Use -r to use Frisbee rather than netdisk (experimental).\n";
"Use -r to use Frisbee for reloading disks.\n" .
"Use -n to use netdisk for reloading disks.\n";
exit(-1);
}
my $optlist = "fpri:e:";
my $optlist = "fprni:e:";
#
# Configure variables
......@@ -49,7 +50,7 @@ my $error = 0;
my $debug = 0;
my $force = 0;
my $pend = 0;
my $frisbee = 0;
my $type = TB_DEFAULT_RELOADTYPE;
my @nodes = ();
my $usedefault = 1;
my $imageid;
......@@ -80,8 +81,13 @@ if (defined($options{"p"})) {
$pend = $options{"p"};
}
if (defined($options{"r"})) {
$frisbee = 1;
$osload .= " -r ";
if (defined($options{"n"})) {
die "Only one of -r or -n should be given\n";
}
$type = TB_RELOADTYPE_FRISBEE;
}
if (defined($options{"n"})) {
$type = TB_RELOADTYPE_NETDISK;
}
if ($pend and $force) {
usage();
......@@ -118,13 +124,14 @@ else {
}
}
# This type will be put into the database, to allow programs
# such as nfree to figure out what kind of reload is supposed
# to occur
if ($frisbee) {
$type = TB_RELOADTYPE_FRISBEE;
} else {
$type = TB_RELOADTYPE_NETDISK;
#
# Depending on the reload type, we pass different flags to os_load
#
my $osload_flags = "";
if ($type eq TB_RELOADTYPE_NETDISK) {
$osload_flags .= ' -n ';
} elsif ($type eq TB_RELOADTYPE_FRISBEE) {
$osload_flags .= ' -r ';
}
if ($eidmode) {
......@@ -269,7 +276,7 @@ if ($pend) {
foreach my $id ( keys(%imagenodes) ) {
my @nodelist = @{ $imagenodes{$imageid} };
my $cmd = "$osload -i $id @nodelist";
my $cmd = "$osload $osload_flags -i $id @nodelist";
print "Issuing $cmd\n";
if (system($cmd)) {
......
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