Commit da0a1419 authored by Leigh Stoller's avatar Leigh Stoller

Change tbswap modify path so that it does not teardown all of the

vnodes when doing the swapout phase. Only do "failed" vnodes, which is
also questionable, but I am leaving that for now.
parent 72da6e47
...@@ -463,13 +463,15 @@ sub doSwapout($) { ...@@ -463,13 +463,15 @@ sub doSwapout($) {
$cleanvlans = 0; $cleanvlans = 0;
} }
TBDebugTimeStamp("snmpit finished"); TBDebugTimeStamp("snmpit finished");
}
if ($type >= CLEANUP) {
#
# We're not attempting a retry;
# #
# This is a hack. We need a more general os_teardown, but for now # Stop all of the vnodes.
# we just kill off the vnode stuff.
# (don't kill off vnodes when UPDATEing.)
# #
if ($type >= RETRY) { if (! $TESTMODE) {
print "Tearing down virtual nodes.\n"; print "Tearing down virtual nodes.\n";
TBDebugTimeStamp("vnode_setup -k started"); TBDebugTimeStamp("vnode_setup -k started");
if (system("vnode_setup -d -k $pid $eid")) { if (system("vnode_setup -d -k $pid $eid")) {
...@@ -478,11 +480,8 @@ sub doSwapout($) { ...@@ -478,11 +480,8 @@ sub doSwapout($) {
} }
TBDebugTimeStamp("vnode_setup finished"); TBDebugTimeStamp("vnode_setup finished");
} }
}
if ($type >= CLEANUP) {
# #
# We're not attempting a retry;
# remove all nodes from the experiment. # remove all nodes from the experiment.
# (nfree will send them to RES_FREE_DIRTY) # (nfree will send them to RES_FREE_DIRTY)
# #
...@@ -507,25 +506,44 @@ sub doSwapout($) { ...@@ -507,25 +506,44 @@ sub doSwapout($) {
# incorporated into the experiment (i.e., are RES_READY). # incorporated into the experiment (i.e., are RES_READY).
# (nfree will send deallocated nodes to RES_FREE_DIRTY) # (nfree will send deallocated nodes to RES_FREE_DIRTY)
# #
my @failedpnodes = ();
my @failedNodes = (); my @failedvnodes = ();
$db_result =
DBQueryFatal("select rv.node_id, n.allocstate ". my $db_result =
"from reserved as rv ". DBQueryFatal("select rv.node_id,n.allocstate,nt.isvirtnode ".
"left join nodes as n on ". " from reserved as rv ".
"n.node_id = rv.node_id ". "left join nodes as n on n.node_id = rv.node_id ".
"left join node_types as nt on nt.type=n.type ".
"where rv.pid='$pid' and rv.eid='$eid'"); "where rv.pid='$pid' and rv.eid='$eid'");
while (my ($node,$allocstate) = $db_result->fetchrow_array) { while (my ($node,$allocstate,$isvirt) = $db_result->fetchrow_array) {
if ($allocstate ne TBDB_ALLOCSTATE_RES_READY()) { if ($allocstate ne TBDB_ALLOCSTATE_RES_READY()) {
push(@failedNodes, $node); if ($isvirt) {
push(@failedvnodes, $node);
}
else {
push(@failedpnodes, $node);
}
} }
} }
# XXX reboot nodes [e.g., put them in RES_DIRTY()] #
# if doing an update -restart. # Tear down failed vnodes. Perhaps not needed?
#
if (!$TESTMODE && @failedvnodes > 0) {
print "Tearing down failed virtual nodes.\n";
TBDebugTimeStamp("vnode_setup -k started");
if (system("vnode_setup -d -k $pid $eid @failedvnodes")) {
print STDERR "*** Failed to tear down vnodes.\n";
$swapout_errors = 1;
}
TBDebugTimeStamp("vnode_setup -k finished");
}
if (@failedNodes > 0) { #
# Release all failed nodes.
#
if (@failedpnodes > 0 || @failedvnodes > 0) {
print STDERR "Freeing failed nodes.\n"; print STDERR "Freeing failed nodes.\n";
TBDebugTimeStamp("nfree started"); TBDebugTimeStamp("nfree started");
...@@ -534,7 +552,8 @@ sub doSwapout($) { ...@@ -534,7 +552,8 @@ sub doSwapout($) {
# any virtual nodes (owned by this experiment) # any virtual nodes (owned by this experiment)
# sitting on top of it are freed as well. # sitting on top of it are freed as well.
# #
if (system("nfree -x $pid $eid " . join(" ", @failedNodes))) { if (system("nfree -x $pid $eid " .
join(" ", (@failedpnodes, @failedvnodes)))) {
print STDERR "*** Could not free nodes.\n"; print STDERR "*** Could not free nodes.\n";
$swapout_errors = 1; $swapout_errors = 1;
} }
......
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