Commit 535c9b6b authored by Christos Stavrakakis's avatar Christos Stavrakakis

cyclades: Fix check for backend disk_templates

Fix the way that is checked that the disk template of the flavor is
included in the available disk templates of the backend. Using
'contains' is wrong because you may searching for 'file' disk template,
will there is enabled the 'sharedfile' disk template.
parent b4d92d39
......@@ -110,10 +110,10 @@ def get_available_backends(flavor):
if disk_template.startswith("ext_"):
disk_template = "ext"
backends = Backend.objects.select_for_update()
backends = backends.filter(offline=False, drained=False,
disk_templates__contains=disk_template)
backends = list(backends)
backends = Backend.objects.select_for_update().filter(offline=False,
drained=False)
backends = filter(lambda b: disk_template in b.disk_templates,
list(backends))
if "SNF:ANY_PUBLIC" in DEFAULT_INSTANCE_NETWORKS:
backends = filter(lambda x: has_free_ip(x), backends)
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