qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} com


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} commands
Date: Mon, 31 Aug 2015 08:53:34 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/31/2015 03:01 AM, Yang Hongyang wrote:

> 
> 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' }
> 

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:
> 
>   { '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" }}}

> 
>   where you have to pass an extra layer of nesting at the QMP layer.
> 
> 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.

> 
> I've already switched to flat union as you suggested:
> 
> { 'struct': 'NetFilterDummyOptions',
>   'data': { } }
> 
> { 'enum': 'NetFilterType',
>   'data': ['dummy'] }
> 
> { 'struct': 'NetFilterBase',
>   'data': {
>     'id':   'str',
>     'netdev': 'str',
>     '*chain': 'str',
>     'type': 'NetFilterType' } }
> 
> { '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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]