[openstack-dev] [cinder] [nova] [glance] Consistency in client side sorting
Steven Kaufer
kaufer at us.ibm.com
Mon Jan 5 15:13:31 UTC 2015
The nova, cinder, and glance REST APIs support listing instances, volumes,
and images in a specific order. In general, the REST API supports
something like:
?sort_key=key1&sort_dir=asc&sort_key=key2&sort_dir=desc
This sorts the results using 'key1' as the primary key (in ascending
order), 'key2' as the secondary key (in descending order), etc.
Note that this behavior is not consistent across the projects. Nova
supports multiple sort keys and multiple sort directions, glance supports
multiple sort keys but a single direction, and cinder only supports a
single sort key and a single sort direction (approved kilo BP to support
multiple sort keys and directions is here:
https://blueprints.launchpad.net/cinder/+spec/cinder-pagination).
The purpose of this thread is to discuss how the sort information should be
inputted to the client.
In nova, (committed in kilo https://review.openstack.org/#/c/117591/) the
syntax is: --sort key1:asc,key2:desc
In cinder, the syntax is: --sort_key key1 --sort_dir desc
In glance, the proposed syntax (from
https://review.openstack.org/#/c/120777/) is: --sort-key key1 --sort-key
key2 --sort-dir desc
Note that the keys are different for cinder and glance (--sort_key vs.
--sort-key). Also, client side sorting does not actually work in cinder
(fix under review at https://review.openstack.org/#/c/141964/).
Giving that each of these 3 clients will be supporting client-side sorting
in kilo, it seems that we should get this implemented in a consistent
manner. It seems that the 2 options are either:
--sort-key key1 --sort-dir desc --sort-key key2 --sort-dir asc
--sort key1:asc,key2:desc
Personally, I favor option 2 but IMO it is more important that these are
made consistent.
Thoughts on getting consistency across all 3 projects (and possibly
others)?
Thanks,
Steven Kaufer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20150105/0edd2cc4/attachment.html>
More information about the OpenStack-dev
mailing list