cinder list with metadata filter doesn't work

Bug #1311277 reported by Juan Manuel Ollé
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Juan Manuel Ollé

Bug Description

cinder list does not work with --metadata filtered

>cinder list

+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+
| b67cffdd-e573-4cdc-8362-dea6b1fe49a9 | available | test2 | 1 | None | false | |
| cd2880ae-cfd2-4c9e-8e73-2083d3eb3a90 | available | test | 1 | None | false | |
+--------------------------------------+-----------+--------------+------+-------------+----------+-------------+

one of them has the readonly metadata attribute setted

 cinder show test
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-04-21T18:34:40.000000 |
| display_description | None |
| display_name | test |
| encrypted | False |
| id | cd2880ae-cfd2-4c9e-8e73-2083d3eb3a90 |
| metadata | {u'readonly': u'True'} |
| os-vol-host-attr:host | jmolle-Controller |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 55088aa5b5054b878b11d765e960c459 |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| volume_type | None |
+--------------------------------+--------------------------------------+
cinder show test2
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| created_at | 2014-04-22T16:19:01.000000 |
| display_description | None |
| display_name | test2 |
| encrypted | False |
| id | b67cffdd-e573-4cdc-8362-dea6b1fe49a9 |
| metadata | {} |
| os-vol-host-attr:host | jmolle-Controller |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 55088aa5b5054b878b11d765e960c459 |
| size | 1 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| volume_type | None |
+--------------------------------+--------------------------------------+

But if I try to get the list with the metadata readonly as True it return that no volume has it setted

cinder list --metadata readonly=True
+----+--------+--------------+------+-------------+----------+-------------+
| ID | Status | Display Name | Size | Volume Type | Bootable | Attached to |
+----+--------+--------------+------+-------------+----------+-------------+
+----+--------+--------------+------+-------------+----------+-------------+

It is spected that volume test is listed (it has the readonly attribute setted)

Revision history for this message
Juan Manuel Ollé (juan-m-olle) wrote :

Cinder log:

2014-04-22 15:59:35.078 DEBUG routes.middleware [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Matched GET /55088aa5b5054b878b11d765e960c459/volumes/detail from (pid=19904) __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:100
2014-04-22 15:59:35.079 DEBUG routes.middleware [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Route path: '/{project_id}/volumes/detail', defaults: {'action': u'detail', 'controller': <cinder.api.openstack.wsgi.Resource object at 0x3e91f90>} from (pid=19904) __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:102
2014-04-22 15:59:35.079 DEBUG routes.middleware [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Match dict: {'action': u'detail', 'controller': <cinder.api.openstack.wsgi.Resource object at 0x3e91f90>, 'project_id': u'55088aa5b5054b878b11d765e960c459'} from (pid=19904) __call__ /usr/lib/python2.7/dist-packages/routes/middleware.py:103
2014-04-22 15:59:35.080 INFO cinder.api.openstack.wsgi [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] GET http://192.168.41.101:8776/v1/55088aa5b5054b878b11d765e960c459/volumes/detail?metadata=%7B%27readonly%27%3A+%27True%27%7D
2014-04-22 15:59:35.080 DEBUG cinder.api.openstack.wsgi [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Empty body provided in request from (pid=19904) get_body /opt/stack/cinder/cinder/api/openstack/wsgi.py:787
2014-04-22 15:59:35.081 DEBUG cinder.volume.api [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Searching by: MultiDict([('metadata', {'readonly': 'True'})]) from (pid=19904) get_all /opt/stack/cinder/cinder/volume/api.py:294
2014-04-22 15:59:35.082 DEBUG cinder.openstack.common.lockutils [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] Got semaphore "dbapi_backend" for method "__get_backend"... from (pid=19904) inner /opt/stack/cinder/cinder/openstack/common/lockutils.py:191
2014-04-22 15:59:35.168 INFO cinder.api.openstack.wsgi [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] http://192.168.41.101:8776/v1/55088aa5b5054b878b11d765e960c459/volumes/detail?metadata=%7B%27readonly%27%3A+%27True%27%7D returned with HTTP 200
2014-04-22 15:59:35.172 INFO eventlet.wsgi.server [req-c6ceb63e-f7f3-485b-a670-6159cd4de1d0 2a9a2562c2224686a9ab35c9cc6a77da 55088aa5b5054b878b11d765e960c459] 192.168.41.101 - - [22/Apr/2014 15:59:35] "GET /v1/55088aa5b5054b878b11d765e960c459/volumes/detail?metadata=%7B%27readonly%27%3A+%27True%27%7D HTTP/1.1" 200 253 0.235086

Changed in cinder:
assignee: nobody → Juan Manuel Ollé (juan-m-olle)
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
status: New → In Progress
Revision history for this message
Openstack Gerrit (openstack-gerrit) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/89933
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=8f112b270af0965a6f9aafbd83976c1ad22314f8
Submitter: Jenkins
Branch: master

commit 8f112b270af0965a6f9aafbd83976c1ad22314f8
Author: Juan Manuel Olle <email address hidden>
Date: Wed Apr 23 17:44:28 2014 -0300

    Cinder list does not filter admin metadata.

    For example, if you want to filter by 'readonly' attribute,
    you do not get results.
    This patch adds the admin metadata for filtering.

    Change-Id: Ia2a72776e649abd82160cb13ad63489cc760b190
    Closes-Bug: #1311277

Changed in cinder:
status: In Progress → Fix Committed
Mike Perez (thingee)
Changed in cinder:
milestone: none → juno-1
no longer affects: python-cinderclient
Mike Perez (thingee)
tags: added: icehouse-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/icehouse)

Fix proposed to branch: stable/icehouse
Review: https://review.openstack.org/94233

Thierry Carrez (ttx)
Changed in cinder:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/icehouse)

Change abandoned by Mike Perez (<email address hidden>) on branch: stable/icehouse
Review: https://review.openstack.org/94233

Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-1 → 2014.2
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.