Commit d496c294 authored by Gary Wong's avatar Gary Wong
Browse files

Consider prereserved but unused nodes when computing type limits.

parent 7af02104
......@@ -1246,7 +1246,18 @@ sub MaxSwapIn($$$) {
$reservation->SetNodes( $reservation->nodes() - $overflow );
}
return $reservation->nodes() > 0 ? $reservation->nodes() : 0;
my $avail = $reservation->nodes() > 0 ? $reservation->nodes() : 0;
# Now consider nodes prereserved to the project but currently unused.
my $query_result = DBQueryFatal( "SELECT COUNT(*) FROM nodes AS n " .
"LEFT OUTER JOIN reserved AS r " .
"ON n.node_id=r.node_id " .
"WHERE r.pid IS NULL AND n.type='" .
$type . "' AND n.reserved_pid='" .
$experiment->pid() . "'" );
my ($extra) = $query_result->fetchrow_array();
return $avail + $extra;
}
#
......
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