Commit 58f2b014 authored by Leigh Stoller's avatar Leigh Stoller

Small set of changes for os_setup on sdr nodes.

SDR nodes (type=sdr, but this applies to other similar types) are in the
"pc" class, but really they are not pcs, they are more like blackboxes
that can be power cycled and are always ISUP.

So, I added a "sdr" package to libossetup, that basically just does a
power cycle to put them into a known state, and makes sure the
eventstate is ISUP.

I added "blackbox" to the sdr type definition. Aside; when something is
a blackbox, we should bypass all image/osinfo handling, but that's a
tale for another day.

I added a isblackbox() check in power, to skip any eventstate
handling. Aside; node_reboot should possibly skip right to power cycle
for blackbox nodes, instead of trying to ping it or ssh into it.
parent 5ff9d6dd
......@@ -1736,6 +1736,7 @@ sub isgeninode($) { return NodeTypeInfo($_[0])->isgeninode(); }
sub isfednode($) { return NodeTypeInfo($_[0])->isfednode(); }
sub isdedicatedremote($) { return NodeTypeInfo($_[0])->isdedicatedremote(); }
sub isswitch($) { return NodeTypeInfo($_[0])->isswitch(); }
sub isblackbox($) { return NodeTypeInfo($_[0])->isblackbox(); }
#
# Later has arrived...
......
......@@ -53,6 +53,7 @@ use EmulabFeatures;
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $NODEREBOOT = "$TB/bin/node_reboot";
my $POWER = "$TB/bin/power";
my $VNODESETUP = "$TB/sbin/vnode_setup";
my $ELABINELAB = "$TB/sbin/elabinelab";
my $TBADB = "$TB/bin/tbadb";
......@@ -2356,5 +2357,79 @@ sub LightUpNodes($@) {
return $self->SUPER::LightUpNodes(@nodelist);
}
#####################################################################
#
# sdr
#
package libossetup_sdr;
use base qw(libossetup_handler);
use libdb;
use libtestbed;
use libossetup;
use libtblog_simple;
use Node;
use English;
use Data::Dumper;
#
# A constructor for an object to handle all nodes of this type.
#
sub New($$) {
my ($class, $parent) = @_;
my $self = $class->SUPER::New("sdr", $parent);
bless($self, $class);
return $self;
}
sub AddNode($$)
{
my ($self, $node) = @_;
return $self->SUPER::AddNode($node);
}
#
# Kirk says we always want to power cycle the SDRs when entering an experiment.
# We pass -e option to power so it does not change the eventstate.
#
sub LightUpNodes($@)
{
my ($self, @nodelist) = @_;
my $parent = $self->parent();
my @nodeids = ();
foreach my $node (@nodelist) {
push(@nodeids, $node->node_id())
if ($node->allocstate() ne TBDB_ALLOCSTATE_RES_READY());
}
tbnotice("Power cycling SDR nodes: @nodeids\n");
system("$POWER -e cycle @nodeids");
my $exitval = $?;
if ($exitval) {
# This is very unusual.
$parent->noretry(1);
return -1;
}
#
# If the eventstate somewhow managed to get out of ISUP, send it.
#
foreach my $node (@nodelist) {
next
if ($node->allocstate() eq TBDB_ALLOCSTATE_RES_READY());
if (!$node->IsUp()) {
if ($node->SetEventState(TBDB_NODESTATE_ISUP(), 0)) {
$parent->noretry(1);
return -1;
}
}
}
return 0;
}
# This needs to be the last thing in the file.
1;
......@@ -226,6 +226,9 @@ if ($ELABINELAB) {
}
if ($sendevent) {
foreach my $node (values(%nodes)) {
next
if ($node->isblackbox());
my $oldstate = $node->eventstate();
my $newstate;
......
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