[Libguestfs] [PATCH] New API: btrfs_device_stats

Pino Toscano ptoscano at redhat.com
Thu Jun 18 10:53:47 UTC 2015


On Thursday 18 June 2015 18:33:59 Cao jin wrote:
> Hi, Pino
> 
> 在 2015年06月18日 16:41, Pino Toscano 写道:
> > Hi,
> >
> > On Thursday 18 June 2015 11:01:37 Cao jin wrote:
> >>> Speaking of this: you said that you have a colleague working on
> >>> btrfs-progs? What about suggesting to create some machine-parseable
> >>> output (csv, xml, yaml, json, whatever) so extracting the results of
> >>> btrfs tools is a lot more easy?
> >>>
> >>
> >> Yes, I forward your suggestion and consult him, the result is not
> >> surprised:( Here is what I learned from him:
> >>     For the btrfs-progs cmds who output strings, the output are plain,
> >> don`t have patterns. Seen some guys who want a formatted output, they do
> >> a filter by themself, it not reasonable to ask btrfs-progs to output
> >> formatted strings.
> >
> > This is exactly the issue here: every btrfs command has a totally
> > different formatting for its output. Just let him take a look at all
> > the commands implemented so far in libguestfs, you can easily spot
> > that:
> > - btrfs subvolume list
> > - btrfs subvolume show
> > - btrfs qgroup show
> > - btrfs balance status
> > - btrfs scrub status
> > - btrfs device stats
> > all have different custom parsers for each of their outputs.
> >
> > Compare that to e.g. the -m parameter for parted, so it outputs fields
> > separated by semi-colon.
> >
> 
> Already forward your mail to my colleague. He think your comment is 
> interesting, and also forward your option to btrfs-progs mail-list.

Great to hear that, thanks for it.

> Speaking of btrfs device stats output, what do you suggest to do for 
> now? Since it may has multi devices.

I see few options:

(a) keep the current RHashTable

(b) turn the statistics into a proper struct, and use RStructList

(c) implement RHashTableList, and use it

(d) something else I'm missing

-- 
Pino Toscano




More information about the Libguestfs mailing list