[libvirt] [PATCH v3 05/14] virsh: Create macro for common "config" option

Andrea Bolognani abologna at redhat.com
Mon Jan 11 12:21:51 UTC 2016


On Sat, 2016-01-09 at 08:36 -0500, John Ferlan wrote:
> Rather than continually cut-n-paste the strings into each command,
> create a common macro to be used generically.  Note that not all
> '{.name = "config",' entries are replaced, just those that have the
> common .help string of "affect next boot".
> 
> Non replaced instances are unique to the command.
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  tools/virsh-domain.c | 116 +++++++++++++--------------------------------------
>  1 file changed, 28 insertions(+), 88 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 476ba58..ba6ba7f 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -69,6 +69,12 @@
>       .help = N_("make live change persistent")         \
>      }                                                  \
>  
> +#define VIRSH_COMMON_OPT_DOMAIN_CONFIG                 \
> +    {.name = "config",                                 \
> +    .type = VSH_OT_BOOL,                               \
> +    .help = N_("affect next boot")                     \
> +    }                                                  \
> +

.type and .help are not aligned properly.

You also seem to have missed the 'dommemstat' command; however,
since that command is defined in virsh-domain-monitor.c you'll
have to move the definition of VIRSH_COMMON_OPT_DOMAIN_CONFIG
to virsh.h to make it available there.

The config option for the 'schedinfo' and 'change-media'
commands, while it has a slightly different help text, also
serves AFAICT the same purpose and as such should IMHO use the
macro you just defined as well.

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list