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

Re: [Libguestfs] [PATCH 3/6] btrfs: add optional parameter `qgroupid' to btrfs_subvolume_snapshot



On Friday 21 November 2014 13:17:57 Hu Tao wrote:
> Parameter `qgroupid' is for adding the created snapshot to a qgroup.
> 
> Signed-off-by: Hu Tao <hutao cn fujitsu com>
> ---
>  daemon/btrfs.c       | 8 +++++++-
>  generator/actions.ml | 5 +++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/daemon/btrfs.c b/daemon/btrfs.c
> index b630bce..a20afca 100644
> --- a/daemon/btrfs.c
> +++ b/daemon/btrfs.c
> @@ -208,7 +208,8 @@ do_mkfs_btrfs (char *const *devices,
>  }
>  
>  int
> -do_btrfs_subvolume_snapshot (const char *source, const char *dest, int ro)
> +do_btrfs_subvolume_snapshot (const char *source, const char *dest, int ro,
> +                             const char *qgroupid)
>  {
>    const size_t MAX_ARGS = 64;
>    const char *argv[MAX_ARGS];
> @@ -240,6 +241,11 @@ do_btrfs_subvolume_snapshot (const char *source, const char *dest, int ro)
>      ADD_ARG (argv, i, "-r");
>    }
>  
> +  if (optargs_bitmask & GUESTFS_BTRFS_SUBVOLUME_SNAPSHOT_QGROUPID_BITMASK) {
> +    ADD_ARG (argv, i, "-i");
> +    ADD_ARG (argv, i, qgroupid);
> +  }
> +
>    ADD_ARG (argv, i, source_buf);
>    ADD_ARG (argv, i, dest_buf);
>    ADD_ARG (argv, i, NULL);
> diff --git a/generator/actions.ml b/generator/actions.ml
> index 850e58d..30b839c 100644
> --- a/generator/actions.ml
> +++ b/generator/actions.ml
> @@ -10217,7 +10217,7 @@ See C<guestfs_get_e2generation>." };
>  
>    { defaults with
>      name = "btrfs_subvolume_snapshot";
> -    style = RErr, [Pathname "source"; Pathname "dest"], [OBool "ro"];
> +    style = RErr, [Pathname "source"; Pathname "dest"], [OBool "ro"; OString "qgroupid"];
>      proc_nr = Some 322;
>      optional = Some "btrfs"; camel_name = "BTRFSSubvolumeSnapshot";
>      tests = [
> @@ -10228,7 +10228,8 @@ See C<guestfs_get_e2generation>." };
>           ["btrfs_subvolume_create"; "/test1"];
>           ["btrfs_subvolume_create"; "/test2"];
>           ["btrfs_subvolume_create"; "/dir/test3"];
> -         ["btrfs_subvolume_snapshot"; "/dir/test3"; "/dir/test5"; "true"]]), []
> +         ["btrfs_subvolume_snapshot"; "/dir/test3"; "/dir/test5"; "true"; "NOARG"];
> +         ["btrfs_subvolume_snapshot"; "/dir/test3"; "/dir/test6"; ""; "0/1000"]]), []
>      ];
>      shortdesc = "create a writable btrfs snapshot";
>      longdesc = "\

This needs the documentation for the "qgroupid" optarg in the longdesc.
LGTM otherwise.

-- 
Pino Toscano


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