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 :|