Can't filter/list resources that have no key=value metadata/extra-specs

Bug #1782847 reported by Goutham Pacha Ravi
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Shared File Systems Service (Manila)
Triaged
Wishlist
Unassigned
python-manilaclient
New
Wishlist
Unassigned

Bug Description

This bug was created out of the review on https://review.openstack.org/#/c/571366/

Looks like there's no way to get access rules with no metadata by using the metadata filter like this:

 $ manila --debug access-list test2 --metadata ''

Because this resolves to:
 GET /v2/cadd7139bc3148b8973df097c0911016/share-access-rules?share_id=ee8a6aa7-d685-4905-a9a2-c6c6899fe568&metadata=%7B%27%27%3A+None%7D

The URL params for metadata decoded are: {'':None}

The problem exists with other commands as well:
 $ manila list --metadata ''
 GET /v2/cadd7139bc3148b8973df097c0911016/shares/detail?metadata=%7B%27%27%3A+None%7D HTTP/1.1
 $ manila --debug type-list --extra-specs ''
 GET /v2/cadd7139bc3148b8973df097c0911016/types?extra_specs=%7B%27%27%3A+None%7D
 $ manila --debug list --extra-specs ''
  GET /v2/cadd7139bc3148b8973df097c0911016/shares/detail?extra_specs=%7B%27%27%3A+None%7D HTTP/1.1

The correct URL encoding shouldn't be {"": None}, it should be {} or %7B%7D; but even with that the server seems to misbehave with any of these keys.

-------------------------------------------------------------------------------

For example, I had a few shares, one of them has metadata, rest don't:

$ manila list --column id,metadata
+--------------------------------------+-----------------------------------------+
| Id | Metadata |
+--------------------------------------+-----------------------------------------+
| 3c2ddf21-c845-414e-ab8c-36c4ef56abe6 | {u'test': u'key', u'passing': u'value'} |
| d89d27de-b066-4ebb-919b-c6741bed0cce | {} |
| ee8a6aa7-d685-4905-a9a2-c6c6899fe568 | {} |
| ef3bca6d-ee62-4dbe-8563-a01887401fb8 | {} |
| f8075cf5-16f1-4c7c-b727-2ef1c2e3351c | {} |
+--------------------------------------+-----------------------------------------+

I wanted to retrieve only shares with no metadata

$ curl -i -X GET http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares?metadata=%7B%7D -H "X-Openstack-Manila-Api-Version: 2.45" -H "X-Auth-Token: gAAAAABbUlNPWkOdm5gqBZ3UX97jKLdujpbiGfAX6Sght9iLwEFOa-yslnzFOdBIJbba-MrNBdJ6D-ON6XoW6Nb7-UPGzishVzg0LvkhI7Yj5A345LkV3iGDhrvHSs5Cehmq9lxP4MvVtolltCcIVdRQmmzqAA_sA6SH9wgYjU0xhhe_brIU6cw" -H "Accept: application/json"
HTTP/1.1 200 OK
Date: Fri, 20 Jul 2018 21:28:35 GMT
Server: Apache/2.4.18 (Ubuntu)
x-compute-request-id: req-179d508c-f6ab-45d2-8c57-de2e0aa23160
X-OpenStack-Manila-API-Version: 2.45
Vary: X-OpenStack-Manila-API-Version
Content-Length: 1701
Connection: close
Content-Type: application/json

{"shares": [{"id": "3c2ddf21-c845-414e-ab8c-36c4ef56abe6", "links": [{"href": "http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares/3c2ddf21-c845-414e-ab8c-36c4ef56abe6", "rel": "self"}, {"href": "http://10.10.10.5:8786/cadd7139bc3148b8973df097c0911016/shares/3c2ddf21-c845-414e-ab8c-36c4ef56abe6", "rel": "bookmark"}], "name": null}, {"id": "d89d27de-b066-4ebb-919b-c6741bed0cce", "links": [{"href": "http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares/d89d27de-b066-4ebb-919b-c6741bed0cce", "rel": "self"}, {"href": "http://10.10.10.5:8786/cadd7139bc3148b8973df097c0911016/shares/d89d27de-b066-4ebb-919b-c6741bed0cce", "rel": "bookmark"}], "name": "zzaa"}, {"id": "f8075cf5-16f1-4c7c-b727-2ef1c2e3351c", "links": [{"href": "http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares/f8075cf5-16f1-4c7c-b727-2ef1c2e3351c", "rel": "self"}, {"href": "http://10.10.10.5:8786/cadd7139bc3148b8973df097c0911016/shares/f8075cf5-16f1-4c7c-b727-2ef1c2e3351c", "rel": "bookmark"}], "name": "zzzb"}, {"id": "ef3bca6d-ee62-4dbe-8563-a01887401fb8", "links": [{"href": "http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares/ef3bca6d-ee62-4dbe-8563-a01887401fb8", "rel": "self"}, {"href": "http://10.10.10.5:8786/cadd7139bc3148b8973df097c0911016/shares/ef3bca6d-ee62-4dbe-8563-a01887401fb8", "rel": "bookmark"}], "name": "zzza"}, {"id": "ee8a6aa7-d685-4905-a9a2-c6c6899fe568", "links": [{"href": "http://10.10.10.5:8786/v2/cadd7139bc3148b8973df097c0911016/shares/ee8a6aa7-d685-4905-a9a2-c6c6899fe568", "rel": "self"}, {"href": "http://10.10.10.5:8786/cadd7139bc3148b8973df097c0911016/shares/ee8a6aa7-d685-4905-a9a2-c6c6899fe568", "rel": "bookmark"}], "name": "test2"}]}

So the result wasn't filtered by "{}"

Revision history for this message
Jason Grosso (jgrosso) wrote :

Goutham is this your defect are you currently working on this? is it a wishlist item?

Revision history for this message
Goutham Pacha Ravi (gouthamr) wrote :

Thanks for asking Jason. I've added this bug to the Denver/Project Technical Gathering Agenda: https://etherpad.openstack.org/p/manila-denver-train-ptg-planning

This is an improvement to the filtering logic we have in all the APIs, we can take a look at it holistically in my opinion. I'll revert here with the proceedings of that discussion.

Tom Barron (tpb)
Changed in manila:
importance: Undecided → Wishlist
Changed in python-manilaclient:
importance: Undecided → Wishlist
Revision history for this message
Carlos Eduardo (silvacarlose) wrote :

I'd say this is still relevant, and we should keep this in the wishlist. Let's check if we can find an owner to this. Doesn't seem like much work to do and it is a fun thing to work on.

Vida Haririan (vhariria)
tags: added: low-hanging-fruit
Changed in manila:
assignee: nobody → Ashley Rodriguez (ashrodri)
Revision history for this message
Vida Haririan (vhariria) wrote :

Hi ashrodi, is this issue still relevant?

Changed in manila:
status: New → Triaged
Revision history for this message
Vida Haririan (vhariria) wrote :
Vida Haririan (vhariria)
Changed in manila:
assignee: Ashley Rodriguez (ashrodri) → nobody
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.