From 0763480048243295e3ebfcfda7868f42457e8c67 Mon Sep 17 00:00:00 2001 From: Phil Day Date: Fri, 12 Sep 2014 23:18:30 +0000 Subject: [PATCH] novaclient: Convert v3 boot command with v2.1 spec (bdm) The v3 client was written assuming that some arguments would be renamed for better consistency. V2.1 will follow the v2 syntax, so we need to convert the client back to that. This change fixes the block-device-mapping element. Change-Id: Id91ad05aa86b32755e0b06be5f0e50cc1e83cb15 --- novaclient/tests/v3/test_shell.py | 4 ++-- novaclient/v3/servers.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/novaclient/tests/v3/test_shell.py b/novaclient/tests/v3/test_shell.py index 569ddabcb..e104a8b01 100644 --- a/novaclient/tests/v3/test_shell.py +++ b/novaclient/tests/v3/test_shell.py @@ -337,7 +337,7 @@ class ShellTest(utils.TestCase): {'server': { 'flavor_ref': '1', 'name': 'some-server', - 'os-block-device-mapping:block_device_mapping': [ + 'block_device_mapping': [ { 'volume_id': 'blah', 'delete_on_termination': '0', @@ -366,7 +366,7 @@ class ShellTest(utils.TestCase): {'server': { 'flavor_ref': '1', 'name': 'some-server', - 'os-block-device-mapping:block_device_mapping': [ + 'block_device_mapping': [ {'device_name': 'id', 'volume_id': id, 'source_type': 'volume', 'boot_index': 0, 'uuid': id}], 'image_ref': '1', diff --git a/novaclient/v3/servers.py b/novaclient/v3/servers.py index 226cf92a1..b98d3e42b 100644 --- a/novaclient/v3/servers.py +++ b/novaclient/v3/servers.py @@ -437,11 +437,12 @@ class ServerManager(base.BootingManagerWithFind): # Block device mappings are passed as a list of dictionaries if block_device_mapping: - bdm_param = 'os-block-device-mapping:block_device_mapping' + bdm_param = 'block_device_mapping' body['server'][bdm_param] = \ self._parse_block_device_mapping(block_device_mapping) elif block_device_mapping_v2: # Append the image to the list only if we have new style BDMs + bdm_param = 'block_device_mapping_v2' if image: bdm_dict = {'uuid': image.id, 'source_type': 'image', 'destination_type': 'local', 'boot_index': 0,