- for virtual_storage in virtual_storages:
- vs_id = virtual_storage["virtual_storage_id"]
- for vs in data["volume_storages"]:
- if vs["volume_storage_id"] == vs_id:
- disk_type = ignore_case_get(vs["properties"], "type_of_storage")
- disk_size = int(ignore_case_get(vs["properties"], "size_of_storage").replace('GB', '').replace('"', '').strip())
- if disk_type == "root":
- param["disk"] = disk_size
- elif disk_type == "ephemeral":
- param["ephemeral"] = disk_size
- elif disk_type == "swap":
- param["swap"] = disk_size
+ if virtual_storages:
+ for virtual_storage in virtual_storages:
+ vs_id = virtual_storage["virtual_storage_id"]
+ for vs in data["volume_storages"]:
+ if vs["volume_storage_id"] == vs_id:
+ disk_type = ignore_case_get(vs["properties"], "type_of_storage")
+ size_of_storage = ignore_case_get(vs["properties"], "size_of_storage")
+ disk_size = int(size_of_storage.replace('GB', '').replace('"', '').strip())
+ if disk_type == "root":
+ param["disk"] = disk_size
+ elif disk_type == "ephemeral":
+ param["ephemeral"] = disk_size
+ elif disk_type == "swap":
+ param["swap"] = disk_size
+ else:
+ virtual_storages = ignore_case_get(virtual_compute, "virtual_storages")
+ size_of_storage = ignore_case_get(virtual_storages[0], "size_of_storage")
+ disk_size = int(size_of_storage.replace('GB', '').replace('"', '').strip())
+ param["disk"] = disk_size
+