Bug 1417453

Summary: 'sort_key' does not work for 'name' param on v2 snapshot API GET Edit
Product: Red Hat OpenStack Reporter: lkuchlan <lkuchlan>
Component: openstack-cinderAssignee: Eric Harney <eharney>
Status: CLOSED UPSTREAM QA Contact: Tzach Shefi <tshefi>
Severity: medium Docs Contact:
Priority: low    
Version: 11.0 (Ocata)CC: egafford, lkuchlan, pdeore, sclewis, scohen, srevivo
Target Milestone: ---Flags: scohen: needinfo+
Target Release: 12.0 (Pike)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-11 18:56:10 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description lkuchlan 2017-01-29 14:46:13 UTC
Description of problem:

v2 snapshots POST/GET/PUT all works with 'name' in request as well as in response. But only sort things does not work on 'name' it expect only 'display_name'.

Seems like DB layer have only 'display_name' no 'name').

It is little bit odd where 'name' is being published everywhere on API and user does not know what 'display_name' is in v2 APIs but user is being force to sort with 'display_name' only and 'name' sort_key does not work. This seems odd APIs behavior.

All other APIs and filter etc translation logic to convert 'name' to 'display_name' is there- https://github.com/openstack/cinder/blob/master/cinder/api/v2/snapshots.py#L92

For sort also same should be done at least.

Ref- https://review.openstack.org/#/c/421251/

Version-Release number of selected component (if applicable):
openstack-cinder-10.0.0-0.20170117133616.af8771c.el7ost.noarch
python-cinder-10.0.0-0.20170117133616.af8771c.el7ost.noarch
puppet-cinder-10.1.0-0.20170114055430.8001a5b.el7ost.noarch
python-cinderclient-1.10.0-0.20170116161324.4eb63b8.el7ost.noarch


How reproducible:
100%

Steps to Reproduce:
1. Create several snapshots from volume.
2. cinder --debug snapshot-list --sort name:asc

Actual results:

REQ: curl -g -i -X GET http://10.0.0.109:8776/v2/d23901b5867647f489790c05054e6bd9/snapshots/detail?sort=display_name%3Aasc <-----

RESP BODY: {"snapshots": [{"status": "available", "description": null, "updated_at": "2017-01-29T14:14:26.000000", "volume_id": "af409fd7-3a3c-41de-9dbf-176e0a58034e", "id": "f7ce9c71-ef83-4df6-a024-967516f7c872", "size": 1, "os-extended-snapshot-attributes:progress": "100%", "name": "snap-a", <----

Comment 1 Eric Harney 2017-01-31 21:00:22 UTC
Unable to reproduce -- added notes to upstream bug.

Comment 2 Red Hat Bugzilla Rules Engine 2017-02-01 14:28:22 UTC
This bugzilla has been removed from the release and needs to be reviewed for targeting another release.

Comment 4 Sean Cohen 2017-04-11 18:56:10 UTC
Fix have been proposed upstream [1]
Closing accordingly.

[1] https://review.openstack.org/431488