[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 Thu, Jul 01, 2010 at 03:00:14PM +0100, Daniel P. Berrange wrote:
> The changes noted above to make it machine friendly, make it very 
> unfriendly to humans. The patch was focused on making this more
> friendly for humans.

I would dispute that this makes it "very unfriendly to humans".  If
you adopted all of my suggestions then the output would be (assuming
1K blocks for sizes):

 virsh # pool-list --details --all
 Name      State    Autostart Persistent Capacity   Allocation  Available
 default   running  yes       yes        1921997864 1599875317  319574507
 image_dir running  yes       yes        1921997864 1599875317  319574507
 tmp       inactive no        yes               -            -          -

or:

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

[Note using "xxGB" is dubious because of the ISO stupid GB vs GiB
thing.  You have to write either "xxG" or "xxGiB".  Coreutils 'df'
uses "xxG".]

>  # virsh list
>   Id Name                 State
>  ----------------------------------
>   - f12i686              shut off
>   - f12i686_v1           shut off
>   - f13i686              shut off
>   - f13x86_64            shut off

This is what you have to write in order to get a list of domains from
a shell script:

  guests=$(virsh list --all | tail -n+3 | head -n-1 | awk '{print $2}')

and this isn't even reliable for getting other fields such as the
state, since that field can contain spaces.

[...]
> A global '--format=plain|csv|json|xml' flag could apply to every single
> virsh command, causing these methods to print in the corresponding
> data format. Thus we'd have no code paths duplicated & flexible data
> formatting in many styles

But I fully agree if we can do it all in a single way, with no
duplicated code paths, and tests for each, then we should do this.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


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