python client output is not sorted by --sort_key

Bug #1402846 reported by Steven Kaufer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-cinderclient
Fix Released
High
Steven Kaufer

Bug Description

Bug https://bugs.launchpad.net/python-cinderclient/+bug/1325773 added support for invoking the REST API with the sort_dir and sort_key parameters.

However, the python client still sorts the table by whatever the first value in the key_list is here: https://github.com/openstack/python-cinderclient/blob/master/cinderclient/v2/shell.py#L220

Therefore, the client output table is always sorted by ID even though the REST API is returning in sorted order based on the sort key/direction provided. For example, the command below supplies the 'size' sort key but the output table is still sorted by ID:

vagrant@vagrant-ubuntu-trusty-64:$ cinder list --sort_key size --sort_dir desc
+--------------------------------------+--------+------+------+-------------+----------+-------------+
| ID | Status | Name | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+--------+------+------+-------------+----------+-------------+
| 3b78c9b3-edae-4439-bc9d-aa974852d2ce | error | None | 2 | lvmdriver-1 | false | |
| 4bbcdc3d-64f1-4fea-aae9-8f4c374e56f0 | error | None | 1 | lvmdriver-1 | false | |
| 5388aa97-8bfc-4fbc-b43d-5f987aa68d26 | error | None | 1 | lvmdriver-1 | false | |
| d1fa73b1-bc41-4c9e-878f-dcbd64964c22 | error | None | 3 | lvmdriver-1 | false | |
| fd1a6003-4460-4456-ba4d-383708c6dd75 | error | None | 2 | lvmdriver-1 | false | |
+--------------------------------------+--------+------+------+-------------+----------+-------------+

Steven Kaufer (kaufer)
Changed in python-cinderclient:
assignee: nobody → Steven Kaufer (kaufer)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-cinderclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/141964

Changed in python-cinderclient:
status: New → In Progress
Jay Bryant (jsbryant)
Changed in python-cinderclient:
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/141964
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=b0e4cc1b63911710524005855aeefadc0850f44b
Submitter: Jenkins
Branch: master

commit b0e4cc1b63911710524005855aeefadc0850f44b
Author: Steven Kaufer <email address hidden>
Date: Mon Dec 15 22:52:18 2014 +0000

    Client output is not sorted by --sort_key

    The cinder client supports invoking the volumes REST API with the
    sort_dir and sort_key parameters. However, the client output table
    is always sorted by ID even though the REST API is returning in
    sorted order based on the sort key/direction provided.

    For example, the command below supplies the 'size' sort key but the
    output table is still sorted by ID:

    cinder list --sort_key size --sort_dir desc

    This fix contains:
    * Updates to the print_list utility to prevent any re-ordering so
      that the current object order is maintained
    * Updates to the shell to disable re-ordering if the user supplies
      sort parameters

    Change-Id: I4cc111a8bdd2b89158dfc4bb0d16fa6dbf36cc57
    Closes-Bug: 1402846

Changed in python-cinderclient:
status: In Progress → Fix Committed
Changed in python-cinderclient:
milestone: none → 1.3.1
status: Fix Committed → Fix Released
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.