From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNbdI-0004De-IA for qemu-devel@nongnu.org; Thu, 14 Jul 2016 04:04:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bNbdE-0001J0-RN for qemu-devel@nongnu.org; Thu, 14 Jul 2016 04:04:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bNbdE-0001Ir-MM for qemu-devel@nongnu.org; Thu, 14 Jul 2016 04:04:28 -0400 Date: Thu, 14 Jul 2016 09:04:23 +0100 From: "Daniel P. Berrange" Message-ID: <20160714080423.GB18778@redhat.com> Reply-To: "Daniel P. Berrange" References: <1468468228-27827-1-git-send-email-eblake@redhat.com> <1468468228-27827-17-git-send-email-eblake@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1468468228-27827-17-git-send-email-eblake@redhat.com> Subject: Re: [Qemu-devel] [PATCH v9 16/17] qapi: Tweak QmpInputVisitor to optionally do string conversion List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, armbru@redhat.com, Michael Roth , Andreas =?utf-8?Q?F=C3=A4rber?= On Wed, Jul 13, 2016 at 09:50:27PM -0600, Eric Blake wrote: > Currently the QmpInputVisitor assumes that all scalar > values are directly represented as their final types. > ie it assumes an 'int' is using QInt, and a 'bool' is > using QBool. > > This adds an alternative mode where a QString can also > be parsed in place of the native type, by adding a parameter > and updating all callers. For now, only the testsuite sets > the new autocast parameter. > > This makes it possible to use QmpInputVisitor with a QDict > produced from QemuOpts, where everything is in string format. > It also makes it possible for the next patch to support > back-compat in legacy commands like 'netdev_add' that no > longer use QemuOpts, but must parse the same set of QMP > constructs that QemuOpts would historically allow. I'm not really a huge fan of the approach there. IMHO the input visitor should strictly operate in "all native types" or "all string types" mode. The way you've done it here means that users can actually mix & match strings vs native types for each individual parameter :-( IMHO, I'd suggest you try to parse netdev_add args with it in "all native types" mode, if that fails, then re-parse in "all string types" mode. For that you'd not have to modify my patch at all. 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 :|