Bug 691724

Summary: virt-inspector reports unknown filesystem /dev/vda1
Product: Red Hat Enterprise Linux 6 Reporter: Rita Wu <rwu>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 6.1CC: cwei, jzheng, leiwang, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.7.17-16.el6 Doc Type: Bug Fix
Doc Text:
If the /etc/fstab of a guest machine contained a reference to a virtio disk (/dev/vda1), virt-inspector printed a warning and ignored the virtio disk. The warning has been suppressed, and virtio disks are now recognized by virt-inspector.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 11:44:51 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 Rita Wu 2011-03-29 10:47:23 UTC
Description of problem:
virt-inspector will report error message when fstab entry specifies virtio device. 


# cat /etc/fstab 
/dev/vda1                /                       ext3    defaults        1 1
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-vda2         swap                    swap    defaults        0 0


Although virt-inspector2 will not have this issue,I guess I'd better to file a bug to track this issue, since I don't know how soon the c code will take the place of the perl code, which is the first generation. 

Version-Release number of selected component (if applicable):
libguestfs-1.7.17-15.el6.x86_64
libguestfs-tools-1.7.17-15.el6.x86_64

How reproducible:
always

Steps to Reproduce:
1.Install a vm with virtio drivers  
2.Specify device name in fstab entry
3.# virt-inspector kvm-rhel5.6-i386-virtio.img
unknown filesystem /dev/vda1
unknown filesystem label SWAP-vda2
linux rhel x86_64 5.6 (Red Hat Enterprise Linux Server release 5.6 (Tikanga)) on /dev/sda1:
  Mountpoints:
    /dev/sda1                      /
  Filesystems:
    /dev/sda1:
...
  
Actual results:
unknown filesystem /dev/vda1

Expected results:
no warning/errors about "unknown filesystem /dev/vda1" 

Additional info:
#/usr/lib64/perl5/vendor_perl/Sys/Guestfs/Lib.pm
...
        if (m{^/dev/hd(.*)} && exists $fses->{"/dev/sd$1"}) {
            return ("/dev/sd$1", $fses->{"/dev/sd$1"});
        }
        if (m{^/dev/xvd(.*)} && exists $fses->{"/dev/sd$1"}) {
            return ("/dev/sd$1", $fses->{"/dev/sd$1"});
        }
        if (m{^/dev/mapper/(.*)-(.*)$} && exists $fses->{"/dev/$1/$2"}) {
            return ("/dev/$1/$2", $fses->{"/dev/$1/$2"});
        }

        return () if $file =~ (/media\/cdrom/);
        return () if m{/dev/cdrom};
        return () if m{/dev/fd0};

        warn __x("unknown filesystem {fs}\n", fs => $_);
        return ();
    }
...

Comment 2 Richard W.M. Jones 2011-03-29 11:08:46 UTC
Yes, Linglu's analysis looks right, and it's a simple fix too.

Comment 3 Richard W.M. Jones 2011-03-29 11:22:59 UTC
The equivalent in the replacement core inspection code uses
this regexp:

^/dev/(?:h|s|v|xv)d([a-z]\d*)$   [1]

It seems that simply adding an extra case to the Perl code
should fix this.

Proposed patch (needs testing):
https://www.redhat.com/archives/libguestfs/2011-March/msg00144.html

[1] This is also slightly wrong
https://rwmj.wordpress.com/2011/01/09/how-are-linux-drives-named-beyond-drive-26-devsdz/
but that is an issue for another day.

Comment 4 Richard W.M. Jones 2011-03-29 14:33:40 UTC
Manually reproduced this by installing a Fedora 14 guest with
virtio and editing /etc/fstab so that it had an entry

 /dev/vda1 /boot ext4 defaults 1 2

(Normally Fedora 14 doesn't use device entries like this, so
I had to edit /etc/fstab).

Using Perl virt-inspector from 1.2, I saw the warning message:

 unknown filesystem /dev/vda1

followed by an error (it wasn't able to mount /boot, so it
couldn't parse the grub configuration).  This error was a
consequence of this bug.

I then ran the same virt-inspector from 1.2, but against the
newest Perl libraries with the patch from comment 3.  virt-inspector
now worked correctly.  In addition it showed the following
correct information for the boot filesystem:

      <filesystem dev="/dev/sda1">
        <label></label>
        <uuid>a8df64b5-5d2e-4431-8fee-a8bc75782ac8</uuid>
        <type>ext4</type>
        <content>linux-grub</content>
        <spec>/dev/vda1</spec>
      </filesystem>

So I am happy that the patch in comment 3 will fix the
problem.

Comment 6 Richard W.M. Jones 2011-03-29 14:46:25 UTC
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=3212787
(Build not finished at time of writing)

Comment 8 Jinxin Zheng 2011-03-30 11:07:33 UTC
I tested on Linglu's image.

libguestfs-1.7.17-15.el6: we see 'unknown filesystem /dev/vda1' on the first line of the output of virt-inspector.

libguestfs-1.7.17-16.el6: the 'unknown filesystem /dev/vda1' has gone.

btw: Both detected /dev/sda1 as linux-root. The presence of the vda1 error is the only difference.

Comment 11 Laura Bailey 2011-04-20 01:45:12 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
If the /etc/fstab of a guest machine contained a reference to a virtio disk (/dev/vda1), virt-inspector printed a warning and ignored the virtio disk. The warning has been suppressed, and virtio disks are now recognized by virt-inspector.

Comment 12 Richard W.M. Jones 2011-04-20 07:45:03 UTC
This is fine, thanks.

Comment 13 errata-xmlrpc 2011-05-19 11:44:51 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html

Comment 14 errata-xmlrpc 2011-05-19 13:10:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0586.html