Commit def28c32 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Minor additions for Shashi:

* Make the NS file an optional argument to swapexp modify; when not
  given the prerun phase is skipped. Instead, go directly to tbswap
  (run assign, etc).

* Add NSESWAP event so that Shashi can fire off the above modify using
  tevc from an experimental node.

	tevc -e pid/eid now ns nseswap

* Change event scheduler to react to above event, and fire off:

	nseswap pid eid

  as the user. The script should do its thing, and *exec* swapexp with
  the proper args as quickly as possible (so that the event scheduler
  is not hung up for too long. The script is invoked as the user,
  since the event scheduler is running as the user.
parent 188b96e4
......@@ -626,6 +626,9 @@ handle_simevent(event_handle_t handle, sched_event_t *eventp)
else if (!strcmp(evtype, TBDB_EVENTTYPE_HALT)) {
sprintf(cmd, "endexp %s %s", pid, eid);
}
else if (!strcmp(evtype, TBDB_EVENTTYPE_NSESWAP)) {
sprintf(cmd, "nseswap %s %s", pid, eid);
}
rcode = system(cmd);
/* Should not return, but ... */
......
......@@ -37,6 +37,7 @@ char *tbdb_eventtypes[] = {
TBDB_EVENTTYPE_RESET,
TBDB_EVENTTYPE_HALT,
TBDB_EVENTTYPE_SWAPOUT,
TBDB_EVENTTYPE_NSESWAP,
TBDB_NODESTATE_ISUP,
TBDB_NODESTATE_REBOOTED,
TBDB_NODESTATE_REBOOTING,
......
......@@ -50,6 +50,7 @@
#define TBDB_EVENTTYPE_RESET "RESET"
#define TBDB_EVENTTYPE_HALT "HALT"
#define TBDB_EVENTTYPE_SWAPOUT "SWAPOUT"
#define TBDB_EVENTTYPE_NSESWAP "NSESWAP"
#define TBDB_NODESTATE_ISUP "ISUP"
#define TBDB_NODESTATE_REBOOTED "REBOOTED"
......
......@@ -139,7 +139,7 @@ else {
usage();
}
if (@ARGV != (($inout eq "modify") ? 3 : 2)) {
if ($inout ne "modify" && @ARGV != 2) {
usage();
}
my $pid = $ARGV[0];
......@@ -166,7 +166,7 @@ my $userdir = TBExptUserDir($pid, $eid);
my $tempnsfile;
my $modnsfile;
if ($inout eq "modify") {
if ($inout eq "modify" && @ARGV > 2) {
$tempnsfile = $ARGV[2];
#
......@@ -523,7 +523,7 @@ if (! UserDBInfo($expt_head_login, \$expt_head_name, \$expt_head_email)) {
#
# Before going to background, we have to copy out the NS file!
#
if ($inout eq "modify") {
if ($inout eq "modify" && defined($modnsfile)) {
unlink($modnsfile);
if (system("/bin/cp", "$tempnsfile", "$modnsfile")) {
die("*** $0:\n".
......@@ -609,11 +609,14 @@ elsif ($inout eq "modify") {
}
#
# Rerun tbprerun if modifying.
# Rerun tbprerun if modifying, but only if new NS file provided.
# Yep, we allow reswap without changing the NS file. For Shashi and SIM.
#
print STDOUT "Running 'tbprerun $pid $eid $modnsfile'\n";
if (system("$tbdir/tbprerun $pid $eid $modnsfile") != 0) {
$modifyError = "tbprerun failed!";
if (defined($modnsfile)) {
print STDOUT "Running 'tbprerun $pid $eid $modnsfile'\n";
if (system("$tbdir/tbprerun $pid $eid $modnsfile") != 0) {
$modifyError = "tbprerun failed!";
}
}
#
......
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