From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:60503) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDKUN-0004mE-2X for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SDKUL-0002mJ-74 for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:54:26 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:42631) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SDKUK-0002lW-Va for qemu-devel@nongnu.org; Thu, 29 Mar 2012 14:54:25 -0400 Received: from /spool/local by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 29 Mar 2012 12:54:18 -0600 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id B9929C90060 for ; Thu, 29 Mar 2012 14:53:57 -0400 (EDT) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2TIrkrn3436764 for ; Thu, 29 Mar 2012 14:53:47 -0400 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q2TIrkN6028732 for ; Thu, 29 Mar 2012 15:53:46 -0300 Message-ID: <4F74AFB9.1090203@us.ibm.com> Date: Thu, 29 Mar 2012 13:53:45 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <1333042003-15490-1-git-send-email-lcapitulino@redhat.com> <1333042003-15490-13-git-send-email-lcapitulino@redhat.com> <4F74A95A.7050403@us.ibm.com> <20120329154234.13c18fbe@doriath.home> In-Reply-To: <20120329154234.13c18fbe@doriath.home> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 12/13] qapi: support for keyworded variable-length argument list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, kraxel@redhat.com, qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com On 03/29/2012 01:42 PM, Luiz Capitulino wrote: > On Thu, 29 Mar 2012 13:26:34 -0500 > Anthony Liguori wrote: > >> On 03/29/2012 12:26 PM, Luiz Capitulino wrote: >>> This allows for QAPI functions to receive a variable-length argument >>> list. This is going to be used by device_add and netdev_add commands. >>> >>> In the schema, the argument list is represented by type name '**', >>> like this example: >>> >>> { 'command': 'foo', 'data': { 'arg-list': '**' } } >>> >>> Each argument is represented by the KeyValues type and the C >>> implementation should expect a KeyValuesList, like: >>> >>> void qmp_foo(KeyValuesList *values_list, Error **errp); >>> >>> XXX: This implementation is simple but very hacky. We just iterate >>> through all arguments and build the KeyValuesList list to be >>> passed to the QAPI function. >>> >>> Maybe we could have a kwargs type, that does exactly this but >>> through a visitor instead? >>> >>> Signed-off-by: Luiz Capitulino >> >> What about just treating '**' as "marshal remaining arguments to a string" and >> then pass that string to device_add? qmp_device_add can then parse that string >> with QemuOpts. > > If this turns out to be simple enough, I'm fine with it. I don't love doing this sort of double conversion but it's really the only practical way to do it I think. device_add has a weird semantic where printing/parsing is implied so I think it's unavoidable. >> It's a bit ugly, but that's how things worked. When we introduce qom_add, this >> problem goes away because you would make multiple calls to qom_set to set all of >> the properties. > > Just out of curiosity, is qom_add going to supersede device_add? Eventually... I'd like to see qom_add as the low level interface but then I'd like to see nice high level interfaces like 'block_add' which took a parameter of virtio-blk and did all of the magic to create a block device in such a way that's compliant to the current machine type. Regards, Anthony Liguori