Remove image to local block device mapping

In the method named from_api in nova/block_device.py,

    if source_type == 'image' and destination_type == 'local':
        raise exception.InvalidBDMFormat(
            details=_("Mapping image to local is not supported."))

While, in the method named _boot in novaclient/v2/servers.py

    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)

Because of the above, if using --image and --block-device
params at the same time to create vm, nova would
raise InvalidBDMFormat exception

To resolve this problem, remove the codes in novaclient which
conflict with nova

Change-Id: I488322ba0160100a6d641fde68fa824d0581956a
Closes-Bug:#1418484
This commit is contained in:
zhangjl 2015-02-05 19:56:13 +08:00
parent 0a60aae852
commit 5b598ab4e1
2 changed files with 0 additions and 14 deletions

View File

@ -292,13 +292,6 @@ class ShellTest(utils.TestCase):
'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',

View File

@ -526,13 +526,6 @@ class ServerManager(base.BootingManagerWithFind):
body['server']['block_device_mapping'] = \
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
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: