Commit 44311142 authored by Robert Ricci's avatar Robert Ricci

Transition to tmcd and event-based node state reporting.

Changed scripts that used the 'eventstatus' column to use the more
descriptively-named 'eventstate' column.

The FreeBSD and Linux starup scripts report a 'REBOOTED' state to tmcd
when they start, and 'ISUP' when the starup script is done.

node_reboot and power now send TBNODESTATE/REBOOTING events.
parent d28e8767
......@@ -154,7 +154,7 @@ mydb_nodeidtoip(char *nodeid, char *bufp)
int
mydb_setnodeeventstate(char *nodeid, char *eventtype)
{
if (! mydb_update("update nodes set eventstatus='%s' "
if (! mydb_update("update nodes set eventstate='%s' "
"where node_id='%s'",
eventtype, nodeid)) {
error("setnodestatus: DB Error: %s/%s!", nodeid, eventtype);
......@@ -175,7 +175,7 @@ mydb_checkexptnodeeventstate(char *pid, char *eid,
MYSQL_ROW row;
int nrows;
res = mydb_query("select eventstatus from nodes "
res = mydb_query("select eventstate from nodes "
"left join reserved on "
" nodes.node_id=reserved.node_id "
"where reserved.pid='%s' and reserved.eid='%s' ",
......
......@@ -33,6 +33,7 @@ my $TB = "@prefix@";
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use event;
my $ssh = "$TB/bin/sshtb -n";
my $power = "$TB/bin/power";
......@@ -339,7 +340,10 @@ sub RebootNode {
# punch the power button.
#
if (WaitTillDead($pc) == 0) {
TBSetNodeEventState($pc, TBDB_NODESTATE_REBOOT);
EventSendFatal(objtype => "TBNODESTATE",
objname => $pc,
eventtype => "REBOOTING",
host => TB_BOSSNODE);
exit(0);
}
......
......@@ -23,6 +23,8 @@ use lib "@prefix@/lib";
use libdb;
use power_rpc27;
use snmpit_apc;
use event;
use libtestbed;
use strict;
use English;
......@@ -202,7 +204,10 @@ foreach my $power_id (keys %outlets) {
if (!$errors) {
foreach my $node (@nodes) {
print "$node now ",($op eq "cycle" ? "rebooting" : $op),"\n";
TBSetNodeEventState($node, TBDB_NODESTATE_REBOOT);
EventSendFatal(objtype => "TBNODESTATE",
objname => $node,
eventtype => "REBOOTING",
host => TB_BOSSNODE);
}
} else {
$exitval += $errors;
......
#!/bin/sh
#
# Inform TMCD that we've rebooted, and are starting testbed setup
#
if [ -x /etc/testbed/tmcc ]; then
echo "Informing the testbed that we've rebooted ..."
/etc/testbed/tmcc state REBOOTED
fi
if [ -x /etc/testbed/setup ]; then
echo "Doing Testbed setup configuration ..."
/etc/testbed/setup
......@@ -40,9 +48,9 @@ if [ -x /etc/testbed/rc.agents ]; then
fi
#
# Generate an event that says we are up and running
# Inform TMCD that we're up and running
#
if [ -x /etc/testbed/sendevent ]; then
echo "Sending an ISUP event ..."
/etc/testbed/sendevent ISUP
if [ -x /etc/testbed/tmcc ]; then
echo "Informing the testbed that we're up and running ..."
/etc/testbed/tmcc state ISUP
fi
#!/bin/sh
#
# Inform TMCD that we've rebooted, and are starting testbed setup
#
if [ -x /etc/rc.d/testbed/tmcc ]; then
echo "Informing the testbed that we've rebooted ..."
/etc/rc.d/testbed/tmcc state REBOOTED
fi
if [ -x /etc/rc.d/testbed/setup ]; then
echo "Setting up Testbed Configuration ..."
/etc/rc.d/testbed/setup
......@@ -36,9 +44,9 @@ if [ -x /etc/rc.d/testbed/rc.agents ]; then
fi
#
# Generate an event that says we are up and running
# Inform TMCD that we're up and running
#
if [ -x /etc/rc.d/testbed/sendevent ]; then
echo "Sending an ISUP event ..."
/etc/rc.d/testbed/sendevent ISUP
if [ -x /etc/rc.d/testbed/tmcc ]; then
echo "Informing the testbed that we're up and running ..."
/etc/rc.d/testbed/tmcc state ISUP
fi
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