btrfs: add optional parameter `qgroupid' to btrfs_subvolume_snapshot

Parameter `qgroupid' is for adding the created snapshot to a qgroup.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
This commit is contained in:
Hu Tao
2014-11-26 17:04:05 +08:00
committed by Pino Toscano
parent 5f608f0735
commit 9e7b9ef97f
2 changed files with 13 additions and 4 deletions

View File

@@ -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);

View File

@@ -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;
once_had_no_optargs = true;
optional = Some "btrfs"; camel_name = "BTRFSSubvolumeSnapshot";
@@ -10229,7 +10229,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 btrfs snapshot";
longdesc = "\
@@ -10237,7 +10238,9 @@ Create a snapshot of the btrfs subvolume C<source>.
The C<dest> argument is the destination directory and the name
of the snapshot, in the form C</path/to/dest/name>. By default
the newly created snapshot is writable, if the value of optional
parameter C<ro> is true, then a readonly snapshot is created." };
parameter C<ro> is true, then a readonly snapshot is created. The
optional parameter C<qgroupid> represents the qgroup which the
newly created snapshot will be added to." };
{ defaults with
name = "btrfs_subvolume_delete";