From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZcE7B-0001BL-BJ for qemu-devel@nongnu.org; Wed, 16 Sep 2015 10:55:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZcE78-0000if-50 for qemu-devel@nongnu.org; Wed, 16 Sep 2015 10:55:17 -0400 References: <1441878905-5272-1-git-send-email-wency@cn.fujitsu.com> <1441878905-5272-2-git-send-email-wency@cn.fujitsu.com> <87r3m1krdl.fsf@blackfin.pond.sub.org> <55F6EBF5.2090101@redhat.com> <55F78059.4030309@cn.fujitsu.com> <55F78225.404@cn.fujitsu.com> <55F794A4.5060903@redhat.com> <55F7975B.4050405@cn.fujitsu.com> <55F818F1.9070201@redhat.com> <55F91612.6010300@cn.fujitsu.com> From: Eric Blake Message-ID: <55F982C4.7080101@redhat.com> Date: Wed, 16 Sep 2015 08:55:00 -0600 MIME-Version: 1.0 In-Reply-To: <55F91612.6010300@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HvL20mlmLCSSgoitTQP6S2wNa8ATt0xxI" Subject: Re: [Qemu-devel] [PATCH v3 1/5] support nbd driver in blockdev-add List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , Markus Armbruster Cc: Kevin Wolf , Alberto Garcia , zhanghailiang , qemu block , Jiang Yunhong , Dong Eddie , qemu devel , "Dr. David Alan Gilbert" , Gonglei , Stefan Hajnoczi , Yang Hongyang This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HvL20mlmLCSSgoitTQP6S2wNa8ATt0xxI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/16/2015 01:11 AM, Wen Congyang wrote: >>>> Possible workaround in the meantime - instead of trying to go with a= >>>> nice flat union (where all QMP keys are in the same {} level), we ca= n >>>> use nesting (structs that add another {} to include the unions). >>> >>> How to include the unions to a structs? Use 'base'? >> >> Conceptually, by adding a layer of nesting. On the wire, instead of: >> >> { "switch1":"value", "switch2":"value", "body2":"blah" } >> >> you would instead have: >> >> { "switch1":"value", "data": { "switch2":"value", "body2":"blah" } } >> >> Anywhere in qapi that you try to have: >> { 'union': ..., 'data':{'switch1':'Union'}} >> >> you instead create a wrapper type: >> { 'struct':'Wrapper', 'data':{'data':'Union'}} >> { 'union': ..., 'data':{'switch1':'Wrapper'}} >=20 > If so, the option is "data.switch1" not "switch1" >=20 >> >> >> What I don't know is whether the extra QMP nesting makes it easier or >> harder to support the existing NBD command line options, and it would >=20 > Yes, it is harder to support it. All the more reason to push the qapi improvements through, so that qapi can expose a flat union and not make the command line have to go through ugly nesting. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --HvL20mlmLCSSgoitTQP6S2wNa8ATt0xxI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV+YLEAAoJEKeha0olJ0NqubYH/3+MRMbNNN03x7sDge+ceqor 79KvNS20bUXEXophQSzD21/Ll2ngAE9xfrSe3HfKsM3DV/duERnsooI5nr1UcKZD X/87M2IwK8ckxz6WyB8rPBqfrbCKxwWrTttXuuwVIj9/QojEe14OAI/mQG0IRbGz HoviJDCDfbELD9fGpr8FGQAKjl0Ko5W0NTP/qOaUKVUUSKjRU9OgoHK2zSOBDUQy 6qga0BDec7cD7NSqbb6Tlp9UNfq4UYTFItx0zX3LFa7AHPv4DMwARrHXGa1fPMqv URBzrRKVGdT9KOqJ8qm7kdQZCBglHQ/4WESxhb1S9ZJ9Z9cRyMxEUutiYN8S2H8= =mH9g -----END PGP SIGNATURE----- --HvL20mlmLCSSgoitTQP6S2wNa8ATt0xxI--