Commit 6626aa9a authored by Mac Newbold's avatar Mac Newbold

Changes to maintain our invariant that (pid,eid,vname) is unique in the

reserved table. Whenever you insert a reservation or change a reservation
to a new expt, set vname=node_id.
parent 9c0cd1ec
......@@ -110,7 +110,7 @@ foreach my $n (@node_names) {
# End shark hack
} else {
# its not a shark - just add it in...
push(@vals,"('$n','$pid','$eid')");
push(@vals,"('$n','$pid','$eid','$n')");
push(@nodes,"$n");
}
}
......@@ -128,7 +128,8 @@ if (!$error && @vals) {
if ($debug) {
print "Reserving nodes...\n";
}
my $cmd = "insert into reserved (node_id,pid,eid) values ".join(",",@vals);
my $cmd = "insert into reserved (node_id,pid,eid,vname) values ".
join(",",@vals);
if (!DBQueryWarn($cmd)) {
$error++;
}
......
......@@ -175,7 +175,7 @@ foreach my $n (@nodes) {
# Move to locked reservation. Node is not free, but is no longer
# owned by the pid/eid, so cannot be mucked with.
if (! DBQueryWarn("update reserved " .
"set vname=NULL, pid='$reloadpid', eid='$lockedeid' ".
"set vname='$n', pid='$reloadpid', eid='$lockedeid' ".
"where node_id='$n'")) {
print "*** WARNING: Error locking down node $n!\n";
next;
......@@ -303,7 +303,7 @@ foreach my $n (@freed_nodes) {
print "Moving $n to $next_pid/$next_eid.\n";
DBQueryWarn("update reserved set pid='$next_pid',eid='$next_eid'," .
"vname=NULL where node_id='$n'")
"vname='$n' where node_id='$n'")
|| $error++;
DBQueryWarn("delete from next_reserve where node_id='$n'")
......@@ -327,9 +327,8 @@ foreach my $n (@freed_nodes) {
if ( !$TESTMODE && ((!$isvirt && $imageable) || $result->numrows()) ) {
print "Moving $n to $reloadpid/$pendingeid.\n";
DBQueryWarn("update reserved set ".
"pid='$reloadpid',eid='$pendingeid' ".
"where node_id='$n'") || $error++;
DBQueryWarn("update reserved set pid='$reloadpid',eid='$pendingeid',".
"vname='$n' where node_id='$n'") || $error++;
# This little sillyness is for disk reloading.
# Kill the last reservation since this path is special.
......
......@@ -100,8 +100,8 @@ foreach my $node (@nodes) {
"pid='$pid' and eid='$eid'");
if ( ($sth->num_rows()) < 1) {
print "Reserved - Scheduling next reservation...\n";
$sth = DBQueryFatal("replace into next_reserve (node_id,pid,eid) ".
"values ('$pc','$pid','$eid')");
$sth = DBQueryFatal("replace into next_reserve (node_id,pid,eid,vname) ".
"values ('$pc','$pid','$eid','$pc')");
} else {
print "Reserved - Already reserved to $pid/$eid\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