Failed to create vm with --image and --block-device

Bug #1418484 reported by zhangjialong
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
zhangjialong

Bug Description

Failed to create vm with --image and --block

when using --image and --block-device to create vm,
it failed with the follow logs:

DEBUG (shell:803) Block Device Mapping is Invalid: Mapping image to local is not supported. (HTTP 400) (Request-ID: req-951fbde1-f934-40c7-bbb7-a3b298f4f11f)
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 800, in main
    OpenStackComputeShell().main(argv)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 730, in main
    args.func(self.cs, args)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v1_1/shell.py", line 470, in do_boot
    server = cs.servers.create(*boot_args, **boot_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v1_1/servers.py", line 902, in create
    **boot_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/v1_1/servers.py", line 554, in _boot
    return_raw=return_raw, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/base.py", line 100, in _create
    _resp, body = self.api.client.post(url, body=body)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 490, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 465, in _cs_request
    resp, body = self._time_request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 439, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 433, in request
    raise exceptions.from_response(resp, body, url, method)
BadRequest: Block Device Mapping is Invalid: Mapping image to local is not supported. (HTTP 400) (Request-ID: req-951fbde1-f934-40c7-bbb7-a3b298f4f11f)
ERROR (BadRequest): Block Device Mapping is Invalid: Mapping image to local is not supported. (HTTP 400) (Request-ID: req-951fbde1-f934-40c7-bbb7-a3b298f4f11f)

The follows are my commands:
nova boot cirros --flavor m1.tiny \
 --image fc2c4d25-8a71-4229-b9d9-82f79cac3500 \
 --nic net-id=3c02041b-9fa3-4f65-82c2-39e211bfe27f \
 --block-device id=fc2c4d25-8a71-4229-b9d9-82f79cac3500,source=image,dest=volume,bus=virtio,type=disk,size=1,device=vda

And my openstack version is master

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."))

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)

Novaclient request nova service with error params, then the error occured

zhangjialong (zhangjl)
tags: added: block-device image python-novaclient
summary: - Failed to create vm with --image and --block
+ Failed to create vm with --image and --block-device
Changed in python-novaclient:
assignee: nobody → zhangjialong (zhangjl)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-novaclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/153203

Changed in python-novaclient:
status: New → In Progress
melanie witt (melwitt)
Changed in python-novaclient:
importance: Undecided → High
Revision history for this message
melanie witt (melwitt) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-novaclient (master)

Reviewed: https://review.openstack.org/153203
Committed: https://git.openstack.org/cgit/openstack/python-novaclient/commit/?id=5b598ab4e1f5779b9e632854b3cf4918f452b547
Submitter: Jenkins
Branch: master

commit 5b598ab4e1f5779b9e632854b3cf4918f452b547
Author: zhangjl <email address hidden>
Date: Thu Feb 5 19:56:13 2015 +0800

    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

Changed in python-novaclient:
status: In Progress → Fix Committed
Michael Still (mikal)
Changed in python-novaclient:
milestone: none → 2.21.0
Michael Still (mikal)
Changed in python-novaclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.