-----Original Message-----
From: Eric Blake [mailto:eblake@redhat.com]
Sent: Tuesday, October 22, 2013 2:26 PM
To: Michal Privoznik; Chen Hanxiao
Cc: libvir-list(a)redhat.com
Subject: Re: [libvirt] [PATCH 1/5]virsh: disable config readonly and shareable in
virsh command
On 10/21/2013 02:14 PM, Michal Privoznik wrote:
> On 18.10.2013 07:42, Chen Hanxiao wrote:
>> From: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
>>
>> Daneil's suggestion about flag <shareable/> and <readonly/> as
follow:
s/Daneil/Daniel/
Apologized for this typo.
>> - Exclusive read-write. This is the default
>> - Shared read-write. This is the <shareable/> flag
>> - Shared read-only. This is the <readonly/> flag
>>
>>
>> - if (vshCommandOptBool(cmd, "shareable"))
>> + if (!mode && vshCommandOptBool(cmd, "shareable"))
>> virBufferAddLit(&buf, " <shareable/>\n");
>>
>
> - 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");
> + }
I don't think either of these approaches are needed. If you make
--shareable an undocumented alias of --mode=shareable, then the alias
handling code will already guarantee that only one of the two spellings
appears, and you don't have to do any screening here.
If I could do based on your description on:
https://www.redhat.com/archives/libvir-list/2013-October/msg00965.html
This patch could also be abandoned.
Thanks
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org