Re: [PATCH v3 09/14] virsh: Create macros for common "pool" options

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

 



On Mon, Jan 11, 2016 at 04:39:25PM +0100, Andrea Bolognani wrote:
> On Sat, 2016-01-09 at 08:36 -0500, John Ferlan wrote:
> > Rather than continually cut-n-paste the strings into each command,
> > create common macros to be used generically.  For virsh-volume, there
> > are 3 different types of "pool" options - 2 for create, 2 required
> > for the command, and 10 for string type options. Create 2 new macros
> > for the create and string type options, but use the virsh.h common
> > macro for the required for command option.
> > 
> > Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> > ---
> >  tools/virsh-volume.c | 87 ++++++++++++++++------------------------------------
> >  1 file changed, 27 insertions(+), 60 deletions(-)
> 
> I really don't like this :)
> 
> I see you're trying to get all instances of the 'pool' option to be
> handled by macros, and I appreciate that, but in this specific case
> I think the resulting code might be a little harder to grasp, which
> is something we should avoid unless it brings along huge benefits.
> 
> > +#define VIRSH_COMMON_OPT_VOLUME_POOL_CREATE                \
> > +    {.name = "pool",                                       \
> > +     .type = VSH_OT_DATA,                                  \
> > +     .flags = VSH_OFLAG_REQ,                               \
> > +     .help = N_("pool name")                               \
> > +    }                                                      \
> 
> So this is basically the same as VIRSH_COMMON_OPT_POOL, minus "or
> uuid" in the help text.
> 
> Can we get away with just using VIRSH_COMMON_OPT_POOL, relying on
> the fact that you obviously can't specify the UUID of a yet to be
> created pool?
> 

No.

Jan

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]