From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWQSq-0004p8-7H for qemu-devel@nongnu.org; Mon, 31 Aug 2015 10:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWQSn-0007vB-05 for qemu-devel@nongnu.org; Mon, 31 Aug 2015 10:53:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWQSm-0007v7-OR for qemu-devel@nongnu.org; Mon, 31 Aug 2015 10:53:36 -0400 References: <1440583182-5828-1-git-send-email-yanghy@cn.fujitsu.com> <1440583182-5828-4-git-send-email-yanghy@cn.fujitsu.com> <878u8ym649.fsf@blackfin.pond.sub.org> <55DDDD33.3000507@redhat.com> <87k2sfabku.fsf@blackfin.pond.sub.org> <55E3AFA2.1040702@cn.fujitsu.com> <871tek540h.fsf@blackfin.pond.sub.org> <55E417D0.8050800@cn.fujitsu.com> From: Eric Blake Message-ID: <55E46A6E.4010305@redhat.com> Date: Mon, 31 Aug 2015 08:53:34 -0600 MIME-Version: 1.0 In-Reply-To: <55E417D0.8050800@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UA9DuH35pb4aChscURsHFbHRWa9GOaLd3" Subject: Re: [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang , Markus Armbruster Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, Luiz Capitulino , stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UA9DuH35pb4aChscURsHFbHRWa9GOaLd3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/31/2015 03:01 AM, Yang Hongyang wrote: >=20 > Sorry that I don't know much about the QAPI part, I have a question, in= > previous reply, Eric suggested: > > > > Then this becomes something like: > > > > { 'command': 'netfilter-add', 'data': 'NetFilter' } >=20 If we do this (which requires pending patches to be flushed), then the user specifies the following QMP: { "execute":"netfilter-add", "arguments":{ "id":"abc", "netdev":"def", "type":"dummy" }} > or use NetFilter as a union, but have the command be: >=20 > { 'command': 'netfilter-add', > 'data': { 'data': 'NetFilter' } } This approach would work right now without waiting for pending qapi commits, but the QMP command would look like: { "execute":"netfilter-add", "arguments":{ "data":{ "id":"abc", "netdev":"def", "type":"dummy" }}} >=20 > where you have to pass an extra layer of nesting at the QMP layer. >=20 > What do you mean by pass an extra layer of nesting? The fact that I had to pass "arguments":{"data":{...}}, thereby nesting the real options inside another relatively pointless data wrapper. >=20 > I've already switched to flat union as you suggested: >=20 > { 'struct': 'NetFilterDummyOptions', > 'data': { } } >=20 > { 'enum': 'NetFilterType', > 'data': ['dummy'] } >=20 > { 'struct': 'NetFilterBase', > 'data': { > 'id': 'str', > 'netdev': 'str', > '*chain': 'str', > 'type': 'NetFilterType' } } >=20 > { 'union': 'NetFilter', > 'base': 'NetFilterBase', > 'discriminator': 'type', > 'data': { > 'dummy': 'NetFilterDummyOptions' } } Looks reasonable for a first round. Some of the pending qapi commits may allow us to further simplify things to not be quite so verbose, but that doesn't stop us from using this now. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --UA9DuH35pb4aChscURsHFbHRWa9GOaLd3 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/ iQEcBAEBCAAGBQJV5GpuAAoJEKeha0olJ0NqxikH/0diAHyKpzGkrwznSFCPi6gp cnhwLP3OhDKaFVeHuazL1UFd9McF5cnjquLVyYTpsiU9QFafXtcLRT5J9XeI0kV2 ELEoHoMA5p5z1oQtUPhygnmD53J1pz4r9GHgdPNLXuteNXerzjOjbe+2PerVwRNA RYzwxhykDuFeUyU2oHwR9dvEUaudvaqQ858Zah9CDtFCeTghLwQKyCmbljMEIxws gwDgdr+roZ3NVrecTvdFG0dl3GQjtWLI2T6qbqMyEoFAGr3In+YAZvcGtlaFCYc+ PSbz0EMX6tH8ynlfJoubtyFq6wcJBPy+Lh0yAqEl/q8Y69P5zAMIEHwRI9aPRpE= =0q4C -----END PGP SIGNATURE----- --UA9DuH35pb4aChscURsHFbHRWa9GOaLd3--