Bug 1414682

Summary: guestfs_canonical_device_name incorrectly returns /dev/sd0 for MD devices (/dev/md0)
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: ptoscano, rbalakri
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-19 12:11:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1414505    

Description Richard W.M. Jones 2017-01-19 08:56:25 UTC
Description of problem:

><fs> list-md-devices 
/dev/md0
/dev/md127
><fs> canonical-device-name /dev/md0
/dev/sd0
><fs> canonical-device-name /dev/md127
/dev/sd127

libguestfs shouldn't rewrite /dev/mdX to /dev/sdX in
this instance.

Version-Release number of selected component (if applicable):

libguestfs 1.35.14

How reproducible:

100%

Steps to Reproduce:
1. See above.

Comment 1 Richard W.M. Jones 2017-01-19 08:57:03 UTC
A consequence of this bug can be seen in the output
of the virt-filesystems command shown here:

https://bugzilla.redhat.com/show_bug.cgi?id=1414510#c0

Comment 2 Richard W.M. Jones 2017-01-19 08:57:56 UTC
Another consequence is that programs like virt-v2v try to
pass the string /dev/sd0 back to the API which fails:

><fs> vfs-type /dev/sd0
libguestfs: error: vfs_type: vfs_type_stub: /dev/sd0: No such file or directory

Comment 3 Richard W.M. Jones 2017-01-19 09:47:58 UTC
Patches posted:

https://www.redhat.com/archives/libguestfs/2017-January/msg00051.html
https://www.redhat.com/archives/libguestfs/2017-January/msg00052.html

The new output from virt-filesystems looks like:

Name        Type        VFS      Label  MBR  Size  Parent
/dev/sda1   filesystem  unknown  -      -    1.0G  -
/dev/sda2   filesystem  unknown  -      -    1.0G  -
/dev/sda3   filesystem  unknown  -      -    8.0G  -
/dev/sdb1   filesystem  unknown  -      -    1.0G  -
/dev/sdb2   filesystem  unknown  -      -    1.0G  -
/dev/sdb3   filesystem  unknown  -      -    8.0G  -
/dev/md0    filesystem  unknown  -      -    10G   /dev/sda,/dev/sdb
/dev/md127  filesystem  unknown  -      -    0     /dev/sda,/dev/sdb
/dev/sda1   partition   -        -      83   1.0G  /dev/sda
/dev/sda2   partition   -        -      82   1.0G  /dev/sda
/dev/sda3   partition   -        -      83   8.0G  /dev/sda
/dev/sdb1   partition   -        -      83   1.0G  /dev/sdb
/dev/sdb2   partition   -        -      82   1.0G  /dev/sdb
/dev/sdb3   partition   -        -      83   8.0G  /dev/sdb
/dev/sda    device      -        -      -    10G   -
/dev/sdb    device      -        -      -    10G   -