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 | bf839cdb791674df5440041aedec5810448e8fb6 (patch) | |
tree | 7362969a8667771a99f8489e12863be112db581c | |
parent | cfca647b4c7f40b1283ffff158be971d953275d8 (diff) | |
parent | 4b16ee60dc157d68f537ecd347c9430f1deb8570 (diff) |
Merge "Fixed Query for free hosts"
-rw-r--r-- | dashboard/src/dashboard/tasks.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/dashboard/src/dashboard/tasks.py b/dashboard/src/dashboard/tasks.py index 67a06fd..837e7a1 100644 --- a/dashboard/src/dashboard/tasks.py +++ b/dashboard/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, |