All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit dfbbae0d authored by Gary Wong's avatar Gary Wong

Discourage selection of unreserved node types.

Closes #251.
parent 1f745798
......@@ -954,9 +954,8 @@ sub OutstandingReservation($$;$) {
return $earliest;
}
# Return a list of (pid, nodetype, reserved, used) hashes
# for any currently active reservations belonging to a
# listed project where usedcount < reservedcount.
# Return a list of (pid, nodetype, reserved, used) hashes for any currently
# active reservations belonging to a listed project.
sub CurrentReservations($$) {
my ($class, $projlist) = @_;
my @answer = ();
......
......@@ -657,6 +657,21 @@ while (my ($type, $feature, $weight) = $result->fetchrow()) {
push(@{$typemap{$type}->{'FEATURES'}}, "$feature:$weight");
}
# Augment the features table to discourage selection of node types other
# than those the project has reserved (if any).
if( defined( $pid ) ) {
my @reservations = Reservation->CurrentReservations( [ $pid ] );
if( @reservations ) {
my @types = Reservation->ReservableTypes();
foreach my $type (@types) {
push( @{ $typemap{ $type->type() }->{ 'FEATURES' } },
"unreserved_type:0.5" ) unless
( grep( { $_->{ 'nodetype' } eq $type->type() }
@reservations ) );
}
}
}
#
# Read the auxtypes for each type.
#
......
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