In http://docs.openstack.org/developer/nova/block_device_mapping.html#block-device-mapping-v2 we are saying that for using source=image dest=local/None(seems None is
treated as local) we should also provide image ref, but the fact is that if do so,
we got:
nova --debug boot --image afbbcd5c-bed7-40a7-a9c0-0d4f57b05615 --block-device id=afbbcd5c-bed7-40a7-a9c0-0d4f57b05615,source=image,dest=local,bootindex=0 --nic net-id=1b7a7c1d-d266-4c77-bdcd-ed4ac76fd5cb --flavor 1 test_2
...
DEBUG (session:347) REQ: curl -g -i -X POST http://10.3.150.17:8774/v2.1/os-volumes_boot -H "Accept: application/json" -H "User-Agent: python-novaclient" -H "OpenStack-API-Version: compute 2.40" -H "X-OpenStack-Nova-API-Version: 2.40" -H "X-Auth-Token: {SHA1}853d1b6e6ed06716c424d38e5891b205ce7b949e" -H "Content-Type: application/json" -d '{"server": {"name": "test_2", "imageRef": "afbbcd5c-bed7-40a7-a9c0-0d4f57b05615", "block_device_mapping_v2": [{"source_type": "image", "delete_on_termination": true, "boot_index": 0, "uuid": "afbbcd5c-bed7-40a7-a9c0-0d4f57b05615", "destination_type": "local"}, {"source_type": "image", "delete_on_termination": true, "boot_index": "0", "uuid": "afbbcd5c-bed7-40a7-a9c0-0d4f57b05615", "destination_type": "local"}], "flavorRef": "1", "max_count": 1, "min_count": 1, "networks": [{"uuid": "1b7a7c1d-d266-4c77-bdcd-ed4ac76fd5cb"}]}}'
...
DEBUG (shell:934) Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid. (HTTP 400) (Request-ID: req-f848c6c1-0961-46c4-ac51-713fde042215)
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 932, in main
OpenStackComputeShell().main(argv)
File "/usr/local/lib/python2.7/dist-packages/novaclient/shell.py", line 859, in main
args.func(self.cs, args)
File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/shell.py", line 721, in do_boot
server = cs.servers.create(*boot_args, **boot_kwargs)
File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 1353, in create
**boot_kwargs)
File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/servers.py", line 753, in _boot
return_raw=return_raw, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/novaclient/base.py", line 359, in _create
resp, body = self.api.client.post(url, body=body)
File "/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py", line 223, in post
return self.request(url, 'POST', **kwargs)
File "/usr/local/lib/python2.7/dist-packages/novaclient/client.py", line 87, in request
raise exceptions.from_response(resp, body, url, method)
BadRequest: Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid. (HTTP 400) (Request-ID: req-f848c6c1-0961-46c4-ac51-713fde042215)
ERROR (BadRequest): Block Device Mapping is Invalid: Boot sequence for the instance and image/block device mapping combination is not valid. (HTTP 400) (Request-ID: req-f848c6c1-0961-46c4-ac51-713fde042215)
And if I don't provide image param, it goes:
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [req-bfdf5437-657a-44ed-8d81-d1bfec43dcf5 59984487adce478494232df1cf41dbf9 b7c4a4d1de6b43f2bf013deee06400cd - - -] [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] Instance failed to spawn
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] Traceback (most recent call last):
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/compute/manager.py", line 2125, in _build_resources
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] yield resources
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/compute/manager.py", line 1930, in _build_and_run_instance
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] block_device_info=block_device_info)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 2676, in spawn
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] block_device_info=block_device_info)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3081, in _create_image
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] fallback_from_host)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 3197, in _create_and_inject_local_root
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] instance, size, fallback_from_host)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/driver.py", line 6758, in _try_fetch_image_cache
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] size=size)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 227, in cache
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] *args, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 569, in create_image
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] prepare_template(target=base, *args, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/usr/local/lib/python2.7/dist-packages/oslo_concurrency/lockutils.py", line 271, in inner
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] return f(*args, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/imagebackend.py", line 223, in fetch_func_sync
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] fetch_func(target=target, *args, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/libvirt/utils.py", line 458, in fetch_image
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] images.fetch_to_raw(context, image_id, target)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/images.py", line 127, in fetch_to_raw
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] fetch(context, image_href, path_tmp)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/virt/images.py", line 118, in fetch
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] IMAGE_API.download(context, image_href, dest_path=path)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/image/api.py", line 184, in download
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] dst_path=dest_path)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/image/glance.py", line 533, in download
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] _reraise_translated_image_exception(image_id)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/image/glance.py", line 1050, in _reraise_translated_image_exception
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] six.reraise(type(new_exc), new_exc, exc_trace)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/image/glance.py", line 531, in download
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] image_chunks = self._client.call(context, 2, 'data', image_id)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/opt/stack/nova/nova/image/glance.py", line 168, in call
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] result = getattr(controller, method)(*args, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/usr/local/lib/python2.7/dist-packages/glanceclient/v2/images.py", line 195, in data
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] resp, body = self.http_client.get(url)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py", line 287, in get
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] return self._request('GET', url, **kwargs)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py", line 279, in _request
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] resp, body_iter = self._handle_response(resp)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] File "/usr/local/lib/python2.7/dist-packages/glanceclient/common/http.py", line 107, in _handle_response
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] raise exc.from_response(resp, resp.content)
2017-02-08 11:04:24.929 24141 ERROR nova.compute.manager [instance: 6e44cafd-b330-4a10-8c77-eac60d58f20c] ImageNotFound: Image could not be found.
Due to: disk_image's image_id is set here:
http://git.openstack.org/cgit/openstack/nova/tree/nova/virt/libvirt/driver.py#n3056
to instance.image_ref which is None, and it is been used in
http://git.openstack.org/cgit/openstack/nova/tree/nova/virt/libvirt/driver.py#n3078
lead to
http://git.openstack.org/cgit/openstack/nova/tree/nova/virt/libvirt/driver.py#n3164
and
http://git.openstack.org/cgit/openstack/nova/tree/nova/virt/libvirt/utils.py#n456
in which try to fetch image with uuid of '' from glance and causing the above failure.
> we are saying that for using source=image dest=local/ None(seems None is
> treated as local) we should also provide image ref, but the fact is that if do so,
> we got:
I don't think the docs are asking you to provide --image, tbh we could use some examples in the docs to illustrate this. Either way I can reproduce this with --image removed as above.