[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv4 1/2] virsh: add new --details option to pool-list



On Tue, Jun 22, 2010 at 12:35:32PM -0600, Eric Blake wrote:
> On 06/22/2010 12:24 PM, Hugh O. Brock wrote:
> >> Correct, we shouldn't change this behaviour - it'll break apps parsing
> >> the output
> > 
> > FWIW Rich Jones complains that the output as it stands is nigh on
> > unparseable anyway. Perhaps we should consider that a bug, and fix
> > it...
> 
> The new --details option is our chance to change output - it outputs
> whatever format we want, because it is a new flag; Rich, do you have any
> preferences about what it _should_ output?
> 
> Here's what pool-list --details would currently do, if we applied
> Justin's patch as-is (modulo no line wrapping added by my email client):

Sorry, been away for a couple of weeks.

> virsh # pool-list --details --all
> Name       State     Autostart  Persistent  Capacity  Allocation  Available
> ---------------------------------------------------------------------------
> default    running   yes        yes          1.79 TB     1.49 TB  304.77 GB
> image_dir  running   yes        yes          1.79 TB     1.49 TB  304.77 GB
> tmp        inactive  no         yes                -           -          -

One good thing, and several bad things about that.  The good thing is
that empty columns are presented with '-' which means you can use awk
and sort -k to parse the output columnwise.

The bad things:

* Space within fields "1.79 TB" (awk / sort -k in fact _won't_ work).

* Numeric fields aren't numbers: You can't sort -n on "1.79 TB", and
  you can't read that number into a script and do math on it.  Most
  tools have a "-h" or "--human" option in order to generate human-
  readable numbers (without spaces), but default to just printing the
  raw numbers.

* Unnecessary "-------" line.

* Title line should be optional.  Have a --no-title option or
  something like that to suppress it.

* Does virsh still print an unnecessary blank line after the output?
  If so, stop doing that.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
New in Fedora 11: Fedora Windows cross-compiler. Compile Windows
programs, test, and build Windows installers. Over 70 libraries supprt'd
http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]