On 10/18/2016 10:35 AM, Markus Armbruster wrote: >>>> But even if I realised that QemuOpts support this syntax, I think we >>>> would still have to use the dotted syntax because it's explicit about >>>> the index and we need that because the list can contains dicts. >>>> >>>> Compare this: >>>> >>>> driver=quorum, >>>> child.0.driver=file,child.0.filename=disk1.img, >>>> child.1.driver=host_device,child.1.filename=/dev/sdb, >>>> child.2.driver=nbd,child.2.host=localhost >>>> >>>> And this: >>>> >>>> driver=quorum, >>>> child.driver=file,child.filename=disk1.img, >>>> child.driver=host_device,child.filename=/dev/sdb, >>>> child.driver=nbd,child.host=localhost >>> >>> Aside: both are about equally illegible, to be honest.
Furthermore, both of these currently require really long command lines. Overnight, I was thinking about whether it would be worth improving QemuOpts to ignore whitespace after (unquoted) commas, so you can do: -drive 'driver=quorum, child.0.driver=file, child.0.filename=disk1.img, child.1.driver=host_device, child.1.filename=/dev/sdb, child.2.driver=nbd, child.2.host=localhost ' I think this one should be just fine - we don't have ANY keys that start with leading whitespace, so ignoring space will still let us parse out key names, but allow for much more legibility in the command lines. And this is true whether we use dotted notation... >>> If you'd rather invent syntax closer to QemuOpts than reuse JSON, you >>> could try >>> >>> driver=quorum, >>> child=[{ driver=file, filename=disk1.img }, >>> { driver=host_device, filename=/dev/sdb }, >>> { driver=nbd, host=localhost } ] >> >> This looks a lot more agreeable as something that I have to type on the >> command line. ...or new syntax (where of course the new syntax has already demonstrated that we want to support strategic ignoring of whitespace). So I'll probably propose a patch along those lines soon, as it seems like an orthogonal improvement. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature