Bug 563450

Summary: list-devices returns devices of different types out of order
Product: [Community] Virtualization Tools Reporter: Matthew Booth <mbooth>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: mbooth, ptoscano, rjones, virt-maint
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-16 15:24:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Matthew Booth 2010-02-10 09:43:46 UTC
Description of problem:
><fs> add-drive /dev/vg_mbooth_t500_2/RHEL52PV32
><fs> add-cdrom /var/lib/virt-v2v/transfer.iso
><fs> launch
><fs> list-devices 
/dev/sr0
/dev/vda

Note that the cd-rom device was added second, but is listed first.

The code is simply doing an alphanumeric sort, which won't work if the devices have different prefixes.

Version-Release number of selected component (if applicable):
libguestfs-1.0.83-5.fc13.x86_64

Comment 1 Richard W.M. Jones 2010-02-12 11:30:47 UTC
Product should be 'Virtualization Tools'.

Comment 2 Pino Toscano 2013-12-13 15:36:25 UTC
(In reply to Matthew Booth from comment #0)
> Description of problem:
> ><fs> add-drive /dev/vg_mbooth_t500_2/RHEL52PV32
> ><fs> add-cdrom /var/lib/virt-v2v/transfer.iso
> ><fs> launch
> ><fs> list-devices 
> /dev/sr0
> /dev/vda

This small sequence currently crashes in the device sorting code (sort_device_names).

> Note that the cd-rom device was added second, but is listed first.
> 
> The code is simply doing an alphanumeric sort, which won't work if the
> devices have different prefixes.

This (and the above) gets fixed by making CD-ROM disks as normal drives; patch proposed to the mailing list:
https://www.redhat.com/archives/libguestfs/2013-December/msg00075.html

Comment 3 Pino Toscano 2013-12-16 15:24:27 UTC
Fixed upstream with:
https://github.com/libguestfs/libguestfs/commit/2392fae6803b9de4a4761509007c160339d57f50
which is in libguestfs >= 1.25.16.