Commit 9d460e1c authored by Leigh Stoller's avatar Leigh Stoller

Add vnode halt/restart to Panic().

parent 60de5482
#!/usr/bin/perl -wT
#
# Copyright (c) 2005-2013 University of Utah and the Flux Group.
# Copyright (c) 2005-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -2772,6 +2772,53 @@ sub NodeList($;$$)
return @nodes;
}
#
# Return list of experiment nodes (objects or just names)
#
sub VirtNodeList($$)
{
my ($self, $namesonly) = @_;
my @nodenames = ();
# Must be a real reference.
return undef
if (! ref($self));
$namesonly = 0
if (!defined($namesonly));
my $pid = $self->pid();
my $eid = $self->eid();
my $query_result =
DBQueryWarn("select r.node_id,nt.isvirtnode from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"where r.pid='$pid' and r.eid='$eid' and ".
" nt.isvirtnode=1");
return undef
if (!$query_result);
return ()
if (!$query_result->numrows);
while (my ($nodeid) = $query_result->fetchrow_array()) {
push(@nodenames, $nodeid);
}
return @nodenames
if ($namesonly);
my @nodes = ();
foreach my $nodeid (@nodenames) {
my $node = Node->Lookup($nodeid);
if (!defined($node)) {
print STDERR "*** Could not map $nodeid to its object\n";
return undef;
}
push(@nodes, $node);
}
return @nodes;
}
#
# Return list of experiment switches (objects or just names)
#
......
......@@ -39,6 +39,7 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $POWER = "$TB/bin/power";
my $SNMPIT = "$TB/bin/snmpit";
my $VNODESETUP= "$TB/sbin/vnode_setup";
# Flags.
sub FWSETUP() { return 1; }
......@@ -608,6 +609,7 @@ sub Panic($$$)
}
my @nodes = ();
$experiment->LocalNodeListNames(\@nodes, 1);
my @vnodes = $experiment->VirtNodeList(1);
if ($which == PANIC_ZAP()) {
$level = $experiment->paniced();
......@@ -692,6 +694,15 @@ sub Panic($$$)
if ($level == 1) {
goto nonodes
if (!@nodes);
#
# Do the VMs. We continue if we get errors, want to do
# as much as possible.
#
if (@vnodes) {
print "Restarting all containers ...\n";
system("$VNODESETUP -d -f -j $pid $eid");
}
#
# Turn admin mode back off and reboot back to the old OS
......@@ -731,10 +742,19 @@ sub Panic($$$)
}
elsif ($which == PANIC_PANIC()) {
if ($level == 1) {
#
# Do the VMs. We continue if we get errors, want to do
# as much as possible.
#
if (@vnodes) {
print "Halting all containers ...\n";
system("$VNODESETUP -d -f -h $pid $eid");
}
#
# Boot into the admin MFS
#
print "Booting all nodes into admin mode and waiting ...\n";
print "Booting all phys nodes into admin mode and waiting ...\n";
my %myargs;
$myargs{'name'} = "$0";
......
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