Glance v2 index does not support 'admin_as_user' parameter
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Glance |
Wishlist
|
whhw |
Bug Description
When admin user list images, we add admin_as_user=False to query images that are owned by the user, shared to the user and other public images, instead of list all the images.
But if I add this to v2 command like:
curl -i -X GET -H 'X-Auth-
the result will always be empty, like:
{"images": [], "schema": "/v2/schemas/
It is because the index of v2 implementation does not accept 'admin_as_user', instead all the other parameters that are not present will be passed into 'filters'.
[glance/
def index(self, req, marker=None, limit=None, sort_key=
A simple method to fix is, add this code to image_get_all(), so we can get it from the filters before querying database.
[glance/
def image_get_
......
# added
if 'admin_as_user' in filters:
admin_as_user = filters.
admin_as_user = (admin_
Changed in glance: | |
assignee: | nobody → whhw (wanghuan2) |
description: | updated |
Ian Cordasco (icordasc) wrote : | #2 |
Looking at the specification for v2's Image Listing [1] this isn't explicitly defined as something we want.
[1] http://
whhw (wanghuan2) wrote : | #3 |
Well, the specification for v1's Image Listing doesn't mention it too, but v1actually supports the 'admin_as_user' parameter. Maybe it was omitted in v2, and I think it is useful sometimes.
Otherwise, we can only use the v1 instead to query admin's own images.
Erno Kuvaja (jokke) wrote : | #4 |
Marking as wishlist item as this is not exactly a bug.
Changed in glance: | |
importance: | Undecided → Wishlist |
summary: |
- Glance v2 index dose not support 'admin_as_user' parameter + Glance v2 index does not support 'admin_as_user' parameter |
whhw, please don't work on this until we can confirm that this is something that is desired for v2 of the API.