From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZbqBe-0007Y8-UW for qemu-devel@nongnu.org; Tue, 15 Sep 2015 09:22:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zbq1G-0007yY-Dk for qemu-devel@nongnu.org; Tue, 15 Sep 2015 09:11:40 -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> From: Eric Blake Message-ID: <55F818F1.9070201@redhat.com> Date: Tue, 15 Sep 2015 07:11:13 -0600 MIME-Version: 1.0 In-Reply-To: <55F7975B.4050405@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="F3qxue89eNrn07wxQwhHCsvR6HucOt8Am" 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) --F3qxue89eNrn07wxQwhHCsvR6HucOt8Am Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/14/2015 09:58 PM, Wen Congyang wrote: > On 09/15/2015 11:46 AM, Eric Blake wrote: >> On 09/14/2015 08:27 PM, Wen Congyang wrote: >>>> Building fails: >>>> GEN qmp-commands.h >>>> In file included from /work/src/qemu/qapi-schema.json:9: >>>> In file included from /work/src/qemu/qapi/block.json:6: >>>> /work/src/qemu/qapi/block-core.json:1844: Flat union 'BlockdevOption= sNBD' must have a string base field >>>> Makefile:286: recipe for target 'qmp-commands.h' failed >>>> make: *** [qmp-commands.h] Error 1 >> >> Yep, doesn't work until pending qapi patches land. >=20 > This patchset: qapi: QMP introspection? That, and "qapi-ify netdev_add, and other post-introspection cleanups" https://lists.gnu.org/archive/html/qemu-devel/2015-09/msg02580.html and "qapi: support anonymous inline base" https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg02346.html [still needs rebasing to latest versions of the other series] >> >> 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 can >> use nesting (structs that add another {} to include the unions). >=20 > 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'}} 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 ultimately be nice to have unified support so that anything we can do on the command line can be expressed in QMP; and anything we can do in QMP can be expressed on the command line without undue nesting. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --F3qxue89eNrn07wxQwhHCsvR6HucOt8Am 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+BjxAAoJEKeha0olJ0NqdNUIAJOA/mI7T4VCtWAPoXv0Gz0/ K6jy1hlDLlUJAlp8WxZHtHpvfxnq5hl9Gy/eEC4/PYaSNmtalPsAw+uu//JYYqaV JbIgelsxBHVi/iZAZPZeRbAJWiMVNFVhir1256ppG2ojjutHd8/iBEdzvRv7lqCu cQDA4mN8IzA6m70O2PKILhVdYcT+/GZs6q24Xj8ZiH9yTt5d0cvMnBbj91AlkE87 htyLfk+ol0m9ZWKpdBYArDDHX5Mk/PmN+PTV2pupeePEHD/fQ5myIIW4V4OJF/rv zNtwUhW9rvv1BjXSnl6jl7b4PFIR23jdSRCzqLM0Z67O7RQJ/Mm+OkBtFcyDuxU= =1Cop -----END PGP SIGNATURE----- --F3qxue89eNrn07wxQwhHCsvR6HucOt8Am--