← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1657366] [NEW] sort_key and sort_dir combination are not being honored in correct way

 

Public bug reported:

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.

** Affects: nova
     Importance: Undecided
     Assignee: Ghanshyam Mann (ghanshyammann)
         Status: New

** Changed in: nova
     Assignee: (unassigned) => Ghanshyam Mann (ghanshyammann)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1657366

Title:
  sort_key and sort_dir combination are not being honored in correct way

Status in OpenStack Compute (nova):
  New

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1657366/+subscriptions