[Libguestfs] [PATCH 4/6] btrfs: add optional parameter `qgroupid' to btrfs_subvolume_create

Hu Tao hutao at cn.fujitsu.com
Mon Nov 24 02:39:36 UTC 2014


On Mon, Nov 24, 2014 at 10:26:50AM +0800, Hu Tao wrote:
> 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 <hutao at cn.fujitsu.com>
> > > ---
> > >  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?

I changed it into "The optional parameter C<qgroupid> represents the qgroup which the
newly created subvolume will be added to.". How does that sound?

> 
> Regards,
> Hu
> 
> > 
> > or something like that, I'm not an English native speaker either...
> > 
> > -- 
> > Pino Toscano
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs




More information about the Libguestfs mailing list