sort_key and sort_dir combination are not being honored in correct way

Bug #1657366 reported by Ghanshyam Mann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Confirmed
Undecided
Unassigned

Bug Description

while sorting servers, user can pass sort_key and sort_dir combination and API says:

"You can specify multiple pairs of sort key and sort direction query parameters. If you omit the sort direction in a pair, the API uses the natural sorting direction of the direction of the server sort_key attribute. " - http://developer.openstack.org/api-ref/compute/?expanded=list-servers-detail

But if any sort_dir are not being passed in between of multiple sort_key, sort_dir combination then, it end up with having wrong mapping sort_key and sort_dir.

API layer just prepare the list of sort_key and sort_dir and then DB layer append remaining sort_dir as default value in list.

- https://github.com/openstack/nova/blob/master/nova/api/openstack/common.py#L145
- https://github.com/openstack/nova/blob/master/nova/db/sqlalchemy/api.py#L2111

While preparing the list of sort_key and sort_dir from req query, missing sort_dir should be added as default value so that all the way down combination can be remembered with index.

If user pass both combination of sort_key and sort_dir then there is no issue.

Changed in nova:
assignee: nobody → Ghanshyam Mann (ghanshyammann)
Revision history for this message
Sujitha (sujitha-neti) wrote :

Agree. We end up having wrong mapping for sort_dir when some directions are missed in between. This is handled well in python-novaclient but not in api.

Changed in nova:
status: New → Confirmed
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
Sean Dague (sdague) wrote :

There are no currently open reviews on this bug, changing the status back to the previous state and unassigning. If there are active reviews related to this bug, please include links in comments.

Changed in nova:
status: In Progress → Confirmed
assignee: Ghanshyam Mann (ghanshyammann) → 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.