Commit 3274e602 authored by Robert Ricci's avatar Robert Ricci
Browse files

cleanup() now waits for os_setup, if it's running.

Also added a dire warning about parallelism, so that we hopefully
won't forget about it when adding new steps to the swapin process.
parent 00622343
......@@ -48,6 +48,11 @@ my $state;
sub cleanup {
print STDERR "Cleaning up after errors.\n";
if ($os_setup_pid) {
print "Waiting for os_setup to finish\n";
waitpid($os_setup_pid,0);
}
print "Stopping event system\n";
if (system("eventsys_control stop $pid $eid")) {
print STDERR "*** Failed to stop the event system.\n";
......@@ -128,6 +133,14 @@ if (system("exports_setup")) {
exit(1);
}
print "Setting up named maps.\n";
if (system("named_setup")) {
print STDERR "*** WARNING: Failed to add node names to named map.\n";
#
# This is a non-fatal error.
#
}
print "Starting the event system.\n";
if (system("eventsys_control start $pid $eid")) {
print STDERR "*** Failed to start the event system.\n";
......@@ -148,6 +161,13 @@ if (!($os_setup_pid = fork())) {
exit(1);
}
#
# XXX: Don't add any steps between here and the waitpid() call below without
# verifying that 1) It's OK for nodes to come up before the step has
# completed and 2) It's OK for the command to run in parallel with os_setup
# (no DB dependencies, etc.)
#
print "Setting up VLANs.\n";
if (system("snmpit -t $pid $eid")) {
print STDERR "*** Failed to set up VLANs.\n";
......@@ -160,14 +180,6 @@ if (system("snmpit -t $pid $eid")) {
#
$cleanvlans = 1;
print "Setting up named maps.\n";
if (system("named_setup")) {
print STDERR "*** WARNING: Failed to add node names to named map.\n";
#
# This is a non-fatal error.
#
}
print "Setting up email lists.\n";
if (system("genelists")) {
print STDERR "*** WARNING: Failed to update email lists.\n";
......@@ -181,12 +193,14 @@ if (system("genelists")) {
#
$kid = waitpid($os_setup_pid,0);
if ($kid == $os_setup_pid) {
undef $os_setup_pid; # Make sure cleanup() doesn't wait for it
if ($CHILD_ERROR) {
print STDERR "*** Failed to reset OS and reboot nodes.\n";
cleanup;
exit(1);
}
} else {
undef $os_setup_pid;
print STDERR "*** Error waiting for os_setup to finish.\n";
cleanup;
exit(1);
......
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