<html><body>
<p><font size="2" face="sans-serif">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:</font><br>
<br>
<font size="2" face="sans-serif"> ?sort_key=key1&sort_dir=asc&sort_key=key2&sort_dir=desc</font><br>
<br>
<font size="2" face="sans-serif">This sorts the results using 'key1' as the primary key (in ascending order), 'key2' as the secondary key (in descending order), etc.</font><br>
<br>
<font size="2" face="sans-serif">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: </font><a href="https://blueprints.launchpad.net/cinder/+spec/cinder-pagination"><font size="2" face="sans-serif">https://blueprints.launchpad.net/cinder/+spec/cinder-pagination</font></a><font size="2" face="sans-serif">).</font><br>
<br>
<font size="2" face="sans-serif">The purpose of this thread is to discuss how the sort information should be inputted to the client.</font><br>
<br>
<font size="2" face="sans-serif">In nova, (committed in kilo </font><a href="https://review.openstack.org/#/c/117591/"><font size="2" face="sans-serif">https://review.openstack.org/#/c/117591/</font></a><font size="2" face="sans-serif">) the syntax is: --sort key1:asc,key2:desc</font><br>
<font size="2" face="sans-serif">In cinder, the syntax is: --sort_key key1 --sort_dir desc</font><br>
<font size="2" face="sans-serif">In glance, the proposed syntax (from </font><a href="https://review.openstack.org/#/c/120777/"><font size="2" face="sans-serif">https://review.openstack.org/#/c/120777/</font></a><font size="2" face="sans-serif">) is: --sort-key key1 --sort-key key2 --sort-dir desc </font><br>
<br>
<font size="2" face="sans-serif">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 </font><a href="https://review.openstack.org/#/c/141964/"><font size="2" face="sans-serif">https://review.openstack.org/#/c/141964/</font></a><font size="2" face="sans-serif">).</font><br>
<br>
<font size="2" face="sans-serif">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:</font><br>
<br>
<font size="2" face="sans-serif"> --sort-key key1 --sort-dir desc --sort-key key2 --sort-dir asc</font><br>
<font size="2" face="sans-serif"> --sort key1:asc,key2:desc</font><br>
<br>
<font size="2" face="sans-serif">Personally, I favor option 2 but IMO it is more important that these are made consistent.</font><br>
<br>
<font size="2" face="sans-serif">Thoughts on getting consistency across all 3 projects (and possibly others)?</font><br>
<br>
<font size="2" face="sans-serif">Thanks,</font><br>
<font size="2" face="sans-serif">Steven Kaufer</font></body></html>