Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
4dc91148
Commit
4dc91148
authored
Feb 05, 2016
by
Leigh B Stoller
Browse files
Generate a local event whenever node_status decides to change the status.
parent
87c044fe
Changes
3
Hide whitespace changes
Inline
Side-by-side
db/EmulabConstants.pm.in
View file @
4dc91148
...
...
@@ -119,6 +119,7 @@ use vars qw(@ISA @EXPORT);
TBDB_TBEVENT_NODESTATE
TBDB_TBEVENT_NODEOPMODE
TBDB_TBEVENT_CONTROL
TBDB_TBEVENT_COMMAND
TBDB_TBEVENT_EXPTSTATE
TBDB_TBEVENT_NODESTARTSTATUS
TBDB_TBEVENT_NODEACCOUNTS
TBDB_TBEVENT_NODESTATUS
TBDB_NODESTATE_ISUP
TBDB_NODESTATE_REBOOTING
TBDB_NODESTATE_REBOOTED
TBDB_NODESTATE_SHUTDOWN
TBDB_NODESTATE_BOOTING
TBDB_NODESTATE_TBSETUP
...
...
@@ -478,6 +479,7 @@ sub TBDB_TBEVENT_COMMAND { "TBCOMMAND"; }
sub
TBDB_TBEVENT_EXPTSTATE
{
"TBEXPTSTATE"
;
}
sub
TBDB_TBEVENT_NODESTARTSTATUS
{
"TBSTARTSTATUS"
;
}
sub
TBDB_TBEVENT_NODEACCOUNTS
{
"TBUPDATEACCOUNTS"
;
}
sub
TBDB_TBEVENT_NODESTATUS
{
"TBNODESTATUS"
;
}
#
#
For
nodes
,
we
use
this
set
of
events
.
...
...
db/Node.pm.in
View file @
4dc91148
...
...
@@ -3170,11 +3170,6 @@ sub GetGeniSliverInfo($$;$)
sub SetStatus($$)
{
my ($self, $status) = @_;
# Must be a real reference.
return -1
if (! ref($self));
my $node_id = $self->node_id();
return -1
...
...
@@ -3184,6 +3179,25 @@ sub SetStatus($$)
return 0;
}
#
# Get the status slot for a node.
#
sub GetStatus($)
{
my ($self) = @_;
my $node_id = $self->node_id();
my $query_result =
DBQueryWarn("select status,status_timestamp from node_status ".
"where node_id='
$
node_id
'");
return undef
if (! (defined($query_result) && $query_result->numrows));
my ($status,$stamp) = $query_result->fetchrow_array();
$self->{"DBROW"}->{'
node_status
'} = $status;
return $status;
}
#
#
#
...
...
db/node_status.in
View file @
4dc91148
#!/usr/bin/perl -w
#
# Copyright (c) 2000-20
08
University of Utah and the Flux Group.
# Copyright (c) 2000-20
16
University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
...
...
@@ -34,6 +34,7 @@ use English;
my
$TB
=
"
@prefix
@
";
my
$TBOPS
=
"
@TBOPSEMAIL
@
";
my
$TBLOGS
=
"
@TBLOGSEMAIL
@
";
my
$BOSSNODE
=
"
@BOSSNODE
@
";
# un-taint path
$ENV
{'
PATH
'}
=
'
/bin:/usr/bin:/usr/local/bin:/usr/site/bin
';
...
...
@@ -52,6 +53,8 @@ $| = 1;
# Load the Testbed support stuff.
use
lib
"
@prefix
@/lib
";
use
libdb
;
use
EmulabConstants
;
use
event
;
#
# Only root and admins are allowed to use this script
...
...
@@ -181,6 +184,13 @@ while (my ($node,$status,$pid,$remote,$isvirt,$isplab,$timediff) =
if
(
!
$debug
)
{
DBQueryFatal
("
update node_status set status='
$newstatus
'
"
.
"
where node_id='
$node
'
");
#
# Generate local event.
#
event::
EventSendWarn
(
objtype
=>
TBDB_TBEVENT_NODESTATUS
,
objname
=>
$node
,
eventtype
=>
$newstatus
,
host
=>
$BOSSNODE
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment