[libvirt] [PATCH 1/5]virsh: disable config readonly and shareable in virsh command
Chen Hanxiao
chenhanxiao at cn.fujitsu.com
Tue Oct 22 03:16:35 UTC 2013
> -----Original Message-----
> From: Michal Privoznik [mailto:mprivozn at redhat.com]
> Sent: Monday, October 21, 2013 9:15 PM
> To: Chen Hanxiao
> Cc: libvir-list at redhat.com
> Subject: Re: [libvirt] [PATCH 1/5]virsh: disable config readonly and
shareable in
> virsh command
>
> > - if (vshCommandOptBool(cmd, "shareable"))
> > + if (!mode && vshCommandOptBool(cmd, "shareable"))
> > virBufferAddLit(&buf, " <shareable/>\n");
> >
> > if (straddr) {
> >
>
> So IIUC, it's still possible to use '--mode readonly' and '--shareable' at
the same
> time (of course, the latter one won't get applied, but no error is thrown
either).
Yes, we could still use this two parameters at the same time.
>
> I think, we should make use of '--mode' and '--shareable' exclusive. So we
need
> something like this:
>
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index b75f331..30fadce 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -602,8 +602,13 @@ cmdAttachDisk(vshControl *ctl, const vshCmd *cmd)
> if (wwn)
> virBufferAsprintf(&buf, " <wwn>%s</wwn>\n", wwn);
>
> - if (vshCommandOptBool(cmd, "shareable"))
> + if (vshCommandOptBool(cmd, "shareable")) {
> + if (mode) {
> + vshError(ctl, "%s", _("--shareable and --mode are mutually
> exclusive"));
> + goto cleanup;
> + }
> virBufferAddLit(&buf, " <shareable/>\n");
> + }
>
> if (straddr) {
> if (str2DiskAddress(straddr, &diskAddr) != 0) {
>
>
Looks reasonable.
I'll add these in v2 patch due to your comments.
Can I add your SOF?
Thanks!
> Michal
More information about the libvir-list
mailing list