aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParker Berberian <pberberian@iol.unh.edu>2019-08-07 10:50:22 -0400
committerParker Berberian <pberberian@iol.unh.edu>2019-08-07 10:50:22 -0400
commite7f5bdea4f45abf508f4179ce8e3b309c9216ed3 (patch)
tree5b1b68454da1c47988d7f443832ad44eca4b78c2
parent3418c7a7baae772f1bb58e9a827c1e6198dbed54 (diff)
Checks if host is working
Adds an additional check to ensure that the host is working before using it for a booking. Change-Id: I69731ca10ad59b6b774d04bdf6f3e628e6a07a79 Signed-off-by: Parker Berberian <pberberian@iol.unh.edu>
-rw-r--r--src/resource_inventory/resource_manager.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py
index 652e4e3..11a4623 100644
--- a/src/resource_inventory/resource_manager.py
+++ b/src/resource_inventory/resource_manager.py
@@ -59,6 +59,7 @@ class ResourceManager:
for profile in profile_count.keys():
available = Host.objects.filter(
booked=False,
+ working=True,
lab=grb.lab,
profile=profile
).count()
@@ -144,7 +145,7 @@ class ResourceManager:
host_full_set = Host.objects.filter(lab__name__exact=labName, profile=genericHost.profile)
if not host_full_set.first():
raise ResourceExistenceException("No matching servers found")
- host_set = host_full_set.filter(booked=False)
+ host_set = host_full_set.filter(booked=False, working=True)
if not host_set.first():
raise ResourceAvailabilityException("No unbooked hosts match requested hosts")
host = host_set.first()