Commit f34f900d authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Do not kill the container if an error happens during a reboot of an

existing containter.
parent e9472de4
...@@ -25,6 +25,7 @@ sub usage() ...@@ -25,6 +25,7 @@ sub usage()
my $optlist = "d"; my $optlist = "d";
my $debug = 1; my $debug = 1;
my $leaveme = 0; my $leaveme = 0;
my $running = 0;
my $cleaning = 0; my $cleaning = 0;
my $rebooting= 0; my $rebooting= 0;
my $vnodeid; my $vnodeid;
...@@ -147,12 +148,8 @@ if ($DOMAINNAME =~ /^[-\w]+\.(.*)$/) { ...@@ -147,12 +148,8 @@ if ($DOMAINNAME =~ /^[-\w]+\.(.*)$/) {
else { else {
die("Could not parse domain name!"); die("Could not parse domain name!");
} }
#
# Need the bossip, which was returned above
#
if ($BOSSIP !~ /^\d+\.\d+\.\d+\.\d+$/) { if ($BOSSIP !~ /^\d+\.\d+\.\d+\.\d+$/) {
die "Bad bossip '$BOSSIP' in $BOOTDIR/bossip!"; die "Bad bossip '$BOSSIP' from bossinfo!";
} }
# #
...@@ -287,6 +284,8 @@ if (! -e "$VNDIR/vnode.info") { ...@@ -287,6 +284,8 @@ if (! -e "$VNDIR/vnode.info") {
mysystem("mkdir -p /var/emulab/jails/$vnodeid"); mysystem("mkdir -p /var/emulab/jails/$vnodeid");
} }
else { else {
$rebooting = 1;
my $str = `cat $VNDIR/vnode.info`; my $str = `cat $VNDIR/vnode.info`;
chomp($str); chomp($str);
($vmid, $vmtype) = ($str =~ /^(\d*) (\w*)$/); ($vmid, $vmtype) = ($str =~ /^(\d*) (\w*)$/);
...@@ -301,7 +300,6 @@ else { ...@@ -301,7 +300,6 @@ else {
if ($ret ne VNODE_STATUS_STOPPED()) { if ($ret ne VNODE_STATUS_STOPPED()) {
MyFatal("vnode $vnodeid not stopped, not booting!"); MyFatal("vnode $vnodeid not stopped, not booting!");
} }
$rebooting = 1;
} }
my $cnet_mac = ipToMac($vnconfig{'CTRLIP'}); my $cnet_mac = ipToMac($vnconfig{'CTRLIP'});
...@@ -446,6 +444,7 @@ TBDebugTimeStamp("finished $vmtype rootPostConfig()") ...@@ -446,6 +444,7 @@ TBDebugTimeStamp("finished $vmtype rootPostConfig()")
# This is for vnodesetup # This is for vnodesetup
mysystem("touch $VNDIR/running"); mysystem("touch $VNDIR/running");
$running = 1;
# #
# Install a signal handler to catch signals from vnodesetup. # Install a signal handler to catch signals from vnodesetup.
...@@ -596,6 +595,13 @@ sub MyFatal($) ...@@ -596,6 +595,13 @@ sub MyFatal($)
{ {
my ($msg) = @_; my ($msg) = @_;
#
# If rebooting but never got a chance to run, we do not want
# to kill off the container. Might lose user data.
#
$leaveme = 1
if ($rebooting && !$running);
Cleanup(); Cleanup();
die("*** $0:\n". die("*** $0:\n".
" $msg\n"); " $msg\n");
......
Supports Markdown
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