Commit c1cc49d7 authored by Leigh B Stoller's avatar Leigh B Stoller

Use logging in panic and display spew log file from web interface.

Remove level2 panic from menu for geni slivers (nodes). One level
will do ya.
parent 9d460e1c
......@@ -38,13 +38,15 @@ sub usage()
"-l level - Level 1; reboot nodes into the admin MFS\n".
" - Level 2; disable the control network\n".
"-r - Reset panic state (admin people only)\n".
"-w - From web interface, create a log file.\n".
"<pid> - The project the experiment belongs to\n".
"<eid> - The experiment name (id)\n");
exit(-1);
}
my $optlist = "rl:";
my $optlist = "rl:w";
my $reset = 0;
my $level = 1;
my $dolog = 0;
sub fatal($);
sub DoIt();
......@@ -78,6 +80,7 @@ sub ExitWithStatus($$)
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $snmpit = "$TB/bin/snmpit";
#
# Testbed Support libraries
......@@ -88,8 +91,11 @@ use libtestbed;
use Firewall;
use Experiment;
use User;
use Logfile;
use libaudit;
my $snmpit = "$TB/bin/snmpit";
# Locals
my $logfile;
#
# Untaint the path
......@@ -116,6 +122,9 @@ if (@ARGV != 2) {
if (defined($options{"r"})) {
$reset = 1;
}
if (defined($options{"w"})) {
$dolog = 1;
}
if (defined($options{"l"})) {
$level = 1;
usage()
......@@ -196,6 +205,26 @@ if ($experiment->IsFirewalled()) {
if (!$reset);
}
#
# Coming from the web, use a logfile for spewing.
#
if ($dolog) {
$logfile = $experiment->CreateLogFile("panic");
if (defined($logfile)) {
# We want it to spew to the web.
$experiment->SetLogFile($logfile);
# Mark it open since we are going to start using it right away.
$logfile->Open();
# Use libaudit to handle the logging and demonizing.
my $childpid = LogStart(1, $logfile->filename(),
LIBAUDIT_NODELETE()|LIBAUDIT_LOGTBOPS());
if ($childpid) {
exit(0);
}
}
}
#
# XXX - At this point a failure is going to leave things in an
# inconsistent state.
......@@ -219,6 +248,11 @@ SENDMAIL("$user_name <$user_email>",
"$user_name <$user_email>",
"Cc: $swapper_name <$swapper_email>\n".
"Bcc: $TBOPS");
if (defined($logfile)) {
# Close up the log file so the webpage stops.
$experiment->CloseLogFile();
}
exit(0);
sub fatal($)
......
<?php
#
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -30,6 +30,9 @@ $this_user = CheckLoginOrDie();
$uid = $this_user->uid();
$isadmin = ISADMIN();
# This will not return if its a sajax request.
include("showlogfile_sup.php3");
#
# Verify page arguments.
#
......@@ -113,19 +116,13 @@ if (!isset($confirmed)) {
#
# We run a wrapper script that does all the work.
#
if ($clear) {
STARTBUSY("Clearing the panic button");
}
else {
STARTBUSY("Pressing the panic button");
}
if ($clear) {
$opt = "-r";
}
else {
$opt = "-l $level";
}
$retval = SUEXEC($uid, "$unix_pid,$unix_gid", "webpanic $opt $pid $eid",
$retval = SUEXEC($uid, "$unix_pid,$unix_gid", "webpanic -w $opt $pid $eid",
SUEXEC_ACTION_IGNORE);
#
......@@ -139,25 +136,23 @@ if ($retval < 0) {
#
die("");
}
STOPBUSY();
#
# Exit status >0 means the operation could not proceed.
# Exit status =0 means the experiment is terminating in the background.
#
echo "<br>\n";
if ($retval) {
echo "<h3>Panic Button failure</h3>";
echo "<blockquote><pre>$suexec_output<pre></blockquote>";
}
else {
if ($clear) {
echo "<h3>The panic situation has been cleared!</h3><br>\n";
echo "<h3>Clearing the panic button!</h3>\n";
}
else {
echo "<h3>The panic button has been pressed!</h3><br>
You will need to contact testbed operations to continue.\n";
echo "<h3>Pressing the panic button!</h3>\n";
}
STARTLOG($experiment);
}
#
......
<?php
#
# Copyright (c) 2000-2012 University of Utah and the Flux Group.
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -581,10 +581,11 @@ if ($isadmin) {
WRITESUBMENUBUTTON("Panic Mode (level 1)",
CreateURL("panicbutton", $experiment,
"level", 1));
WRITESUBMENUBUTTON("Panic Mode (level 2)",
CreateURL("panicbutton", $experiment,
"level", 2));
if (! $geniflags) {
WRITESUBMENUBUTTON("Panic Mode (level 2)",
CreateURL("panicbutton", $experiment,
"level", 2));
}
WRITESUBMENUBUTTON("Force Swap Out (Idle-Swap)",
CreateURL("swapexp", $experiment,
"inout", "out", "force", 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