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