diff options
author | Parker Berberian <pberberian@iol.unh.edu> | 2019-01-04 14:58:07 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-01-04 14:58:07 +0000 |
commit | d9fe97928dbe3e3cd8988093e9547d8a01813e6e (patch) | |
tree | 28005b6bbc93017a3632fecef01c554f4cbf6ec2 /src | |
parent | 18ea74d35cab34b5e1c1e1c8bf4f8e1c9af79a51 (diff) | |
parent | be3fb1ace710399c0fbe1909f445d09028f2d307 (diff) |
Merge "Fixed Query for free hosts"
Diffstat (limited to 'src')
-rw-r--r-- | src/dashboard/tasks.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/dashboard/tasks.py b/src/dashboard/tasks.py index 67a06fd..837e7a1 100644 --- a/src/dashboard/tasks.py +++ b/src/dashboard/tasks.py @@ -92,10 +92,14 @@ def free_hosts(): """ gets all hosts from the database that need to be freed and frees them """ - undone_jobs = Job.objects.filter(hostnetworkrelation__status__ne=200, hosthardwarerelation__status__ne=200) + undone_statuses = [JobStatus.NEW, JobStatus.CURRENT, JobStatus.ERROR] + undone_jobs = Job.objects.filter( + hostnetworkrelation__status__in=undone_statuses, + hosthardwarerelation__status__in=undone_statuses + ) bookings = Booking.objects.exclude( - job_in=undone_jobs + job__in=undone_jobs ).filter( end__lt=timezone.now(), job__complete=True, |