Commit 844f88b4 authored by David Johnson's avatar David Johnson
Browse files

Allow passing arbitrary reload flags to osload() from os_load.

Now that we're entering the type-specific osload module era, it's
conceivable that modules might expose different parameters that users
could set (i.e., choose to reload via xmodem or tftp).  So, we allow users
to invoke os_load with a list of key/value pairs that get placed into the
reload_args hash argument to osload().

This will probably change later; it just preserves API compat for now.
parent d0cd4035
......@@ -35,10 +35,11 @@ sub usage()
"Use -P to prepare the disk as if a whole disk image was loaded\n".
"Use -F to force the load if Emulab tries to optimize it away\n".
"Use -R to push a reconfig to the node after the reload\n".
"Use -D to set a specific debug level\n");
"Use -D to set a specific debug level\n".
"Use -o <opt1=foo,opt2=bar,...> to set custom options\n");
exit(-1);
}
my $optlist = "swldD:i:e:p:m:rz:PcRF";
my $optlist = "swldD:i:e:p:m:rz:PcRFo:";
my $waitmode = 1;
my $listonly = 0;
my $debug = 0;
......@@ -48,6 +49,7 @@ my $prepare = 0;
my $usecurrent= 0;
my $reconfig = 0;
my $force = 0;
my %reload_args = ();
my @nodes = ();
my $imagepid;
my $pid;
......@@ -117,6 +119,18 @@ $reconfig = 1
if (defined($options{"R"}));
$force = 1
if (defined($options{"F"}));
if (defined($options{"o"})) {
my @kva = split(/,/,$options{"o"});
foreach my $kv (@kva) {
if ($kv =~ /^([\w\-]+)=([^,]+)$/) {
$reload_args{$1} = $2;
}
else {
print STDERR "Improper -o custom option '$kv'!\n";
usage();
}
}
}
#
# Figure out which nodes. Choice of nodes on command line, or all nodes in an
......@@ -344,6 +358,13 @@ $osloadargs{'imageids'} = [ @imageids ]
$osloadargs{'swapinfo'} = 1;
$osloadargs{'usecurrent'} = $usecurrent;
#
# Allow command-line osloadargs overrides
#
foreach my $key (keys(%reload_args)) {
$osloadargs{$key} = $reload_args{$key};
}
my $user = User->ThisUser();
if (EmulabFeatures->FeatureEnabled("NewOsload",$user,$group,$experiment)) {
require libosload_new;
......
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