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; } ...@@ -204,7 +204,7 @@ sub TB_DEFAULT_NODELOGTYPE() { TB_NODELOGTYPE_MISC; }
# Reload Types. # Reload Types.
sub TB_RELOADTYPE_NETDISK() { "netdisk"; } sub TB_RELOADTYPE_NETDISK() { "netdisk"; }
sub TB_RELOADTYPE_FRISBEE() { "frisbee"; } sub TB_RELOADTYPE_FRISBEE() { "frisbee"; }
sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_NETDISK; } sub TB_DEFAULT_RELOADTYPE() { TB_RELOADTYPE_FRISBEE; }
# Experiment priorities. # Experiment priorities.
sub TB_EXPTPRIORITY_LOW() { 0; } sub TB_EXPTPRIORITY_LOW() { 0; }
......
...@@ -14,17 +14,18 @@ use Getopt::Std; ...@@ -14,17 +14,18 @@ use Getopt::Std;
# #
sub usage() 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". "<node> [node ...]\n".
"Use -i to specify an imageid. Use node default otherwise.\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 -s to setup reload only, but do not issue a reboot.\n".
"Use -w to block waiting for nodes to finish reloading.\n". "Use -w to block waiting for nodes to finish reloading.\n".
" (-s and -w are mutually exclusive)\n". " (-s and -w are mutually exclusive)\n".
"Use -l to get a list of images you are permitted to load.\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); exit(-1);
} }
my $optlist = "sldwri:"; my $optlist = "sldwrni:";
# #
# Configure variables # Configure variables
...@@ -65,7 +66,7 @@ my $setuponly = 0; ...@@ -65,7 +66,7 @@ my $setuponly = 0;
my $waitmode = 0; my $waitmode = 0;
my $failures = 0; my $failures = 0;
my $startwait = 0; my $startwait = 0;
my $frisbee = 0; my $type = TB_DEFAULT_RELOADTYPE;
# un-taint path # un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin'; $ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
...@@ -95,7 +96,13 @@ if (defined($options{"w"})) { ...@@ -95,7 +96,13 @@ if (defined($options{"w"})) {
$waitmode = 1; $waitmode = 1;
} }
if (defined($options{"r"})) { 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) { if ($waitmode && $setuponly) {
usage(); usage();
...@@ -264,17 +271,19 @@ foreach my $node (@nodes) { ...@@ -264,17 +271,19 @@ foreach my $node (@nodes) {
print STDOUT "Setting up reload for $node\n"; print STDOUT "Setting up reload for $node\n";
if (!$TESTMODE) { if (!$TESTMODE) {
if ($frisbee) { if ($type eq TB_RELOADTYPE_FRISBEE) {
DBQueryFatal("update nodes set ". DBQueryFatal("update nodes set ".
"next_pxe_boot_path='$FRISBEEPATH'" . "next_pxe_boot_path='$FRISBEEPATH'" .
"where node_id='$node'"); "where node_id='$node'");
system "$FRISBEELAUNCHER $imageid" and system "$FRISBEELAUNCHER $imageid" and
die "*** Unable to launch frisbee daemon\n"; die "*** Unable to launch frisbee daemon\n";
} else { } elsif ($type eq TB_RELOADTYPE_NETDISK) {
DBQueryFatal("update nodes set ". DBQueryFatal("update nodes set ".
"next_boot_osid='$NETDISKOSID',". "next_boot_osid='$NETDISKOSID',".
"next_boot_cmd_line='$cmdline' ". "next_boot_cmd_line='$cmdline' ".
"where node_id='$node'"); "where node_id='$node'");
} else {
die "Unknown reload type ($type)\n";
} }
} }
} }
...@@ -306,8 +315,17 @@ while (@nodes) { ...@@ -306,8 +315,17 @@ while (@nodes) {
my @batch = (); my @batch = ();
my $i; 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"; print "Issuing reload/reboot for @batch and then waiting ...\n";
...@@ -388,11 +406,11 @@ sub WaitTillReloadDone { ...@@ -388,11 +406,11 @@ sub WaitTillReloadDone {
while (1) { while (1) {
my ($query_result, @row); my ($query_result, @row);
if ($frisbee) { if ($type eq TB_RELOADTYPE_FRISBEE) {
$query_result = $query_result =
DBQueryFatal("SELECT next_pxe_boot_path FROM nodes ". DBQueryFatal("SELECT next_pxe_boot_path FROM nodes ".
"where node_id='$pc'"); "where node_id='$pc'");
} else { } elsif ($type eq TB_RELOADTYPE_NETDISK) {
$query_result = $query_result =
DBQueryFatal("SELECT next_boot_osid FROM nodes ". DBQueryFatal("SELECT next_boot_osid FROM nodes ".
"where node_id='$pc'"); "where node_id='$pc'");
......
...@@ -8,21 +8,22 @@ use Getopt::Std; ...@@ -8,21 +8,22 @@ use Getopt::Std;
# testbed:reloading. Otherwise, put the right info into the database, and # testbed:reloading. Otherwise, put the right info into the database, and
# nfree will do it when the node gets freed. # 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() 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". "<node> [node ...]\n".
" sched_reload <options> -e pid,eid\n". " sched_reload <options> -e pid,eid\n".
"Use -i to specify an imageid. Use node default otherwise.\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 -f to force reload. Fail if node cannot be reserved.\n".
"Use -p to pend reload for the reload daemon.\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 -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); exit(-1);
} }
my $optlist = "fpri:e:"; my $optlist = "fprni:e:";
# #
# Configure variables # Configure variables
...@@ -49,7 +50,7 @@ my $error = 0; ...@@ -49,7 +50,7 @@ my $error = 0;
my $debug = 0; my $debug = 0;
my $force = 0; my $force = 0;
my $pend = 0; my $pend = 0;
my $frisbee = 0; my $type = TB_DEFAULT_RELOADTYPE;
my @nodes = (); my @nodes = ();
my $usedefault = 1; my $usedefault = 1;
my $imageid; my $imageid;
...@@ -80,8 +81,13 @@ if (defined($options{"p"})) { ...@@ -80,8 +81,13 @@ if (defined($options{"p"})) {
$pend = $options{"p"}; $pend = $options{"p"};
} }
if (defined($options{"r"})) { if (defined($options{"r"})) {
$frisbee = 1; if (defined($options{"n"})) {
$osload .= " -r "; 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) { if ($pend and $force) {
usage(); usage();
...@@ -118,13 +124,14 @@ else { ...@@ -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 # Depending on the reload type, we pass different flags to os_load
# to occur #
if ($frisbee) { my $osload_flags = "";
$type = TB_RELOADTYPE_FRISBEE; if ($type eq TB_RELOADTYPE_NETDISK) {
} else { $osload_flags .= ' -n ';
$type = TB_RELOADTYPE_NETDISK; } elsif ($type eq TB_RELOADTYPE_FRISBEE) {
$osload_flags .= ' -r ';
} }
if ($eidmode) { if ($eidmode) {
...@@ -269,7 +276,7 @@ if ($pend) { ...@@ -269,7 +276,7 @@ if ($pend) {
foreach my $id ( keys(%imagenodes) ) { foreach my $id ( keys(%imagenodes) ) {
my @nodelist = @{ $imagenodes{$imageid} }; my @nodelist = @{ $imagenodes{$imageid} };
my $cmd = "$osload -i $id @nodelist"; my $cmd = "$osload $osload_flags -i $id @nodelist";
print "Issuing $cmd\n"; print "Issuing $cmd\n";
if (system($cmd)) { 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