Commit 610e1471 authored by Shashi Guruprasad's avatar Shashi Guruprasad

Added -e option to swapexp which says "restart event system". Similarly

added -eventsys_restart option to tbswap. These options are allowed
only with swapexp -s modify and correspondingly for tbswap with update.
Tested with a 1 node experiment and things seem to work fine.
parent 37809501
......@@ -16,11 +16,11 @@ use Getopt::Std;
sub usage()
{
print STDOUT "Usage: swapexp [-b] [-i | -a | -f] [-r] ".
print STDOUT "Usage: swapexp [-b] [-i | -a | -f] [-r] [-e] ".
"<-s in | out | restart | modify | pause> <pid> <eid> [<nsfile>]\n";
exit(-1);
}
my $optlist = "biafrs:";
my $optlist = "biafres:";
#
# Exit codes are important; they tell the web page what has happened so
......@@ -69,6 +69,7 @@ my $idleswap = 0;
my $autoswap = 0;
my $force = 0;
my $reboot = 0;
my $eventsys_restart = 0;
my $errorstat= -1;
my $modifyHosed = 0;
......@@ -124,6 +125,9 @@ if (defined($options{"b"})) {
if (defined($options{"r"})) {
$reboot = 1;
}
if (defined($options{"e"})) {
$eventsys_restart = 1;
}
if (defined($options{"s"})) {
$inout = $options{"s"};
......@@ -142,6 +146,11 @@ else {
if ($inout ne "modify" && @ARGV != 2) {
usage();
}
if ($eventsys_restart && $inout ne "modify") {
print STDOUT "Usage: swapexp: -e (eventsys_restart) can be used ".
"only with -s modify\n";
usage();
}
my $pid = $ARGV[0];
my $eid = $ARGV[1];
......@@ -630,6 +639,7 @@ elsif ($inout eq "modify") {
SetExpState($pid, $eid, EXPTSTATE_MODIFY_RESWAP);
my $optarg = ($reboot ? "-reboot" : "");
$optarg .= ($eventsys_restart ? " -eventsys_restart" : "");
print STDOUT "Running 'tbswap update $optarg $pid $eid'\n";
if (system("$tbdir/tbswap update $optarg $pid $eid") != 0) {
......
......@@ -24,7 +24,7 @@ use English;
sub usage()
{
print STDERR "Usage: $0 -force { in | out | update [-reboot] } pid eid\n";
print STDERR "Usage: $0 -force { in | out | update [-reboot] [-eventsys_restart] } pid eid\n";
exit(-1);
}
......@@ -66,6 +66,7 @@ sub UPDATE_RECOVER() { return 0; }
$| = 1;
my $updateReboot = 0;
my $updateEventsys_restart = 0;
my $force = 0;
my $errors = 0;
my $assignWrapperErrorCode = 0;
......@@ -100,6 +101,8 @@ while ($#ARGV > 1) {
$force = 1;
} elsif ($arg eq "-reboot") {
$updateReboot = 1;
} elsif ($arg eq "-eventsys_restart" && $swapop eq "update") {
$update_Eventsys_restart = 1;
} else {
usage();
}
......@@ -309,7 +312,7 @@ sub doSwapout($) {
if (! $TESTMODE) {
if (! $DISABLE_EVENTS) {
if ($type >= RETRY) {
if ($type >= RETRY || ($update_Eventsys_restart && $type == UPDATE) ) {
print "Stopping the event system\n";
if (system("eventsys_control stop $pid $eid")) {
print STDERR "*** Failed to stop the event system.\n";
......@@ -844,7 +847,8 @@ sub doSwapin($) {
# event system previously, so starting it again will fail!
#
if (! $DISABLE_EVENTS) {
if ($type != UPDATE && $type != UPDATE_RECOVER) {
if ( $update_Eventsys_restart ||
($type != UPDATE && $type != UPDATE_RECOVER) ) {
print "Starting the event system.\n";
TBDebugTimeStamp("eventsys_control started");
if (system("eventsys_control start $pid $eid")) {
......
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