glance image-list should sort on name, not UUID

Bug #1081542 reported by Daniel Berrange
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance Client
Fix Released
Low
Brian Waldon

Bug Description

Look at the output of the following command

$ glance image-list
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
| ID | Name | Disk Format | Container Format | Size | Status |
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+
| 2f199e99-babd-4a1f-93b2-bf38a8b7a4fa | cirros-0.3.0-x86_64-uec-kernel | aki | aki | 4731440 | active |
| 41152594-f1cc-4f0b-b04d-d7b5f21907c4 | cirros-0.3.0-x86_64-uec | ami | ami | 25165824 | active |
| 54932597-48cd-4ae5-bda7-fdf397116ae0 | evil | qcow2 | bare | 197120 | active |
| 6faf19bb-a5a9-4b44-a932-7e2c0f8135d1 | f17-x86_64-openstack-sda | qcow2 | bare | 251985920 | active |
| 9474c929-9651-4e09-8565-4a5a7acf256a | f18-x86_64-openstack-sda | qcow2 | bare | 279511040 | active |
| a13223fe-a458-4c4a-b61b-a2bc743660bf | cirros-0.3.0-x86_64-uec-ramdisk | ari | ari | 2254249 | active |
| c7251cc3-11f4-40a4-a867-96780af3d0a8 | foo | | | 251985920 | active |
| ca1bb9f9-e659-4561-8c06-33609cbf2575 | f16-x86_64-openstack-sda | qcow2 | bare | 213581824 | active |
+--------------------------------------+---------------------------------+-------------+------------------+-----------+--------+

Notice how it has sorted the images based on the "ID" column UUID strings. This is incredibly unhelpful for humans, effectively equivalent to no sorting at all, since UUIDs are randomly generated strings. It should be sorting the images based on the 'Name' column. While not a huge issue when you have < 10 images, if you have 100's of images registered the current sorting makes the command practically unusable

Brian Waldon (bcwaldon)
Changed in python-glanceclient:
assignee: nobody → Brian Waldon (bcwaldon)
status: New → In Progress
importance: Undecided → Low
Revision history for this message
Brian Waldon (bcwaldon) wrote :

I can't decide if the most useful sort is by name, or by creation date (showing newest/oldest images first). As consumers of the CLI tool, what would be most useful to see at the top of the list?

Changed in python-glanceclient:
status: In Progress → Incomplete
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Additionally, see https://review.openstack.org/16847. I added the --sort-key and --sort-dir options to the v1 image-list command. At this point, we just need to decide what the sanest default values are for those flags.

Revision history for this message
Daniel Berrange (berrange) wrote :

I still believe that sort by name is the only sensible default. As an example of the problems with sort-by-date, devstack uploads images to glance in parallel, and so its unpredictable which will be done first. In the case of images which have a kernel+initrd image, you can end up in a scenario where the kernel/initrd do not sort alongside their corresponding disk image, due to another image being uploaded in parallel. Sort by name is the only way to get this working nicely.

Revision history for this message
Mark Washenberger (markwash) wrote :

I guess I would prefer for the default to be determined by the server (i.e., the default is to *not* use a sort-key and sort-dir). And then the server would need to do something sufficiently sensible.

However, I think for the purposes of the glance client shell tool, it makes a lot of sense to be sorted by name, so +1 to that approach.

Revision history for this message
Daniel Berrange (berrange) wrote :

To sake of clarity, when I requested this I was only thinking about sorting in the context of the glance client tool. IMHO the server side APIs should just say that sort order is "undefined", so the server is free todo whatever is most appropriate at the time.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

The important distinction to be made is that the python-glanceclient CLI and python-glancelient lib will do different things - the former will sort by name asc, and the latter will not set a sort key/dir (leaving it up to the server).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-glanceclient (master)

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

Changed in python-glanceclient:
status: Incomplete → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-glanceclient (master)

Reviewed: https://review.openstack.org/17065
Committed: http://github.com/openstack/python-glanceclient/commit/4fa68052423c475d25cdb45610f4827aed13d509
Submitter: Jenkins
Branch: master

commit 4fa68052423c475d25cdb45610f4827aed13d509
Author: Brian Waldon <email address hidden>
Date: Wed Nov 28 09:50:46 2012 -0800

    Change default image sort to use name

    Fixes bug 1081542.

    Change-Id: I9e09c3fe3b6c2bfce7e37df1d29b37a42168e878

Changed in python-glanceclient:
status: In Progress → Fix Committed
Brian Waldon (bcwaldon)
Changed in python-glanceclient:
milestone: none → v0.7.0
Brian Waldon (bcwaldon)
Changed in python-glanceclient:
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.