
-----Original Message----- From: Michal Privoznik [mailto:mprivozn@redhat.com] Sent: Monday, October 21, 2013 9:15 PM To: Chen Hanxiao Cc: libvir-list@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