Commit a37fd7a8 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Make disk_templates work with Ganeti<2.8

'enabled_disk_templates' cluster attribute has been added in Ganeti 2.8.
If this attribute is missing, return the ipolicy disk templates.
parent 943b1afe
......@@ -936,10 +936,14 @@ def get_available_disk_templates(backend):
"""
with pooled_rapi_client(backend) as c:
info = c.GetInfo()
enabled_disk_templates = info["enabled_disk_templates"]
ipolicy_disk_templates = info["ipolicy"]["disk-templates"]
return [dp for dp in enabled_disk_templates
if dp in ipolicy_disk_templates]
try:
enabled_disk_templates = info["enabled_disk_templates"]
return [dp for dp in enabled_disk_templates
if dp in ipolicy_disk_templates]
except KeyError:
# Ganeti < 2.8 does not have 'enabled_disk_templates'
return ipolicy_disk_templates
def update_backend_disk_templates(backend):
......
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