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
This commit is contained in:
Phil Day 2014-09-12 23:18:30 +00:00
parent 4dbf1323cc
commit 0763480048
2 changed files with 4 additions and 3 deletions

View File

@ -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',

View File

@ -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,