Bug 880801 - virt-df with two -a options displays incorrect disk image name
virt-df with two -a options displays incorrect disk image name
Product: Virtualization Tools
Classification: Community
Component: libguestfs (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Richard W.M. Jones
Depends On:
Blocks: 880805 880806
  Show dependency treegraph
Reported: 2012-11-27 15:10 EST by Richard W.M. Jones
Modified: 2012-11-29 06:48 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 880805 880806 (view as bug list)
Last Closed: 2012-11-29 06:48:28 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2012-11-27 15:10:06 EST
Description of problem:

(Reported by muued on IRC)

$ sudo virt-df -a /dev/vg_pin/Debian5x64 -a /dev/vg_pin/WinXP
Filesystem                           1K-blocks       Used  Available  Use%
WinXP:/dev/sda1                         329679      67325     244787   21%
WinXP:/dev/sdb1                        6281380    2812564    3468816   45%
                                       3555936     365544    3009760   11%
                                        329233     309786       2449   95%
                                        309401      10292     283135    4%
                                       3539776    2089124    1270840   60%
                                       2774352    2088408     548332   76%

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

libguestfs 1.18.10
libguestfs 1.19.64

How reproducible:


Steps to Reproduce:
1. Run virt-df with two -a options.
Comment 1 Richard W.M. Jones 2012-11-27 15:23:21 EST
Strictly speaking (reading the man page), this is an
incorrect use of virt-df:

      "If any -a or -d arguments are specified, "virt-df" performs a "df"-type
       operation on either the single named libvirt domain, or on the disk
       image(s) listed on the command line (which must all belong to a single
       VM).  In this mode (with arguments), "virt-df" will only work for a
       single guest.  If you want to run on multiple guests, then you have to
       invoke "virt-df" multiple times."


(1) The behaviour is unexpected.  We should at least document it
more clearly.

(2) Using the name of the last disk is arbitrary, and wrong.  We
should use something else here, perhaps both names, or perhaps
the first name plus '*', or an explanatory string.
Comment 2 Richard W.M. Jones 2012-11-27 15:27:07 EST
Note also, the same thing can happen if the user uses
the -d option multiple times:

$ sudo virt-df -d F17x64 -d F19Rawhidex32 Filesystem                           1K-blocks       Used  Available  Use%
F19Rawhidex32:/dev/sda1                 495844      97005     373239   20%
F19Rawhidex32:/dev/sdb1                 495844      96275     373969   20%
F19Rawhidex32:/dev/sdb3               26894392    3714140   21814084   14%
F19Rawhidex32:/dev/vg_f17x64/lv_root  28447752    5318808   21683876   19%

Roughly the same code in main.c:282 is involved.
Comment 3 Richard W.M. Jones 2012-11-27 15:28:25 EST
Also the --help output and SYNOPSIS in the man page is
less than clear on this issue.
Comment 4 Richard W.M. Jones 2012-11-29 06:48:28 EST
Upstream fix here:

Note You need to log in before you can comment on or make changes to this bug.