qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH v14 13/21] qdict: allow qdict_crump


From: Eric Blake
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v14 13/21] qdict: allow qdict_crumple to accept compound types as values
Date: Wed, 19 Oct 2016 08:31:28 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]