diff --git a/IM/connectors/OpenStack.py b/IM/connectors/OpenStack.py index 9eff4d70e..ef4b440bf 100644 --- a/IM/connectors/OpenStack.py +++ b/IM/connectors/OpenStack.py @@ -815,7 +815,14 @@ def get_volumes(driver, image, radl): disk_size = None if disk_url: volume = driver.ex_get_volume(os.path.basename(disk_url)) - disk_url = volume.id + disk = { + 'boot_index': cont, + 'device_name': disk_device, + 'source_type': "volume", + 'delete_on_termination': False, + 'destination_type': "volume", + 'uuid': volume.id + } else: disk_size = system.getFeature("disk." + str(cont) + ".size").getValue('G') @@ -828,7 +835,7 @@ def get_volumes(driver, image, radl): 'delete_on_termination': True, 'volume_size': disk_size } - res.append(disk) + res.append(disk) cont += 1 return res diff --git a/test/unit/connectors/OpenStack.py b/test/unit/connectors/OpenStack.py index bc2fe9111..0d62ad3dc 100755 --- a/test/unit/connectors/OpenStack.py +++ b/test/unit/connectors/OpenStack.py @@ -119,7 +119,9 @@ def test_20_launch(self, save_data, get_driver): disk.0.image.url = 'ost://server.com/ami-id' and disk.0.os.credentials.username = 'user' and disk.1.size=1GB and - disk.1.device='hdb' + disk.1.device='hdb' and + disk.2.image.url = 'ost://server.com/vol-id' and + disk.2.device='hdc' )""" radl = radl_parse.parse_radl(radl_data) radl.check() @@ -174,6 +176,9 @@ def test_20_launch(self, save_data, get_driver): image = MagicMock() image.id = 'imageid' driver.get_image.return_value = image + vol = MagicMock() + vol.id = 'volid' + driver.ex_get_volume.return_value = vol inf = InfrastructureInfo() inf.auth = auth @@ -193,7 +198,13 @@ def test_20_launch(self, save_data, get_driver): 'device_name': 'vdb', 'source_type': 'blank', 'destination_type': 'volume', - 'delete_on_termination': True} + 'delete_on_termination': True}, + {'boot_index': 2, + 'delete_on_termination': False, + 'destination_type': 'volume', + 'device_name': 'vdc', + 'source_type': 'volume', + 'uuid': 'volid'} ] self.assertEqual(driver.create_node.call_args_list[0][1]['ex_blockdevicemappings'], mappings)