Commit b81d25b6 authored by David Johnson's avatar David Johnson

Grab the vtype for this plc so we can create vnodes of the correct type,

and give appropriate log msgs.
parent 89fa1e79
......@@ -48,6 +48,7 @@ my $PLABHOLDING_PID = PLABHOLDING_PID();
my $PLABHOLDING_EID = PLABHOLDING_EID();
my $plcname = '';
my $plcvtype = '';
sub new($$$$$) {
......@@ -70,6 +71,18 @@ sub new($$$$$) {
$self->{'PNODES'} = {};
$self->{'PENDING'} = {};
# grab the vtype for this plc:
my $qr = DBQueryFatal("select node_type from plab_plc_info" .
" where plc_name='$plcname'");
if ($qr->num_rows() < 1) {
die "could not find vtype for plc $plcname!";
}
elsif ($qr->num_rows() > 1) {
die "too many possible vtypes for plc $plcname!";
}
my @qrow = $qr->fetchrow_array();
$plcvtype = $qrow[0];
bless($self,$class);
return $self;
}
......@@ -457,7 +470,7 @@ sub nodesetupcomplete($$) {
TBSetNodeLogEntry($pnode->{'name'}, "root", TB_DEFAULT_NODELOGTYPE(),
"'Moved to $PLABHOLDING_EID; ".
"plab node $pnode->{'vnode'} setup okay by monitor.'");
"$plcvtype node $pnode->{'vnode'} setup okay by monitor.'");
# XXX: move to goodpool.
......
......@@ -55,6 +55,7 @@ my $PLABTESTING_PID = PLABTESTING_PID();
my $PLABTESTING_EID = PLABTESTING_EID();
my $plcname = '';
my $plcvtype = '';
sub new($$$$$) {
......@@ -77,12 +78,21 @@ sub new($$$$$) {
$self->{'PNODES'} = {};
$self->{'PENDING'} = {};
# grab the vtype for this plc:
my $qr = DBQueryFatal("select node_type from plab_plc_info" .
" where plc_name='$plcname'");
if ($qr->num_rows() < 1) {
die "could not find vtype for plc $plcname!";
}
elsif ($qr->num_rows() > 1) {
die "too many possible vtypes for plc $plcname!";
}
my @qrow = $qr->fetchrow_array();
$plcvtype = $qrow[0];
# Clean up anything left behind by a terminated monitor
# XXX: this is kind of hacky, but it works.
#
# figure out
my @vnodes = ();
my $qres = DBQueryFatal("select r.node_id" .
" from reserved as r" .
......@@ -136,7 +146,7 @@ sub checknextnode($) {
my %options = ( 'pid' => $PLABTESTING_PID,
'eid' => $PLABTESTING_EID,
'count' => 1,
'vtype' => 'pcplab',
'vtype' => "$plcvtype",
'nodeid' => $pnode->{'name'});
if (Node::CreateVnodes(\@vnodes, \%options)) {
print "Failed to allocate vnode for $pnode->{'name'}!\n";
......@@ -512,7 +522,7 @@ sub movetodownpool($$) {
TBSetNodeLogEntry($pnode->{'name'}, "root", TB_DEFAULT_NODELOGTYPE(),
"'Moved to $PLABDOWN_EID; ".
"plab node $pnode->{'vnode'} setup failed by monitor.'");
"$plcvtype node $pnode->{'vnode'} setup failed by monitor.'");
}
# Make perl happy...
......
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