Package versions: python-glance-2012.2.3-3.el6ost.noarch openstack-glance-2012.2.3-3.el6ost.noarch Prepare an image and a tenant: $ keystone tenant-create --name test --description foo --enable true +-------------+----------------------------------+ | Property | Value | +-------------+----------------------------------+ | description | foo | | enabled | True | | id | 8c2d8b205f334084b06105f3301b7e27 | | name | test | +-------------+----------------------------------+ $ glance --debug image-create --name image --container-format bare --disk-format raw --is-public False --file /etc/passwd curl -i -X POST -H 'x-image-meta-container_format: bare' -H 'User-Agent: python-glanceclient' -H 'x-image-meta-size: 1961' -H 'x-image-meta-is_public: False' -H 'X-Auth-Token: ab2643534a2d45deab2a74623b3907e2' -H 'Content-Type: application/octet-stream' -H 'x-image-meta-disk_format: raw' -H 'x-image-meta-name: image' -d '<open file '/etc/passwd', mode 'r' at 0x23c8540>' http://10.34.63.217:9292/v1/images HTTP/1.1 201 Created content-length: 420 etag: bbb75599cd7acee6c7e118a0a0cc4ce8 location: http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ae date: Fri, 01 Mar 2013 14:18:20 GMT content-type: application/json x-openstack-request-id: req-d1be8f08-083b-447d-a706-d361fd7ec3c1 {"image": {"status": "active", "name": "image", "deleted": false, "container_format": "bare", "created_at": "2013-03-01T14:18:20", "disk_format": "raw", "updated_at": "2013-03-01T14:18:20", "properties": {}, "min_disk": 0, "protected": false, "id": "930e76ab-c971-4463-8005-631ccc3aa4ae", "checksum": "bbb75599cd7acee6c7e118a0a0cc4ce8", "owner": null, "is_public": false, "deleted_at": null, "min_ram": 0, "size": 1961}} +------------------+--------------------------------------+ | Property | Value | +------------------+--------------------------------------+ | checksum | bbb75599cd7acee6c7e118a0a0cc4ce8 | | container_format | bare | | created_at | 2013-03-01T14:18:20 | | deleted | False | | deleted_at | None | | disk_format | raw | | id | 930e76ab-c971-4463-8005-631ccc3aa4ae | | is_public | False | | min_disk | 0 | | min_ram | 0 | | name | image | | owner | None | | protected | False | | size | 1961 | | status | active | | updated_at | 2013-03-01T14:18:20 | +------------------+--------------------------------------+ Delete the member two times: $ glance --debug member-create 930e76ab-c971-4463-8005-631ccc3aa4ae 8c2d8b205f334084b06105f3301b7e27 curl -i -X PUT -H 'X-Auth-Token: 676b05a0fd254c0a92c3554071fa25fb' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' -d '{"member": {"can_share": false}}' http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ae/members/8c2d8b205f334084b06105f3301b7e27 HTTP/1.1 204 No Content date: Fri, 01 Mar 2013 14:19:48 GMT content-length: 0 content-type: text/html; charset=UTF-8 x-openstack-request-id: req-e5845b76-3a74-4361-b09d-399c09f4ee64 Until now everything looks normal. --------------------------------------------------------------------- $ glance --debug member-delete 930e76ab-c971-4463-8005-631ccc3aa4ae 8c2d8b205f334084b06105f3301b7e27 curl -i -X DELETE -H 'X-Auth-Token: 217e98ae51c64cc09b32d29295872b1f' -H 'Content-Type: application/octet-stream' -H 'User-Agent: python-glanceclient' http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ae/members/8c2d8b205f334084b06105f3301b7e27 HTTP/1.1 204 No Content date: Fri, 01 Mar 2013 14:19:59 GMT content-length: 0 content-type: text/html; charset=UTF-8 x-openstack-request-id: req-d8d87e8d-3809-438f-a612-6544ba0d4e92 ++++++++++++++++++++++++++++++++++ +Expected response 404 not found.+ ++++++++++++++++++++++++++++++++++ According to the listing commands the listing commands, the member successfully deleted. $ glance --debug member-list --tenant-id 8c2d8b205f334084b06105f3301b7e27 curl -i -X GET -H 'X-Auth-Token: 2bc031236dd346cb9542b6e6764eaba1' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' http://10.34.63.217:9292/v1/shared-images/8c2d8b205f334084b06105f3301b7e27 HTTP/1.1 200 OK date: Fri, 01 Mar 2013 14:20:33 GMT content-length: 21 content-type: application/json; charset=UTF-8 x-openstack-request-id: req-ae3f11dc-465f-4ba5-9089-fb4ab904ca5d {"shared_images": []} $ glance --debug member-list --image-id 930e76ab-c971-4463-8005-631ccc3aa4ae curl -i -X GET -H 'X-Auth-Token: 06d3d635db824902bd6c7584050b9315' -H 'Content-Type: application/json' -H 'User-Agent: python-glanceclient' http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ae/members HTTP/1.1 200 OK date: Fri, 01 Mar 2013 14:21:00 GMT content-length: 15 content-type: application/json; charset=UTF-8 x-openstack-request-id: req-cc263d3a-d40e-45f2-af36-6f677d7f5b73 {"members": []} -------------------------------------------------------- Let's try something else: Add an additional '7' character to the tenant ID: Looks like the response is 500, and contains a server-side exception. ------------------------------------------------------- $glance --debug member-delete 930e76ab-c971-4463-8005-631ccc3aa4ae 8c2d8b205f334084b06105f3301b7e277 curl -i -X DELETE -H 'X-Auth-Token: e7c816cdd1544cefa95fbea1d6ee5044' -H 'Content-Type: application/octet-stream' -H 'User-Agent: python-glanceclient' http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ae/members/8c2d8b205f334084b06105f3301b7e277 HTTP/1.1 500 Internal Server Error date: Fri, 01 Mar 2013 14:20:14 GMT content-length: 4005 content-type: text/plain connection: close Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/eventlet/wsgi.py", line 382, in handle_one_response result = self.application(self.environ, start_response) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__ resp = self.call_func(req, *args, **self.kwargs) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func return self.func(req, *args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__ response = req.get_response(self.application) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response application, catch_exc_info=False) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application app_iter = application(self.environ, start_response) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__ resp = self.call_func(req, *args, **self.kwargs) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func return self.func(req, *args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 326, in __call__ response = req.get_response(self.application) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1053, in get_response application, catch_exc_info=False) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/request.py", line 1022, in call_application app_iter = application(self.environ, start_response) File "/usr/lib/python2.6/site-packages/paste/urlmap.py", line 203, in __call__ return app(environ, start_response) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__ return resp(environ, start_response) File "/usr/lib/python2.6/site-packages/Routes-1.12.3-py2.6.egg/routes/middleware.py", line 131, in __call__ response = self.app(environ, start_response) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 159, in __call__ return resp(environ, start_response) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 147, in __call__ resp = self.call_func(req, *args, **self.kwargs) File "/usr/lib/python2.6/site-packages/WebOb-1.0.8-py2.6.egg/webob/dec.py", line 208, in call_func return self.func(req, *args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 533, in __call__ request, **action_args) File "/usr/lib/python2.6/site-packages/glance/common/wsgi.py", line 550, in dispatch return method(*args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/utils.py", line 425, in wrapped return func(self, req, *args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/api/v1/members.py", line 70, in delete registry.delete_member(req.context, image_id, id) File "/usr/lib/python2.6/site-packages/glance/registry/__init__.py", line 177, in delete_member return c.delete_member(image_id, member_id) File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 224, in delete_member (image_id, member_id)) File "/usr/lib/python2.6/site-packages/glance/registry/client.py", line 89, in do_request action, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 63, in wrapped return func(self, *args, **kwargs) File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 444, in do_request headers=headers) File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 80, in wrapped return func(self, method, url, body, headers) File "/usr/lib/python2.6/site-packages/glance/common/client.py", line 581, in _do_request raise exception.ServerError() ServerError: The request returned 500 Internal Server Error. --------------------------------------------------- Delete a member from a not existing image: --------------------------------------------------- $glance --debug member-delete 930e76ab-c971-4463-8005-631ccc3aa4ab 8c2d8b205f334084b06105f3301b7e27 curl -i -X DELETE -H 'X-Auth-Token: 529d973daf2246c2868eaddece1a671c' -H 'Content-Type: application/octet-stream' -H 'User-Agent: python-glanceclient' http://10.34.63.217:9292/v1/images/930e76ab-c971-4463-8005-631ccc3aa4ab/members/8c2d8b205f334084b06105f3301b7e27 HTTP/1.1 404 Not Found date: Fri, 01 Mar 2013 14:31:31 GMT content-length: 104 content-type: text/plain; charset=UTF-8 x-openstack-request-id: req-34cecfe0-c82a-4b47-b244-dfb1ad598de5 404 Not Found The resource could not be found. 404 Not Found The resource could not be found. Request returned failure status. HTTPNotFound (HTTP 404) ------------------------------- It is working correctly regardless to the tenant_id. Note: I have a workaround for #890798.
The problem is that the image member is referred to without checking if it actually exists: https://github.com/openstack/glance/blob/stable/folsom/glance/registry/api/v1/members.py#L284 leading to an IndexError on the list dereference in the non-existing case. The fix is obvious and highly self-contained, hence very low-risk.
When forward-porting my initial fix to upstream master, I discovered that it has already been fixed there: https://review.openstack.org/14210 Hence the task just collapses down to a master->stable backport of an existing fix. Abandoning my own patch, and backporting the original fix.
Original fix backported and proposed to stable/folsom upstream: https://review.openstack.org/24116
Proposed internally as: https://code.engineering.redhat.com/gerrit/#/c/3951/
The 500 error response fixed. But, deleting an already deleted member still succeeds. I got 204, but the expected 404. Did you created a different issue for that ?
Attila, I missed the second intertwined issue. The 204 versus 404 should probably have been separate from the get-go So can you clone off a separate issue for it, and I'll take a look at later this evening? (I suspect probably a simple issue around the lingering deleted=1 row in the DB, so should probably be quickly fixable ...) Cheers, Eoghan
So the 500 response is solved , the cloned bug for the other issue https://bugzilla.redhat.com/show_bug.cgi?id=923395 is here.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2013-0707.html