Commit 5083570d authored by Mike Hibler's avatar Mike Hibler

Server-side hook to send the BSTORE "stop" even during swapout (PreSwap).

parent 41bfeaeb
......@@ -2194,6 +2194,27 @@ sub PreSwap($$$$)
$self->GetGroup()->BumpActivity();
$self->Refresh() == 0
or goto failed;
#
# If swapping out, fire off an event to shutdown SAN-based blockstores.
#
# XXX We do this here because it is before the experimental vlans set
# removed and before vnodes get shutdown.
#
if ($which eq $EXPT_SWAPOUT && $self->UsingRemBlockstore() > 0) {
require event;
print STDERR "Telling nodes to shutdown remote blockstores\n";
event::EventSendWarn(objtype => "BSTORE",
objname => "rem-bstore",
eventtype => "STOP",
expt => "$pid/$eid",
host => "event-server");
# XXX we take down the VLANs immediately after this, so wait a bit
sleep(2);
}
return 0;
failed:
......@@ -4976,6 +4997,32 @@ sub HasVirtInterfaces($)
return $query_result->num_rows;
}
#
# Return 1 if swapped in experiment is using a remote (SAN) blockstore.
# Returns 0 if not, -1 on error.
#
sub UsingRemBlockstore($)
{
my ($self) = @_;
# Must be a real reference.
return -1
if (!ref($self));
# Must be swapped in
return -1
if ($self->state() ne EXPTSTATE_ACTIVE);
my $idx = $self->idx();
my $query_result =
DBQueryWarn("select bs_id from reserved_blockstores ".
"where exptidx=$idx and bs_id like 'lease-%'");
return -1
if (!$query_result);
return ($query_result->num_rows > 0);
}
#
# Set/Unset the lockdown bit.
#
......
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