Commit 31e6ea19 authored by Leigh B Stoller's avatar Leigh B Stoller

Check for prereserve when releasing a node from reloading. Cleanup

that section code as well, to use methods.
parent bdd239bd
......@@ -39,6 +39,7 @@ $| = 1;
use event;
use libdb;
use Node;
use libtestbed;
use TimeoutQueue;
use Getopt::Std;
......@@ -1055,6 +1056,13 @@ sub opModeTransition($$;$) {
sub handleCtrlEvent($$) {
my ($node,$event) = @_;
# stated should use the node objects.
my $nodeobj = Node->Lookup($node);
if (!defined($nodeobj)) {
notify("handleCtrlEvent: Could not lookup node object for $node!\n");
info("CtrlEvent: $node, $event\n");
foreach ($event) {
......@@ -1086,16 +1094,21 @@ sub handleCtrlEvent($$) {
(/^$TBRELOADDONEV1$/ || /^$TBRELOADDONEV2$/) && do {
info("Clearing reload info for $node\n");
DBQueryFatal("delete from current_reloads where node_id='$node'");
my ($pid,$eid);
if (($pid eq NODERELOADING_PID) && ($eid eq NODERELOADING_EID)) {
DBQueryFatal("delete from scheduled_reloads ".
"where node_id='$node'");
DBQueryFatal("delete from reserved where node_id='$node'");
$UID, $pid, $eid);
info("Released $node from $pid/$eid\n");
my $experiment = $nodeobj->Reservation();
if (defined($experiment) &&
$experiment->pid() eq NODERELOADING_PID &&
$experiment->eid() eq NODERELOADING_EID) {
my $reserved_pid = $nodeobj->CheckPreReserve(1);
if (defined($reserved_pid)) {
info("Setting pre reserve for $node to $reserved_pid\n");
undef, $experiment);
info("Released $node from $experiment\n");
if ($event eq $TBRELOADDONEV2) {
info("Sending an apod to $node\n");
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