[libvirt] [PATCH 1/3] virsh-domain: Add --live, --config, --current logic to cmdAttachDevice

Guannan Ren gren at redhat.com
Tue May 28 11:43:53 UTC 2013


On 05/28/2013 06:52 PM, Peter Krempa wrote:
> Use the approach established in commit
> 69ce3ffa8d431e9810607c6e00b7cfcc481b491d to improve this function too.
> ---
>   tools/virsh-domain.c | 41 ++++++++++++++++++++++++++++++++---------
>   tools/virsh.pod      | 16 +++++++++++++---
>   2 files changed, 45 insertions(+), 12 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 0402aef..b965c11 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -173,13 +173,21 @@ static const vshCmdOptDef opts_attach_device[] = {
>        .help = N_("XML file")
>       },
>       {.name = "persistent",
> -     .type = VSH_OT_ALIAS,
> -     .help = "config"
> +     .type = VSH_OT_BOOL,
> +     .help = N_("make live change persistent")
>       },
>       {.name = "config",
>        .type = VSH_OT_BOOL,
>        .help = N_("affect next boot")
>       },
> +    {.name = "live",
> +     .type = VSH_OT_BOOL,
> +     .help = N_("affect running domain")
> +    },
> +    {.name = "current",
> +     .type = VSH_OT_BOOL,
> +     .help = N_("affect current domain")
> +    },
>       {.name = NULL}
>   };
>
> @@ -191,7 +199,21 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd)
>       char *buffer;
>       int rv;
>       bool ret = false;
> -    unsigned int flags;
> +    unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
> +    bool current = vshCommandOptBool(cmd, "current");
> +    bool config = vshCommandOptBool(cmd, "config");
> +    bool live = vshCommandOptBool(cmd, "live");
> +    bool persistent = vshCommandOptBool(cmd, "persistent");
> +
> +    VSH_EXCLUSIVE_OPTIONS_VAR(persistent, current);


    VSH_EXCLUSIVE_OPTIONS_VAR(current, persistent)
    could be a little more consistent with the following two lines.



> +
> +    VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
> +    VSH_EXCLUSIVE_OPTIONS_VAR(current, config);

ACK.




More information about the libvir-list mailing list