Skip to content

Commit

Permalink
Revert 'Remove image to local block device mapping'
Browse files Browse the repository at this point in the history
https://review.openstack.org/#/c/153203/3 added check
for novaclient, removed the logic for both
--image and --block-device are added.

But actually the following valid boot command failed
due to the change here, so this patch reverted original
one and add some descriptions to avoid further removal.

nova boot test-vm --flavor m1.medium --image centos-vm-32
--nic net-id=c3f40e33-d535-4217-916b-1450b8cd3987
--block-device id=26b7b917-2794-452a-95e5-2efb2ca6e32d,bus=sata,
source=volume,bootindex=1

Change-Id: Ia29e63c72b34d3038aa591c466425e65edf5755b
Partial-Bug: #1433609
  • Loading branch information
jichenjc committed Mar 19, 2015
1 parent e0f5072 commit 8679eed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions novaclient/tests/unit/v2/test_shell.py
Expand Up @@ -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',
Expand Down
8 changes: 8 additions & 0 deletions novaclient/v2/servers.py
Expand Up @@ -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:
Expand Down

0 comments on commit 8679eed

Please sign in to comment.