Commit 3a3c95fb authored by Kirk Webb's avatar Kirk Webb

Parallelize the setup of plab vnodes alongside the loading of local
physical nodes.  We fork vnode_setup to operate on the plab vnodes just
before firing off local reload/reboot/reconfig operations.  The status
of the plab vnode setup setup is checked just before firing off vnode_setup
for any local vnodes.  The ISUP wait for plab vnodes continues to fall
within the same stage as wating for local vnodes.  New arguments have been
added to vnode_setup to tell it to only operate on specific vnode types.
'-j' for local jail nodes, and '-p' for plab nodes.  If neither are
specified, the default is to operate on all types.
parent befb3434
......@@ -648,6 +648,23 @@ if ($plabinelab) {
delete $nodes{$node};
}
#
# Start up plab vnode setup now since it doesn't depend on
# physical node readiness.
#
my $plab_setup_pid = -1;
if (grep($_, values(%plabvnodes))) {
my $plabnumbatch = TBGetSiteVar("plab/setup/vnode_batch_size");
my $plabwait = TBGetSiteVar("plab/setup/vnode_wait_time");
TBDebugTimeStamp("Starting PlanetLab vnode setup.");
if (!($plab_setup_pid = fork())) {
exec("$vnode_setup -p -n $plabnumbatch -w $plabwait $pid $eid")
or die_noretry("Exec failed.");
} elsif ($plab_setup_pid == -1) {
die_noretry("Fork failed.");
}
}
#
# We need to issue the reboots and the reloads in parallel.
#
......@@ -1032,23 +1049,28 @@ elsif ($failed && @vnodelist) {
"failures!";
}
elsif (@vnodelist) {
my $vnode_setup_args = ""; # add any generic args here.
my @retry_list = ();
TBDebugTimeStamp("Setting up virtual nodes");
print "Setting up virtual testbed nodes ...\n";
# If there are any plab vnodes, we have to adjust batching and timeouts
# accordingly.
if (grep($_, values(%plabvnodes))) {
my $plabnumbatch = TBGetSiteVar("plab/setup/vnode_batch_size");
my $plabwait = TBGetSiteVar("plab/setup/vnode_wait_time");
$vnode_setup_args .= " -n $plabnumbatch -w $plabwait ";
# Wait for plab vnode setup to finish if it's running.
if ($plab_setup_pid > 0) {
my $kid = waitpid($plab_setup_pid,0);
if ($kid == $plab_setup_pid) {
if ($?) {
die_noretry("Failed to setup plab vnodes.");
}
} else {
die_noretry("Error waiting for plab vnode to finish.");
}
}
retry:
TBDebugTimeStamp("Setting up virtual nodes");
system("$vnode_setup $vnode_setup_args $pid $eid");
# Only fire off local (jailed) nodes here. Plab vnode setup has
# already been started at this point.
system("$vnode_setup -j $pid $eid");
if ($?) {
die_noretry("Vnode setup failed!");
}
......
......@@ -18,10 +18,10 @@ use Getopt::Std;
#
sub usage()
{
print STDOUT "Usage: vnode_setup [-f] [-k] [-n <numbatch>] [-w <wait_time>] <pid> <eid> [node ...]\n";
print STDOUT "Usage: vnode_setup [-f] [-k] [-j] [-p] [-n <numbatch>] [-w <wait_time>] <pid> <eid> [node ...]\n";
exit(-1);
}
my $optlist = "fdkn:w:";
my $optlist = "fdkjpn:w:";
#
# We don't want to run this script unless its the real version.
......@@ -46,6 +46,8 @@ my $debug = 0;
my $force = 0;
my $failed = 0;
my $killmode = 0;
my $jailonly = 0;
my $plabonly = 0;
my $numbatch = 10;
my $childwait = 120;
my $dbuid;
......@@ -84,6 +86,12 @@ if (defined($options{"d"})) {
if (defined($options{"k"})) {
$killmode = 1;
}
if (defined($options{"j"})) {
$jailonly = 1;
}
if (defined($options{"p"})) {
$plabonly = 1;
}
if (defined($options{"n"})) {
if ($options{"n"} =~ /^(\d+)$/) {
$numbatch = $1;
......@@ -120,6 +128,10 @@ else {
die("*** Bad data in eid: $eid\n");
}
if ($plabonly && $jailonly) {
die("*** '-j' and '-p' are mutually exclusive.");
}
#
# Verify permission to muck with this experiment. Note that this script
# is run as root from the plab monitor daemon.
......@@ -178,6 +190,10 @@ foreach my $node (@nodes) {
if (! TBIsNodeVirtual($node, \$jailed, \$plab)) {
next;
}
if (($plabonly || $jailonly) and
!($plabonly && $plab or $jailonly && $jailed)) {
next;
}
if (! TBPhysNodeID($node, \$pnode)) {
die("*** $0:\n".
" No physical node for $node!\n");
......
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