On Fri, Nov 21, 2014 at 11:46:37AM +0100, Pino Toscano wrote: > On Friday 21 November 2014 13:17:58 Hu Tao wrote: > > Parameter `qgroupid' is for adding the created subvolume to a qgroup. > > > > Signed-off-by: Hu Tao <[email protected]> > > --- > > daemon/btrfs.c | 10 +++++++++- > > generator/actions.ml | 15 ++++++++------- > > 2 files changed, 17 insertions(+), 8 deletions(-) > > > > diff --git a/daemon/btrfs.c b/daemon/btrfs.c > > index a20afca..0f525fa 100644 > > --- a/daemon/btrfs.c > > +++ b/daemon/btrfs.c > > @@ -291,7 +291,7 @@ do_btrfs_subvolume_delete (const char *subvolume) > > } > > > > int > > -do_btrfs_subvolume_create (const char *dest) > > +do_btrfs_subvolume_create (const char *dest, const char *qgroupid) > > { > > const size_t MAX_ARGS = 64; > > const char *argv[MAX_ARGS]; > > @@ -309,6 +309,14 @@ do_btrfs_subvolume_create (const char *dest) > > ADD_ARG (argv, i, str_btrfs); > > ADD_ARG (argv, i, "subvolume"); > > ADD_ARG (argv, i, "create"); > > + > > + /* Optional arguments. */ > > + if (optargs_bitmask & GUESTFS_BTRFS_SUBVOLUME_CREATE_QGROUPID_BITMASK) { > > + ADD_ARG (argv, i, "-i"); > > + ADD_ARG (argv, i, qgroupid); > > + } > > + > > + > > ADD_ARG (argv, i, dest_buf); > > ADD_ARG (argv, i, NULL); > > > > diff --git a/generator/actions.ml b/generator/actions.ml > > index 30b839c..1c1fcff 100644 > > --- a/generator/actions.ml > > +++ b/generator/actions.ml > > @@ -10225,9 +10225,9 @@ See C<guestfs_get_e2generation>." }; > > [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; > > "NOARG"; ""; ""]; > > ["mount"; "/dev/sda1"; "/"]; > > ["mkdir"; "/dir"]; > > - ["btrfs_subvolume_create"; "/test1"]; > > - ["btrfs_subvolume_create"; "/test2"]; > > - ["btrfs_subvolume_create"; "/dir/test3"]; > > + ["btrfs_subvolume_create"; "/test1"; "NOARG"]; > > + ["btrfs_subvolume_create"; "/test2"; "NOARG"]; > > + ["btrfs_subvolume_create"; "/dir/test3"; "NOARG"]; > > ["btrfs_subvolume_snapshot"; "/dir/test3"; "/dir/test5"; "true"; > > "NOARG"]; > > ["btrfs_subvolume_snapshot"; "/dir/test3"; "/dir/test6"; ""; > > "0/1000"]]), [] > > ]; > > @@ -10246,7 +10246,7 @@ of the snapshot, in the form > > C</path/to/dest/name>." }; > > InitPartition, Always, TestRun ( > > [["mkfs_btrfs"; "/dev/sda1"; ""; ""; "NOARG"; ""; "NOARG"; > > "NOARG"; ""; ""]; > > ["mount"; "/dev/sda1"; "/"]; > > - ["btrfs_subvolume_create"; "/test1"]; > > + ["btrfs_subvolume_create"; "/test1"; "NOARG"]; > > ["btrfs_subvolume_delete"; "/test1"]]), [] > > ]; > > shortdesc = "delete a btrfs subvolume or snapshot"; > > @@ -10255,13 +10255,14 @@ Delete the named btrfs subvolume or snapshot." }; > > > > { defaults with > > name = "btrfs_subvolume_create"; > > - style = RErr, [Pathname "dest"], []; > > + style = RErr, [Pathname "dest"], [OString "qgroupid"]; > > proc_nr = Some 324; > > optional = Some "btrfs"; camel_name = "BTRFSSubvolumeCreate"; > > shortdesc = "create a btrfs subvolume"; > > Like in patch 2, you need once_had_no_optargs = true for this as well.
Yes. > > > longdesc = "\ > > Create a btrfs subvolume. The C<dest> argument is the destination > > -directory and the name of the subvolume, in the form > > C</path/to/dest/name>." }; > > +directory and the name of the subvolume, in the form C</path/to/dest/name>. > > +The C<qgroupid> adds the newly created subvolume to a qgroup." }; > > "The optional C<qgroupid> parameter represents the qgroup which the > newly created subvolume should be added to." "...will be added to." since it is a optional parameter? Regards, Hu > > or something like that, I'm not an English native speaker either... > > -- > Pino Toscano _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
