image-create fails on a boot from volume when no image ref is specified

Bug #1191069 reported by Michael Kerrin
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Vincent Hou

Bug Description

If create a boot from volume like so without passing in the image argument

nova boot --flavor 1 --key-name kerrin --block-device-mapping vda=5eb71b67-bfd2-4935-9b55-9ad92e14eae4::: bfv-vm2

And then I try and create an image from this instance like so, I get the following exception.

michael@controller:~/devstack$ nova --debug image-create b21282c1-02b3-4fc0-a9d1-73a19261b353 test1
....
DEBUG (shell:768) The resource could not be found. (HTTP 404) (Request-ID: req-254dae37-b8c2-4e75-ac8e-3e44981bf1cc)
Traceback (most recent call last):
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 765, in main
    OpenStackComputeShell().main(map(strutils.safe_decode, sys.argv[1:]))
  File "/opt/stack/python-novaclient/novaclient/shell.py", line 701, in main
    args.func(self.cs, args)
  File "/opt/stack/python-novaclient/novaclient/v1_1/shell.py", line 1225, in do_image_create
    image_uuid = cs.servers.create_image(server, args.name)
  File "/opt/stack/python-novaclient/novaclient/v1_1/servers.py", line 704, in create_image
    resp = self._action('createImage', server, body)[0]
  File "/opt/stack/python-novaclient/novaclient/v1_1/servers.py", line 872, in _action
    return self.api.client.post(url, body=body)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 233, in post
    return self._cs_request(url, 'POST', **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 217, in _cs_request
    **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 199, in _time_request
    resp, body = self.request(url, method, **kwargs)
  File "/opt/stack/python-novaclient/novaclient/client.py", line 193, in request
    raise exceptions.from_response(resp, body, url, method)
NotFound: The resource could not be found. (HTTP 404) (Request-ID: req-254dae37-b8c2-4e75-ac8e-3e44981bf1cc)

In the nova-api logs I get the following exception:

013-06-14 18:04:28.667 ERROR nova.api.openstack [req-9caaa082-9e1a-43a2-9c95-2a7179cf751e admin demo] Caught error: Image could not be found.
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack Traceback (most recent call last):
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/__init__.py", line 109, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return req.get_response(self.application)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack application, catch_exc_info=False)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return resp(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 461, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return self.app(env, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return resp(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return resp(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return resp(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return resp(environ, start_response)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 899, in __call__
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack content_type, body, accept)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 958, in _process_stack
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/wsgi.py", line 1039, in dispatch
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return method(req=request, **action_args)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/common.py", line 450, in inner
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return f(*args, **kwargs)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/api/openstack/compute/servers.py", line 1350, in _action_create_image
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack src_image = self.compute_api.image_service.show(context, img)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/image/glance.py", line 239, in show
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack _reraise_translated_image_exception(image_id)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/image/glance.py", line 237, in show
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack image = self._client.call(context, 1, 'get', image_id)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/nova/nova/image/glance.py", line 182, in call
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return getattr(client.images, method)(*args, **kwargs)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/python-glanceclient/glanceclient/v1/images.py", line 116, in get
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack % urllib.quote(image_id))
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 261, in raw_request
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack return self._http_request(url, method, **kwargs)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack File "/opt/stack/python-glanceclient/glanceclient/common/http.py", line 222, in _http_request
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack raise exc.from_response(resp, body_str)
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack ImageNotFound: Image could not be found.
2013-06-14 18:04:28.667 15808 TRACE nova.api.openstack
2013-06-14 18:04:28.669 INFO nova.api.openstack [req-9caaa082-9e1a-43a2-9c95-2a7179cf751e admin demo] http://192.168.122.55:8774/v2/0bc1ce21a6d741d7a5603c66c33249cc/servers/b21282c1-02b3-4fc0-a9d1-73a19261b353/action returned with HTTP 404

Tags: api
tags: added: api
Changed in nova:
status: New → Confirmed
importance: Undecided → Critical
Vincent Hou (houshengbo)
Changed in nova:
assignee: nobody → Vincent Hou (houshengbo)
Revision history for this message
Loganathan Parthipan (parthipan) wrote :

What's the expected behaviour here? I don't think just creating an image out of a boot volume is safe.

Image based root disks have a flavor-defined upper limit. Boot volumes don't. Creating an image out of a large volume requires dumping all this data to the compute host filesystem before transferring to glance.

Changed in nova:
importance: Critical → High
Revision history for this message
Vincent Hou (houshengbo) wrote :

This issue can be tentatively resolved by setting the image_ref field when booting a VM from a volume. The volume normally references an image, if it is created from an image. However, the potential situation can be after the volume creation, the original image is deleted. If this happens, the image can not be found for sure.

Another approach can be copying the content of the volume, from which the VM boots. Instead of checking the image, we need to check the volume, if the VM has a volume backend.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
Matt Riedemann (mriedem) wrote :
Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
status: Fix Committed → Fix Released
Sean Dague (sdague)
no longer affects: nova/grizzly
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.