Commit 6b3804a7 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Update disk_templates if empty

Make backend_allocator to refresh the available disk templates of a
backend if there are empty.
parent 8e492114
......@@ -71,9 +71,6 @@ class BackendAllocator():
# Get available backends
available_backends = get_available_backends(flavor)
# Refresh backends, if needed
if not available_backends:
return None
......@@ -109,8 +106,15 @@ def get_available_backends(flavor):
backends = Backend.objects.select_for_update().filter(offline=False,
# Update the disk_templates if there are empty.
for b in backends if not b.disk_templates]
backends = filter(lambda b: disk_template in b.disk_templates,
# Update the backend stats if it is needed
return backends
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