[Libguestfs] [PATCH] btrfs: fix parsing of output of 'btrfs qgroup show' (RHBZ#1188553)

Pino Toscano ptoscano at redhat.com
Wed Feb 4 08:59:52 UTC 2015


On Wednesday 04 February 2015 10:12:06 Hu Tao wrote:
> 'btrfs qgroup show' used to output bytes in raw, but in
> btrfs-progs v3.18.2 it outputs bytes with suffix KiB, MiB
> or like by default, which causes error when parsing the output.
> 
> Fix it by adding '--raw' to let 'btrfs qgroup show' output raw numbers
> always.
> 
> Signed-off-by: Hu Tao <hutao at cn.fujitsu.com>
> ---
>  daemon/btrfs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index 5cab52a..402b7de 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -1231,6 +1231,7 @@ do_btrfs_qgroup_show (const char *path)
>    ADD_ARG (argv, i, str_btrfs);
>    ADD_ARG (argv, i, "qgroup");
>    ADD_ARG (argv, i, "show");
> +  ADD_ARG (argv, i, "--raw");
>    ADD_ARG (argv, i, path_buf);
>    ADD_ARG (argv, i, NULL);

It seems that --raw has been added in btrfs-tools 0.18.2, so need to
check for the availability of that parameter, and pass it only in that
case.

Thanks,
-- 
Pino Toscano




More information about the Libguestfs mailing list