From 9a46b5c7796d4f7d90b1405ffe99724aab863e4a Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Tue, 18 Jun 2024 10:10:29 +0200 Subject: [PATCH] Minor change in get volumes --- IM/connectors/OpenStack.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index e84b67a0..731286a5 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -1184,8 +1184,7 @@ def get_networks(self, driver, radl): return nets - @staticmethod - def get_volumes(driver, image, volume, radl): + def get_volumes(self, driver, image, volume, radl): """ Create the required volumes (in the RADL) for the VM. @@ -1226,13 +1225,17 @@ def get_volumes(driver, image, volume, radl): disk_size = None if disk_url: - new_volume = driver.ex_get_volume(os.path.basename(disk_url)) + try: + new_volume_id = driver.ex_get_volume(os.path.basename(disk_url)).id + except Exception: + self.log_war("Error getting volume %s. Using ID." % disk_url) + new_volume_id = os.path.basename(disk_url) disk = { 'boot_index': cont, 'source_type': "volume", 'delete_on_termination': False, 'destination_type': "volume", - 'uuid': new_volume.id + 'uuid': new_volume_id } else: disk_size = system.getFeature("disk." + str(cont) + ".size").getValue('G')