From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6ubt-0004eb-Br for qemu-devel@nongnu.org; Tue, 15 Jul 2014 00:45:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6ubo-00027X-Dr for qemu-devel@nongnu.org; Tue, 15 Jul 2014 00:45:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6ubo-00026g-6F for qemu-devel@nongnu.org; Tue, 15 Jul 2014 00:44:56 -0400 Message-ID: <53C4B1C1.9020403@redhat.com> Date: Mon, 14 Jul 2014 22:44:49 -0600 From: Eric Blake MIME-Version: 1.0 References: <1405394393-24154-1-git-send-email-namei.unix@gmail.com> <53C4A127.8010500@redhat.com> <20140715041323.GC15811@ubuntu-trusty> In-Reply-To: <20140715041323.GC15811@ubuntu-trusty> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="H8g3MsRRuVch20rv5PK0ekSV7fvqD0nBx" Subject: Re: [Qemu-devel] [PATCH v2] block/quorum: add simple read pattern support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Liu Yuan Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi , Benoit Canet This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --H8g3MsRRuVch20rv5PK0ekSV7fvqD0nBx Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 07/14/2014 10:13 PM, Liu Yuan wrote: >>> + '*read-pattern': 'str' } } >> >> Raw strings that encode a finite set of values are bad for type-safety= =2E >> Please add an enum: >> >> { 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] } >> >> then use '*read-pattern': 'QuorumReadPattern' >=20 > For startup command line, did it imply a change too? Sorry I'm not fami= liar with > block-core.json. Adding an enum in the .json file will generate an enum that you can reuse in your parsing code (look at commit 82a402e99, parse_enum_option). The command line will be the same, but instead of open-coding things, you can now use the same enum as what the QMP code will use. >=20 > With your suggestion, how we pass read-pattern via qmp? >=20 > read-pattern: fifo > or=20 > read-pattern: quorum The QMP wire format will be identical - the user still passes "read-pattern":"fifo" as part of building up their JSON. It's just that the string "fifo" is now validated for correctness against the enum of valid strings, instead of being open-ended anything goes. >=20 >=20 >> >> Should we offer multiple modes in addition to 'quorum'? For example, = I >> could see a difference between 'fifo' (favor read from the first quoru= m >> member always, unless it fails, good when the first member is local an= d >> other member is remote) and 'round-robin' (evenly distribute reads; ea= ch >> read goes to the next available quorum member, good when all members a= re >> equally distant). >=20 > I guess so. 'round-robin' in your context would benefit use case seekin= g for > better read load balance. Of course, if you do add 'round-robin', do it in a separate patch; and that's also a case where having the enum list valid modes will make it easier to add in a new mode. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --H8g3MsRRuVch20rv5PK0ekSV7fvqD0nBx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJTxLHBAAoJEKeha0olJ0NqyrYIAJh46eBGWA6xB/9OitQuGqv4 igFZepsFemREkKIJQxh3xmVST0vR5Z3ppBxzqu3hXu26Z5TVz4IwEahwKUorXKt3 lkMh5FE4+LcrzYGNCQQdHBJ8ucHvPX9yhndTFXZYCrrG1P/dG8bw9GTM97jXwROa H1PI4XCIFvioVDF6HjO+zQuFx9/glZlDe6OUSgij1XtNjS3eQMby8BdJg6Ej7//E ihxgC6xK5m/JQzGO1wEUK76/1Ud/nxWN55IcYYT7Kccs+8Tz7aVAIyPIFdHGkROA mht+pqiJhX0Bvwpeau9Q6XbWadYz7aeT7G9G5pY/wJ/11yxEFCQfppQJmQ6SdlU= =M34C -----END PGP SIGNATURE----- --H8g3MsRRuVch20rv5PK0ekSV7fvqD0nBx--