diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 9b48a5dd8..2b6735f32 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]; @@ -237,6 +238,11 @@ do_btrfs_subvolume_snapshot (const char *source, const char *dest, int ro) 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 47a98e3db..e2b3cf5bd 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -10217,7 +10217,7 @@ See C." }; { 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; once_had_no_optargs = true; optional = Some "btrfs"; camel_name = "BTRFSSubvolumeSnapshot"; @@ -10229,7 +10229,8 @@ See C." }; ["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 btrfs snapshot"; longdesc = "\ @@ -10237,7 +10238,9 @@ Create a snapshot of the btrfs subvolume C. The C argument is the destination directory and the name of the snapshot, in the form C. By default the newly created snapshot is writable, if the value of optional -parameter C is true, then a readonly snapshot is created." }; +parameter C is true, then a readonly snapshot is created. The +optional parameter C represents the qgroup which the +newly created snapshot will be added to." }; { defaults with name = "btrfs_subvolume_delete";