From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZX7i4-000552-6c for qemu-devel@nongnu.org; Wed, 02 Sep 2015 09:04:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZX7i0-0003ic-DV for qemu-devel@nongnu.org; Wed, 02 Sep 2015 09:04:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZX7i0-0003iH-6E for qemu-devel@nongnu.org; Wed, 02 Sep 2015 09:04:12 -0400 Date: Wed, 2 Sep 2015 14:04:05 +0100 From: "Daniel P. Berrange" Message-ID: <20150902130405.GD22094@redhat.com> References: <1441098383-22585-1-git-send-email-yanghy@cn.fujitsu.com> <1441098383-22585-2-git-send-email-yanghy@cn.fujitsu.com> <20150901143622.GC2407@stefanha-thinkpad.redhat.com> <55E6533F.30600@cn.fujitsu.com> <20150902125858.GH17873@stefanha-thinkpad.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20150902125858.GH17873@stefanha-thinkpad.redhat.com> Subject: Re: [Qemu-devel] [PATCH v9 01/10] net: add a new object netfilter Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, Markus Armbruster , Paolo Bonzini , Yang Hongyang , Andreas Faerber On Wed, Sep 02, 2015 at 01:58:58PM +0100, Stefan Hajnoczi wrote: > On Wed, Sep 02, 2015 at 09:39:11AM +0800, Yang Hongyang wrote: > > On 09/01/2015 10:36 PM, Stefan Hajnoczi wrote: > > >On Tue, Sep 01, 2015 at 05:06:14PM +0800, Yang Hongyang wrote: > > >>diff --git a/qemu-options.hx b/qemu-options.hx > > >>index 77f5853..f1d42a1 100644 > > >>--- a/qemu-options.hx > > >>+++ b/qemu-options.hx > > >>@@ -1991,6 +1991,27 @@ override the default configuration (@option{-net nic -net user}) which > > >> is activated if no @option{-net} options are provided. > > >> ETEXI > > >> > > >>+DEF("netfilter", HAS_ARG, QEMU_OPTION_netfilter, > > >>+ "-netfilter buffer,id=str,netdev=str[,chain=in|out|all,interval=t]\n" > > >>+ " buffer network packets on netdev. if interval provided, will release\n" > > >>+ " packets by interval. Interval scale: microsecond\n", QEMU_ARCH_ALL) > > > > > >Perhaps the -object option should be used: > > > > > > -object netfilter-buffer,id=str,netdev=str[,chain=in|out|all,interval=t] > > > > > >That is how IOThread and memory backends were recently added. > > > > > >They are QOM objects (see include/qom/object.h) and eliminate the need > > >to write boilerplate code that adds new command-line options and > > >instantiates objects. > > > > I thought -netfilter is more obvious for an object name, -object is kind of > > abstract name... but I'm not maintainer, if you think it's really need to > > change to -object, I can do that. > > The advantage of QOM and -object is that it eliminates code for > command-line options, object instantiation, etc. They introduce a > single object model that all types within QEMU can use instead of > inventing their own. > > Personally I'm not that involved in QAPI or command-line but I thought > -object was the new preferred way to do things. Yep, you're right - using QOM would be a better idea as it avoids all the QemuOpts boilerplate command line handling and being part of the standard object framework makes introspection easier for apps too. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|