Commit 4233af4e authored by Chad Barb's avatar Chad Barb

For the benefit of our users,
added 'reboot nodes in experiment' checkbox,
on by default, with a stern warning.
parent b5a1ffdd
......@@ -15,11 +15,11 @@ use Getopt::Std;
#
sub usage()
{
print STDOUT "Usage: swapexp [-i] <-s in | out | restart | modify> ".
print STDOUT "Usage: swapexp [-i] [-r] <-s in | out | restart | modify> ".
"<pid> <eid> [<nsfile>]\n";
exit(-1);
}
my $optlist = "s:i";
my $optlist = "s:ir";
#
# Configure variables
......@@ -40,6 +40,8 @@ my $tbdir = "$TB/bin/";
my $tbdata = "tbdata";
my $batch = 0;
my $idleswap = 0;
my $reboot = 0;
my $inout;
my $logname;
my $dbuid;
......@@ -47,7 +49,7 @@ my $user_name;
my $user_email;
my @row;
my $action;
#
# Untaint the path
#
......@@ -77,6 +79,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"i"})) {
$idleswap = 1;
}
if (defined($options{"r"})) {
$reboot = 1;
}
if (defined($options{"s"})) {
$inout = $options{"s"};
......@@ -350,6 +355,12 @@ elsif ($inout eq "modify") {
}
system("$tbdir/tbreport -b $pid $eid 2>&1 > $repfile");
if ($reboot) {
if (system("$tbdir/node_reboot -e $pid,$eid") != 0) {
fatal("node reboot failed!\n");
}
}
}
}
else { # $inout eq "restart" assumed.
......
......@@ -82,7 +82,16 @@ if (! isset($go)) {
echo "</textarea>";
echo "<br />";
# echo "<input type='checkbox' name='restart' value='1'>Restart experiment</input>";
if (0 == strcmp($expstate, $TB_EXPTSTATE_ACTIVE)) {
echo "<p><b>Note!</b> If changing your experiment topology
(adding or removing nodes, links, and LANs), you will most likely
have to reboot all nodes in your experiment (check the box below.)
If adding/removing a delay to/from an existing link, or replacing
a lost node <i>without modifying the experiment topology</i>,
this won't be necessary.</p>";
echo "<input type='checkbox' name='reboot' value='1' checked='1'>
Reboot nodes in experiment</input>";
}
echo "<br />";
echo "<input type='hidden' name='pid' value='$pid' />";
echo "<input type='hidden' name='eid' value='$eid' />";
......@@ -131,8 +140,12 @@ if (! isset($go)) {
$output = array();
$retval = 0;
$rebootswitch = "";
if ($reboot) { $rebootswitch = "-r"; }
$result = exec("$TBSUEXEC_PATH $uid $unix_gid ".
"webswapexp -s modify $pid $eid $nsfile",
"webswapexp $rebootswitch -s modify $pid $eid $nsfile",
$output, $retval);
if ($retval) {
......
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