Was digging into the details for sometime now. Looks like, In the non-test environment, as @wangxiyuan mentioned above, the deletion of all locations are handled by, https://github.com/openstack/glance/blob/master/glance/api/v2/images.py#L276 and eventually by, https://github.com/openstack/glance/blob/master/glance/common/store_utils.py#L54 using ImageProxy & ImageLocationProxy. Hence for delete locations, probably we never reach here: https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L799 That answers why the problem is not reproducible.
In test environment (functional), for some reason, the delete all locations goes through https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L799 and somehow skips the call via, https://github.com/openstack/glance/blob/master/glance/common/store_utils.py#L54 Even though I am convinced it is a bug, unfortunately, I couldn't find a scenario where the delete all locations call would go through https://github.com/openstack/glance/blob/master/glance/db/sqlalchemy/api.py#L799 in real time. But, still curious to look into the details of what's happening behind the scenes while running tests. Will continue doing that. If I find anything substantial will get back to reopen this bug. For now, closing this bug. Thanks for reviewing the patchset and getting back with your valuable feedback. ** Changed in: glance Status: In Progress => Invalid -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to Glance. https://bugs.launchpad.net/bugs/1504260 Title: locations not ‘deleted’ on delete-all image.locations Status in Glance: Invalid Bug description: Problem: When we try to delete all locations for an ‘active’ image, the locations are not actually ‘deleted’ despite the image status being updated as ‘queued’. Note: This behavior could be noticed only when we delete-all locations. Scenario: - Have an active image with its associated locations. - Try updating the image to delete all locations with replace locations call and ensure the response status code is 200 and with image status as ‘queued’. eg., json: {‘op': 'replace', 'path': '/locations', 'value': []}; url: /v2/images/%(image_id); http method: patch - Make a call to get the image by ID. Note: The obtained image details will still continue to have the list of locations. Reason: - The update call to delete-all locations is ignored due to incorrect python ‘falsy’ conditional check (at glance.sqlalchemy.api layer) that allows/disallows update of image locations. Fix: - Make the conditional check explicit so that the delete-all locations call for the given image is allowed to update the image locations as 'deleted'. To manage notifications about this bug go to: https://bugs.launchpad.net/glance/+bug/1504260/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

