Bug 880801 - virt-df with two -a options displays incorrect disk image name
Summary: virt-df with two -a options displays incorrect disk image name
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Richard W.M. Jones
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 880805 880806
TreeView+ depends on / blocked
 
Reported: 2012-11-27 20:10 UTC by Richard W.M. Jones
Modified: 2012-11-29 11:48 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 880805 880806 (view as bug list)
Environment:
Last Closed: 2012-11-29 11:48:28 UTC
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2012-11-27 20:10:06 UTC
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%
WinXP:/dev/debian5x64.home.annexia.org/home
                                       3555936     365544    3009760   11%
WinXP:/dev/debian5x64.home.annexia.org/root
                                        329233     309786       2449   95%
WinXP:/dev/debian5x64.home.annexia.org/tmp
                                        309401      10292     283135    4%
WinXP:/dev/debian5x64.home.annexia.org/usr
                                       3539776    2089124    1270840   60%
WinXP:/dev/debian5x64.home.annexia.org/var
                                       2774352    2088408     548332   76%

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

libguestfs 1.18.10
libguestfs 1.19.64

How reproducible:

100%

Steps to Reproduce:
1. Run virt-df with two -a options.

Comment 1 Richard W.M. Jones 2012-11-27 20:23:21 UTC
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."

But:

(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 20:27:07 UTC
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 20:28:25 UTC
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 11:48:28 UTC
Upstream fix here:
https://github.com/libguestfs/libguestfs/commit/9e7daf2ee8f0a619440ca1c55dfe5ddcf61b4460


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