All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 42266abf authored by Mac Newbold's avatar Mac Newbold

Add logging to @prefix@/log/power.log - writes down when and how it was...

Add logging to @prefix@/log/power.log - writes down when and how it was rebooted. Will aid in some debugging tasks, and will be much more important after merging the new stated stuff, when node_reboot will check the state of the node before rebooting it.
parent fbadd74c
......@@ -40,10 +40,12 @@ my $TB = "@prefix@";
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use POSIX qw(strftime);
my $ssh = "$TB/bin/sshtb -n";
my $power = "$TB/bin/power";
my $ipod = "$TB/sbin/ipod";
my $logfile = "$TB/log/power.log";
my $ping = "/sbin/ping";
my %pids = ();
my @row;
......@@ -166,7 +168,7 @@ foreach my $node ( @nodes ) {
}
@nodes = @temp;
if (! @nodes) {
print "No nodes to load. Exiting ...\n";
print "No nodes to reboot. Exiting ...\n";
exit(0);
}
......@@ -208,6 +210,7 @@ while (@sortednodes) {
# In force mode, call the power program for the whole batch, and
# continue on. We don't wait for them to go down or reboot.
#
info("Force mode: power cycle ".join(" ",@batch));
system("$power cycle @batch");
if ($?) {
exit ($? >> 8);
......@@ -290,6 +293,7 @@ sub RebootNode {
# ping returns 0 if any packets make it through.
#
if (! DoesPing($pc)) {
info("$pc appears dead: power cycle");
print STDERR "$pc appears to be dead. Power cycling ...\n" if $debug;
if (PowerCycle($pc)) {
exit(-1);
......@@ -340,9 +344,12 @@ sub RebootNode {
} else {
print STDERR "$pc is wedged.\n" if $debug;
}
info("$pc: ssh reboot failed ... sending ipod");
print STDERR "Trying Ping-of-Death on $pc ...\n" if $debug;
system("$ipod $pc");
} else {
info("$pc: ssh reboot");
}
}
else {
......@@ -367,8 +374,10 @@ sub RebootNode {
exit(0);
}
info("$pc: ipod failed ... power cycle");
print STDERR "$pc is still running. Power cycling ...\n" if $debug;
if (PowerCycle($pc)) {
info("$pc: power cycle failed!");
exit(-1);
}
exit(0);
......@@ -433,3 +442,12 @@ sub DoesPing {
}
return 1;
}
sub info($) {
my $message = shift;
# Print out log entries like this:
# Sep 20 09:36:00 $message
open(LOG,">> $logfile");
print LOG strftime("%b %e %H:%M:%S",localtime)." $message\n";
close(LOG);
}
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