upload-to-image fails with size error on glance v2 api

Bug #1308594 reported by Andrew Kerr
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Cinder
In Progress
High
Mike Perez

Bug Description

https://review.openstack.org/84937 introduced a regression where upload-to-image will fail because the image has no size attribute before being created. The following stack trace is reported:

DEBUG glanceclient.common.http [req-24754feb-6fd3-414e-b3a0-f39a4b438eeb 5ae83579010a4e8da4de3087de5741fa 77f301575f4c4642be1c712fbb2dc852] curl -i -X POST -H 'X-Auth-Token: <TOKEN REMOVED> -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' -d '{"container_format": "bare", "d
isk_format": "raw", "name": "myImage"}' http://192.168.10.14:9292/v2/images from (pid=13012) log_curl_request /opt/stack/python-glanceclient/glanceclient/common/http.py:142
DEBUG glanceclient.common.http [req-24754feb-6fd3-414e-b3a0-f39a4b438eeb 5ae83579010a4e8da4de3087de5741fa 77f301575f4c4642be1c712fbb2dc852]
HTTP/1.1 201 Created
date: Wed, 16 Apr 2014 14:20:47 GMT
content-length: 513
content-type: application/json; charset=UTF-8
location: http://192.168.10.14:9292/v2/images/c45fa18b-48a5-4bfc-bffd-5b73952fe9fc
x-openstack-request-id: req-beb0ff5c-6f92-4450-ae83-1b53317ea7e4

{"status": "queued", "name": "myImage", "tags": [], "container_format": "bare", "created_at": "2014-04-16T14:20:47Z", "disk_format": "raw", "updated_at": "2014-04-16T14:20:47Z", "visibility": "private", "locations": [], "self": "/v2/ima
ges/c45fa18b-48a5-4bfc-bffd-5b73952fe9fc", "min_disk": 0, "protected": false, "id": "c45fa18b-48a5-4bfc-bffd-5b73952fe9fc", "file": "/v2/images/c45fa18b-48a5-4bfc-bffd-5b73952fe9fc/file", "owner": "77f301575f4c4642be1c712fbb2dc852", "mi
n_ram": 0, "schema": "/v2/schemas/image"}
 from (pid=13012) log_http_response /opt/stack/python-glanceclient/glanceclient/common/http.py:152
ERROR cinder.api.middleware.fault [req-24754feb-6fd3-414e-b3a0-f39a4b438eeb 5ae83579010a4e8da4de3087de5741fa 77f301575f4c4642be1c712fbb2dc852] Caught error: size
TRACE cinder.api.middleware.fault Traceback (most recent call last):
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/middleware/fault.py", line 75, in __call__
TRACE cinder.api.middleware.fault return req.get_response(self.application)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1320, in send
TRACE cinder.api.middleware.fault application, catch_exc_info=False)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1284, in call_application
TRACE cinder.api.middleware.fault app_iter = application(self.environ, start_response)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
TRACE cinder.api.middleware.fault return resp(environ, start_response)
TRACE cinder.api.middleware.fault File "/opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py", line 615, in __call__
TRACE cinder.api.middleware.fault return self.app(env, start_response)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
TRACE cinder.api.middleware.fault return resp(environ, start_response)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
TRACE cinder.api.middleware.fault return resp(environ, start_response)
TRACE cinder.api.middleware.fault File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
TRACE cinder.api.middleware.fault response = self.app(environ, start_response)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
TRACE cinder.api.middleware.fault return resp(environ, start_response)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
TRACE cinder.api.middleware.fault resp = self.call_func(req, *args, **self.kwargs)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
TRACE cinder.api.middleware.fault return self.func(req, *args, **kwargs)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 895, in __call__
TRACE cinder.api.middleware.fault content_type, body, accept)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 943, in _process_stack
TRACE cinder.api.middleware.fault action_result = self.dispatch(meth, request, action_args)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/openstack/wsgi.py", line 1019, in dispatch
TRACE cinder.api.middleware.fault return method(req=request, **action_args)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/api/contrib/volume_actions.py", line 258, in _volume_upload_image
TRACE cinder.api.middleware.fault force)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/volume/api.py", line 75, in wrapped
TRACE cinder.api.middleware.fault return func(self, context, target_obj, *args, **kwargs)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/volume/api.py", line 714, in copy_volume_to_image
TRACE cinder.api.middleware.fault recv_metadata = self.image_service.create(context, metadata)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/image/glance.py", line 288, in create
TRACE cinder.api.middleware.fault return self._translate_from_glance(recv_service_image_meta)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/image/glance.py", line 336, in _translate_from_glance
TRACE cinder.api.middleware.fault image_meta = _extract_attributes(image)
TRACE cinder.api.middleware.fault File "/opt/stack/cinder/cinder/image/glance.py", line 434, in _extract_attributes
TRACE cinder.api.middleware.fault output[attr] = getattr(image, attr)
TRACE cinder.api.middleware.fault File "/usr/local/lib/python2.7/dist-packages/warlock/model.py", line 72, in __getattr__
TRACE cinder.api.middleware.fault raise AttributeError(key)
TRACE cinder.api.middleware.fault AttributeError: size
TRACE cinder.api.middleware.fault
INFO cinder.api.middleware.fault [req-24754feb-6fd3-414e-b3a0-f39a4b438eeb 5ae83579010a4e8da4de3087de5741fa 77f301575f4c4642be1c712fbb2dc852] http://192.168.10.14:8776/v2/77f301575f4c4642be1c712fbb2dc852/volumes/e4b47282-bf37-4c8e-bcbf-9af12c89d0e2/action returned with HTTP 500
INFO eventlet.wsgi.server [req-24754feb-6fd3-414e-b3a0-f39a4b438eeb 5ae83579010a4e8da4de3087de5741fa 77f301575f4c4642be1c712fbb2dc852] 192.168.10.14 - - [16/Apr/2014 10:20:47] "POST /v2/77f301575f4c4642be1c712fbb2dc852/volumes/e4b47282-bf37-4c8e-bcbf-9af12c89d0e2/action HTTP/1.1" 500 401 0.233803

This can be resolved by adding back in the default value of "None" to line 434 in cinder/image/glance.py

Revision history for this message
Andrew Kerr (andrew-kerr) wrote : Re: upload-to-image fails with size error

Note that I am having cinder use glance api v2, which may be why tempest tests did not pick this up initially.

summary: - upload-to-image fails
+ upload-to-image fails with size error
Revision history for this message
Andrew Kerr (andrew-kerr) wrote :

Verified that glance api v1 works, while glance api v2 does not.

summary: - upload-to-image fails with size error
+ upload-to-image fails with size error on glance v2 api
Changed in cinder:
status: New → Confirmed
importance: Undecided → High
tags: added: icehouse-backport-potential
Revision history for this message
git-harry (git-harry) wrote :

There is a related bug for this already filed - https://bugs.launchpad.net/cinder/+bug/1308058

tags: added: netapp
Mike Perez (thingee)
Changed in cinder:
assignee: nobody → Mike Perez (thingee)
status: Confirmed → In Progress
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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