Glance API fail to list 'deleted' images

Bug #1432701 reported by zhu zhu
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Glance
Won't Fix
Medium
Feilong Wang

Bug Description

Even with user admin context, and following the API-ref for image/detail api and attempt to query deleted images will get failure for both ways.

1)
[root@node191 glance]# curl -i -X GET -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'X-Auth-Token: 2e65fd85f8eb41e2a33ed5b401754798' http://10.104.0.191:9292/v1/images/detail?status=deleted
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 14
X-Openstack-Request-Id: req-req-2599f890-6986-435b-b23e-abafcd2b85ae
Date: Mon, 16 Mar 2015 15:21:46 GMT

{"images": []}

2) And
[root@node191 glance]# curl -i -X GET -H 'User-Agent: python-glanceclient' -H 'Content-Type: application/octet-stream' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'X-Auth-Token: 2e65fd85f8eb41e2a33ed5b401754798' http://10.104.0.191:9292/v1/images/detail?deleted=True
Will also list all the Active images without any deleted images.

It does appears that glance will never allow the filters with 'deleted' key passing from the check below.
https://github.com/openstack/glance/blob/master/glance/api/v1/images.py#L387

And in registry code will never get filter with 'deleted', so 'deleted' will always being false.
https://github.com/openstack/glance/blob/master/glance/registry/api/v1/images.py#L249

Revision history for this message
Ian Cordasco (icordasc) wrote :

I think you're 90% of the way there. I think https://github.com/openstack/glance/blob/master/glance/registry/api/v1/images.py#L329 shouldn't be checking deleted but instead, status. I think the proper way to filter is with `status=deleted`, we're just checking for the wrong parameter in that method.

Changed in glance:
importance: Undecided → Medium
Feilong Wang (flwang)
Changed in glance:
assignee: nobody → Fei Long Wang (flwang)
status: New → Confirmed
Erno Kuvaja (jokke)
tags: added: kilo-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
Feilong Wang (flwang) wrote :

zhuzhu, you can access those deleted images by add param 'changs-since' for API v1. Unfortunately, the param 'changes-since' is not supported by Glance client. And Glance v2 also doesn't support listing deleted images. There are some discussion about this in Glance team. I will update the status at here, or you can see some of them in the review of above code review. Thanks.

Thierry Carrez (ttx)
tags: removed: kilo-rc-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance (master)

Change abandoned by Glance Bot (<email address hidden>) on branch: master
Review: https://review.openstack.org/172781

Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

Marking as Won't Fix as registry and v1 is now removed from glance code base.

Changed in glance:
status: In Progress → Won't Fix
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.