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

Guannan Ren gren at redhat.com
Tue May 28 11:50:34 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 | 53 ++++++++++++++++++++++++++++++++++++----------------
>   tools/virsh.pod      | 13 +++++++++++--
>   2 files changed, 48 insertions(+), 18 deletions(-)
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index b965c11..4de5dd5 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -299,14 +299,6 @@ static const vshCmdOptDef opts_attach_disk[] = {
>        .type = VSH_OT_STRING,
>        .help = N_("mode of device reading and writing")
>       },
> -    {.name = "persistent",
> -     .type = VSH_OT_ALIAS,
> -     .help = "config"
> -    },
> -    {.name = "config",
> -     .type = VSH_OT_BOOL,
> -     .help = N_("affect next boot")
> -    },
>       {.name = "sourcetype",
>        .type = VSH_OT_STRING,
>        .help = N_("type of source (block|file)")
> @@ -335,7 +327,22 @@ static const vshCmdOptDef opts_attach_disk[] = {
>        .type = VSH_OT_BOOL,
>        .help = N_("print XML document rather than attach the disk")
>       },
> -
> +    {.name = "persistent",
> +     .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}
>   };
>
> @@ -496,15 +503,33 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
>       struct DiskAddress diskAddr;
>       bool isFile = false, functionReturn = false;
>       int ret;
> -    unsigned int flags;
> +    unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
>       const char *stype = NULL;
>       virBuffer buf = VIR_BUFFER_INITIALIZER;
>       char *xml = NULL;
>       struct stat st;
> +    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);
> +

     ACK either change or not^.




More information about the libvir-list mailing list