Skip to content

Commit

Permalink
Handle mixed leases when searching for reservations with counts (#35)
Browse files Browse the repository at this point in the history
In `chi.lease.get_node_reservation`, if a `count` is provided, the lookup will fail because it searches all reservations for the values of `min_count` and `max_count`. Floating IP reservations have only an `amount`, so the comparison fails.

This change simply uses an invalid count for any reservations which have un-bounded counts.
  • Loading branch information
super-cooper authored Jan 19, 2023
1 parent c7233b6 commit 253dab4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chi/lease.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _find_node_reservation(res):
if res.get("resource_type") != "physical:host":
return False
if count is not None and not all(
int(res.get(key)) == count for key in ["min_count", "max_count"]
int(res.get(key, -1)) == count for key in ["min_count", "max_count"]
):
return False
rp = res.get("resource_properties")
Expand Down

0 comments on commit 253dab4

Please sign in to comment.