summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-12-21 21:14:52 +0000
committerGerrit Code Review <review@openstack.org>2015-12-21 21:14:52 +0000
commita87cbd9128c1a2adba3af087e2b04fe17ffaa59d (patch)
treef69bd02dfa102fe6131e4d697d268a8454f46e8a
parentd9558dedafd96f2eb4551146a3183ebae2351a90 (diff)
parent861d7614f1c0920dcbb5d60421f03abb3d795c11 (diff)
downloadpython-novaclient-2.23.3.tar.gz
Merge "Revert 'Remove image to local block device mapping'" into stable/kilo2.23.3
-rw-r--r--novaclient/tests/unit/v2/test_shell.py7
-rw-r--r--novaclient/v2/servers.py8
2 files changed, 15 insertions, 0 deletions
diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py
index b7e8b9e9..b1b9b808 100644
--- a/novaclient/tests/unit/v2/test_shell.py
+++ b/novaclient/tests/unit/v2/test_shell.py
@@ -293,6 +293,13 @@ class ShellTest(utils.TestCase):
'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',
'destination_type': 'volume',
diff --git a/novaclient/v2/servers.py b/novaclient/v2/servers.py
index 397a12ac..582c4d84 100644
--- a/novaclient/v2/servers.py
+++ b/novaclient/v2/servers.py
@@ -492,6 +492,14 @@ class ServerManager(base.BootingManagerWithFind):
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: