On 07/14/2016 08:16 AM, Daniel P. Berrange wrote: > On Thu, Jul 14, 2016 at 08:04:29AM -0600, Eric Blake wrote: >> On 07/14/2016 07:03 AM, Daniel P. Berrange wrote: >>
>> 3 is a superset of 2, and your command-line conversion is the only case >> where we can achieve 2. That is, code dealing with QMP can only choose >> between 1 and 3, based on whether the QAPI .json file used >> 'autocast':true for back-compat reasons (the only candidates are >> 'netdev_add' and 'device_add'). And code dealing with command line >> parsing can only choose 2 (QemuOpts is string-only), but parsing >> string-only via 2 is no different than the result achieved from parsing >> strongly-typed with string fallback via 3. >> >> I still don't buy the fact that we need a string-only parser at the >> moment, but it would not be hard to change the 'bool autocast' into a >> tri-state enum, and then make the implementation specifically honor 1, >> 2, or 3 based on the enum value. > > FYI, I just copied you on a patch that enables us to easily support > all 3 options. Yours achieves that by having three separate constructors, instead of one constructor with a tri-state enum parameter. Either approach works; Markus, do you have any opinions on which looks nicer? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
