HTTP 409 error being masked as HTTP 500 on image delete

Bug #1551037 reported by Chris Buccella
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Confirmed
High
Danny Al-Gaaf
Mitaka
Confirmed
High
Danny Al-Gaaf
Newton
Triaged
High
sudhakar kumar srivastava

Bug Description

Using ceph for image storage.

When calling image-delete on an in-use image:

<html>
 <head>
  <title>500 Internal Server Error</title>
 </head>
 <body>
  <h1>500 Internal Server Error</h1>
  The server has either erred or is incapable of performing the requested operation.<br /><br />

 </body>
</html> (HTTP 500)

Though the log shows:

glance.common.wsgi InUseByStore: The image cannot be deleted because it is in use through the backend store outside of Glance.

I would expect that this return HTTP 409.

In the code (images.py), I see an except clause for exception.InUseByStore, but the RBD driver is raising a different type of exception.

Revision history for this message
Ankit Agrawal (ankitagrawal) wrote :

Could you please mention API version you are using, Thanks!

Revision history for this message
Chris Buccella (chris-buccella) wrote :

API v1 and v2

Revision history for this message
Danny Al-Gaaf (danny-al-gaaf) wrote :

Actually the rbd driver in glance_store raises an exceptions.InUseByStore in case the image is busy.

Looks like an issue in python-glanceclient where the from glance raised HTTPConflict is not catched. Proposed fix: https://review.openstack.org/#/c/290882/

Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

Danny has a review up that looks good so far so he's getting picked on ;) Nice work Danny, this is really useful.

Changed in glance:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Danny Al-Gaaf (danny-al-gaaf)
Revision history for this message
Erno Kuvaja (jokke) wrote :

Comparing the bug description and the change this does not make sense to me. Apart from the fact that this bug is against glance and the change is to python-glanceclient, The change is in a place where output would never be as described in the bug description.

Is this correct bug for https://review.openstack.org/#/c/290882/ & https://review.openstack.org/#/c/291118 ?

If the server is throwing 409 it should have been catched here https://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/shell.py#L345-L348 and the output certainly should not be the 500 as in bug description.

Even more convinced about this as the tests passes on master even lines https://github.com/openstack/python-glanceclient/blob/master/glanceclient/v2/shell.py#L341-L344 are removed but the new test introduced in 290882 is kept in place.

Revision history for this message
Chris Buccella (chris-buccella) wrote :

@Erno: right, the bug as reported is that glance is returning the wrong HTTP code. The problem isn't glanceclient's handling, but that the server is returning a 500 error is coming back when a 409 is expected.

FWIW, I found this while using Kilo, but I believe the relevant code is the same in the current version.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/python-glanceclient 2.1.0

This issue was fixed in the openstack/python-glanceclient 2.1.0 release.

Revision history for this message
Rajiv Mucheli (rajiv.mucheli) wrote :
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.