diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index b7e8b9e9d..b1b9b8085 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -292,6 +292,13 @@ def test_boot_image_bdms_v2(self): 'flavorRef': '1', 'name': 'some-server', 'block_device_mapping_v2': [ + { + 'uuid': 1, + 'source_type': 'image', + 'destination_type': 'local', + 'boot_index': 0, + 'delete_on_termination': True, + }, { 'uuid': 'fake-id', 'source_type': 'volume', diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py index 397a12ac1..582c4d840 100644 --- a/novaclient/v2/servers.py +++ b/novaclient/v2/servers.py @@ -492,6 +492,14 @@ def _boot(self, resource_url, response_key, name, image, flavor, body['server']['block_device_mapping'] = \ self._parse_block_device_mapping(block_device_mapping) elif block_device_mapping_v2: + # Following logic can't be removed because it will leaves + # a valid boot with both --image and --block-device + # failed , see bug 1433609 for more info + if image: + bdm_dict = {'uuid': image.id, 'source_type': 'image', + 'destination_type': 'local', 'boot_index': 0, + 'delete_on_termination': True} + block_device_mapping_v2.insert(0, bdm_dict) body['server']['block_device_mapping_v2'] = block_device_mapping_v2 if nics is not None: