query string filter on listings doesn't work

Bug #1046353 reported by clayg
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
clayg

Bug Description

# three available volumes
$ cinder list
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| ID | Status | Display Name | Size | Volume Type | Attached to |
+--------------------------------------+-----------+--------------+------+-------------+-------------+
| 09203db5-7e18-40d9-91c6-08ef149bb568 | available | vol2 | 1 | None | |
| 9be22b23-6642-43a7-9da4-85cc4101b739 | available | vol3 | 1 | None | |
| c5f322d0-8437-4788-b943-b78d38303e81 | available | vol1 | 1 | None | |
+--------------------------------------+-----------+--------------+------+-------------+-------------+
# using the "name" key seems broken
$ curl -s -H 'x-auth-token: xxxxxx' http://localhost:8776/v1/c1cb62492a41464fb9d483417014af6c/volumes/detail?name=vol1 | python -m json.tool
{
    "volumes": []
}
# display_name would make more sense, but also doesn't work
$ curl -s -H 'x-auth-token: xxxxxx' http://localhost:8776/v1/c1cb62492a41464fb9d483417014af6c/volumes/detail?display_name=vol1 | python -m json.tool
{
    "volumes": [
        {
            "attachments": [],
            "availability_zone": "cinder",
            "created_at": "2012-09-05T14:27:37.000000",
            "display_description": null,
            "display_name": "vol2",
            "id": "09203db5-7e18-40d9-91c6-08ef149bb568",
            "metadata": {},
            "size": 1,
            "snapshot_id": null,
            "status": "available",
            "volume_type": "None"
        },
        {
            "attachments": [],
            "availability_zone": "cinder",
            "created_at": "2012-09-05T14:27:37.000000",
            "display_description": null,
            "display_name": "vol3",
            "id": "9be22b23-6642-43a7-9da4-85cc4101b739",
            "metadata": {},
            "size": 1,
            "snapshot_id": null,
            "status": "available",
            "volume_type": "None"
        },
        {
            "attachments": [],
            "availability_zone": "cinder",
            "created_at": "2012-09-05T14:27:36.000000",
            "display_description": null,
            "display_name": "vol1",
            "id": "c5f322d0-8437-4788-b943-b78d38303e81",
            "metadata": {},
            "size": 1,
            "snapshot_id": null,
            "status": "available",
            "volume_type": "None"
        }
    ]
}
# status is broken too
$ curl -s -H 'x-auth-token: xxxxxx' http://localhost:8776/v1/c1cb62492a41464fb9d483417014af6c/volumes/detail?status=available | python -m json.tool
{
    "volumes": []
}

Snapshot filter by status and display_name are also broken.

The most useful filter would be by volume-id, but also seems to be broken.

clayg@cfsyn28:~$ cinder snapshot-list
+--------------------------------------+--------------------------------------+-----------+--------------+------+
| ID | Volume ID | Status | Display Name | Size |
+--------------------------------------+--------------------------------------+-----------+--------------+------+
| 1adf7e7a-d202-4586-a861-0bbaa73e927c | 09203db5-7e18-40d9-91c6-08ef149bb568 | available | backup2.2 | 1 |
| 672cba7c-57db-4573-8a34-5e86ca70926d | c5f322d0-8437-4788-b943-b78d38303e81 | available | backup1.3 | 1 |
| 924f3347-399b-45ee-b4e0-041fe7854779 | 09203db5-7e18-40d9-91c6-08ef149bb568 | available | backup2.1 | 1 |
| 985c2871-f4b1-41af-aa8d-c6657d47dcf9 | c5f322d0-8437-4788-b943-b78d38303e81 | available | backup1.1 | 1 |
| e5203f9c-7cd9-46f1-9335-5de5023a53fb | c5f322d0-8437-4788-b943-b78d38303e81 | available | backup1.2 | 1 |
+--------------------------------------+--------------------------------------+-----------+--------------+------+
clayg@cfsyn28:~$ curl -s -H 'x-auth-token: xxxxxx' http://localhost:8776/v1/c1cb62492a41464fb9d483417014af6c/snapshots/detail?volume_id=09203db5-7e18-40d9-91c6-08ef149bb568 | python -m json.tool
{
    "snapshots": [
        {
            "created_at": "2012-09-05T14:31:17.000000",
            "display_description": null,
            "display_name": "backup2.2",
            "id": "1adf7e7a-d202-4586-a861-0bbaa73e927c",
            "os-extended-snapshot-attributes:progress": "100%",
            "os-extended-snapshot-attributes:project_id": "c1cb62492a41464fb9d483417014af6c",
            "size": 1,
            "status": "available",
            "volume_id": "09203db5-7e18-40d9-91c6-08ef149bb568"
        },
        {
            "created_at": "2012-09-05T14:30:41.000000",
            "display_description": null,
            "display_name": "backup1.3",
            "id": "672cba7c-57db-4573-8a34-5e86ca70926d",
            "os-extended-snapshot-attributes:progress": "100%",
            "os-extended-snapshot-attributes:project_id": "c1cb62492a41464fb9d483417014af6c",
            "size": 1,
            "status": "available",
            "volume_id": "c5f322d0-8437-4788-b943-b78d38303e81"
        },
        {
            "created_at": "2012-09-05T14:31:17.000000",
            "display_description": null,
            "display_name": "backup2.1",
            "id": "924f3347-399b-45ee-b4e0-041fe7854779",
            "os-extended-snapshot-attributes:progress": "100%",
            "os-extended-snapshot-attributes:project_id": "c1cb62492a41464fb9d483417014af6c",
            "size": 1,
            "status": "available",
            "volume_id": "09203db5-7e18-40d9-91c6-08ef149bb568"
        },
        {
            "created_at": "2012-09-05T14:30:40.000000",
            "display_description": null,
            "display_name": "backup1.1",
            "id": "985c2871-f4b1-41af-aa8d-c6657d47dcf9",
            "os-extended-snapshot-attributes:progress": "100%",
            "os-extended-snapshot-attributes:project_id": "c1cb62492a41464fb9d483417014af6c",
            "size": 1,
            "status": "available",
            "volume_id": "c5f322d0-8437-4788-b943-b78d38303e81"
        },
        {
            "created_at": "2012-09-05T14:30:41.000000",
            "display_description": null,
            "display_name": "backup1.2",
            "id": "e5203f9c-7cd9-46f1-9335-5de5023a53fb",
            "os-extended-snapshot-attributes:progress": "100%",
            "os-extended-snapshot-attributes:project_id": "c1cb62492a41464fb9d483417014af6c",
            "size": 1,
            "status": "available",
            "volume_id": "c5f322d0-8437-4788-b943-b78d38303e81"
        }
    ]
}

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

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

Changed in cinder:
assignee: nobody → clayg (clay-gerrard)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/12420
Committed: http://github.com/openstack/cinder/commit/aef9f4ab05946e2bfef0cdb53071e52425c7f518
Submitter: Jenkins
Branch: master

commit aef9f4ab05946e2bfef0cdb53071e52425c7f518
Author: Clay Gerrard <email address hidden>
Date: Fri Aug 31 20:16:29 2012 +0000

    Filter volumes and snapshots by query string

    Fix query string search_opts filters in api.openstack.volume.volumes and
    snapshots. Fix get_all methods in volumes.api to adequately handle
    parameter matching.

    The current api does not properly apply query string filters by
    display_name, status, or (in the case of snapshots) volume_id. These
    filters are needed both for the end user and operator to display logical
    grouping of these resources.

    Fixes: bug #1046353

    Change-Id: Ia12ffe1bf8a27c8a78daa24c4b728b394932a2b0

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → folsom-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-rc1 → 2012.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.