Bug 727088

Summary: Directory shouldn't be listed as type 'file' with vol-list command
Product: Red Hat Enterprise Linux 6 Reporter: Nan Zhang <nzhang>
Component: libvirtAssignee: Peter Krempa <pkrempa>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: dallan, dyuan, eblake, mzhan, rwu, veillard, whuang
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.4-3.el6 Doc Type: Bug Fix
Doc Text:
Cause: New storage type was added to libvirt, but the API was not tweaked to support it. Consequence: Directory type storage volumes were reported to be file storage volumes. Fix: The new volume type was added to the public API and the API was fixed to report correct values. Result: Volume type is correctly reported and displayed in associated tools.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 11:20:23 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 Nan Zhang 2011-08-01 10:00:11 UTC
Description of problem:
as subject.

Version-Release number of selected component (if applicable):
libvirt-0.9.4-0rc2.el6.x86_64

How reproducible:
always

Steps to Reproduce:
# virsh vol-list default --details
Name         Path                                 Type  Capacity  Allocation
----------------------------------------------------------------------------
netfs-pool   /var/lib/libvirt/images/netfs-pool   file     0.00        0.00
rhel6.img    /var/lib/libvirt/images/rhel6.img    file   8.00 GB     1.62 GB
rhel6.qcow2  /var/lib/libvirt/images/rhel6.qcow2  file   6.00 GB     2.06 GB
test.img     /var/lib/libvirt/images/test.img     file   6.00 GB     1.59 GB
win7.img     /var/lib/libvirt/images/win7.img     file  12.00 GB    12.01 GB

# ls -l /var/lib/libvirt/images/
total 18125348
drwxr-xr-x. 2 nobody nobody        4096 Jul 28 03:16 netfs-pool
-rw-------. 1 root   root    8589934592 Sep 11  2010 rhel6.img
-rw-rw-r--. 1 root   root    2215182336 Jul 28 03:17 rhel6.qcow2
-rw-------. 1 qemu   qemu    6442450944 Aug  1 02:34 test.img
-rw-------. 1 qemu   qemu   12884901888 Aug  1 02:41 win7.img

Actual results:
Directory 'netfs-pool' is listed as one of the volumes, and was specified as 'file' type.

Expected results:
Directory 'netfs-pool' shouldn't be listed as a volume.

Additional info:

Comment 1 Peter Krempa 2011-08-01 12:38:38 UTC
This bug was introduced by adding filesystem passthrough feature.

commit 8077d64f964705c1034555abeea38773532b762f
Author: Cole Robinson <crobinso>
Date:   Thu May 26 14:05:32 2011 -0400

    storage: List directory volumes for dir/fs/netfs pools

    Since directories can be used for <filesystem> passthrough, they are
    basically storage volumes.

    v2:
        Skip ., .., lost+found dirs

    v3:
        Use gnulib last_component

    v4:
        Use gnulib "dirname.h", not system <dirname.h>
        Don't skip lost+found

Comment 2 Dave Allan 2011-08-01 13:32:28 UTC
(In reply to comment #1)
> This bug was introduced by adding filesystem passthrough feature.
> 
> commit 8077d64f964705c1034555abeea38773532b762f
> Author: Cole Robinson <crobinso>
> Date:   Thu May 26 14:05:32 2011 -0400
> 
>     storage: List directory volumes for dir/fs/netfs pools
> 
>     Since directories can be used for <filesystem> passthrough, they are
>     basically storage volumes.

Ok, then this is a feature.  Closing as NOTABUG.

Comment 3 Dave Allan 2011-08-10 15:33:56 UTC
Hmm, I think I closed this too hastily.  The directory is listed as type 'file', which isn't correct.  I'm reopening so that can be changed.

Comment 4 Eric Blake 2011-08-11 19:40:24 UTC
Fixed with two upstream commits:

commit 594f564c75601f5210af166683041873cb195555
Author: Peter Krempa <pkrempa>
Date:   Thu Aug 11 11:37:18 2011 +0200

    virsh: Add dir type for listing volumes with vol-list
    
    Fix of output of detailed volume list. BZ #727088

commit 6c55124f37afdcd29551a38c681ecef85f8d5af8
Author: Peter Krempa <pkrempa>
Date:   Thu Aug 11 11:37:17 2011 +0200

    storage: Directory shouldn't be listed as type 'file'
    
    Fix internals of libvirt for new storage volume type.
    Libvirt reported an invalid type of the volume.
    
    BZ #727088

Comment 7 Nan Zhang 2011-08-16 06:06:10 UTC
Verified with libvirt-0.9.4-4.el6.x86_64, it's fixed already.

# virsh vol-list default --details
Name         Path                                 Type  Capacity  Allocation
----------------------------------------------------------------------------
foo-new.img  /var/lib/libvirt/images/foo-new.img  file   4.00 GB   136.00 KB
foo.img      /var/lib/libvirt/images/foo.img      file   5.86 GB     2.07 GB
netfs        /var/lib/libvirt/images/netfs        dir      0.00        0.00 
rhel6.img    /var/lib/libvirt/images/rhel6.img    file   5.86 GB     1.75 GB
test.img     /var/lib/libvirt/images/test.img     file   6.00 GB     1.42 GB
win7.img     /var/lib/libvirt/images/win7.img     file  12.00 GB    12.00 GB

Comment 8 Peter Krempa 2011-11-11 09:36: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:
Cause:
New storage type was added to libvirt, but the API was not tweaked to support it.

Consequence:
Directory type storage volumes were reported to be file storage volumes.

Fix:
The new volume type was added to the public API and the API was fixed to report correct values.

Result:
Volume type is correctly reported and displayed in associated tools.

Comment 9 errata-xmlrpc 2011-12-06 11:20:23 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2011-1513.html