[Libguestfs] [PATCH] NEW API: add new api xfs_info

Richard W.M. Jones rjones at redhat.com
Mon Jul 9 09:28:02 UTC 2012


On Mon, Jul 09, 2012 at 05:15:47PM +0800, Wanlong Gao wrote:
> >   ><rescue> xfs_info /dev/vda1 
> >   meta-data=/dev/vda1              isize=256    agcount=4, agsize=655358 blks
> >            =                       sectsz=512   attr=2
> >   data     =                       bsize=4096   blocks=2621432, imaxpct=25
> >            =                       sunit=0      swidth=0 blks
> >   naming   =version 2              bsize=4096   ascii-ci=0
> >   log      =internal               bsize=4096   blocks=2560, version=2
> >            =                       sectsz=512   sunit=0 blks, lazy-count=1
> >   realtime =none                   extsz=4096   blocks=0, rtextents=0
> > 
> > It's weird output, but let's parse and return that instead of dumping
> > the problem onto every caller.
> 
> Sorry, I can't understand what do you mean here, it's the original output of
> xfs_info.

Sure, but what's the caller going to do with this output
(assuming the caller is a program)?

If it wants to find, eg, the 'bsize' field then it has to
parse this, so we're pushing the problem of parsing the output
up to every program.

BTW we can use augeas to handle parsing, since these useful APIs were
added to augeas recently:

https://www.redhat.com/archives/augeas-devel/2012-May/msg00035.html

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v




More information about the Libguestfs mailing list