[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple metho
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict |
Date: |
Fri, 19 Feb 2016 10:01:07 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
On 02/19/2016 09:47 AM, Daniel P. Berrange wrote:
> The qdict_flatten() method will take a dict whose elements are
> further nested dicts/lists and flatten them by concatenating
> keys.
>
> The qdict_crumple() method aims todo the reverse, taking a flat
s/todo/to do/
> qdict, and turning it into a set of nested dicts/lists. It will
> apply nesting based on the key name, with a '.' indicating a
> new level in the hierarchy. If the keys in the nested structure
> are all numeric, it will create a list, otherwise it will create
> a dict.
>
Interesting idea. I haven't closely reviewed the patch yet, but do have
a comment on the commit message:
>
> If the key is intended to contain a literal '.', then it must
> be escaped as '..'. ie a flat dict
Hmm. We forbid the use of '.' inside QAPI key names in most places, but
have an exception that downstream extensions use '.'. So, I guess the
only place you'd really use this is trying to target a
downstream-extension key name:
>
> {
> 'foo..bar': 'wizz',
> 'bar.foo..bar': 'eek',
as in '__com..example_bar': 'eek' to set the downstream key-name of
'__com.example_bar'. I'm not sure the special casing of '.' is worth
it, particularly since qdict_flatten() doesn't have it in the reverse
direction.
> The intent of this function is that it allows a set of QemuOpts
> to be turned into a nested data structure that mirrors the nested
> used when the same object is defined over QMP.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
I hope to offer a more detailed review next week (I'm trying to get some
of my own patches polished today).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v1 00/10] Provide a QOM-based authorization API, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict, Daniel P. Berrange, 2016/02/19
- Re: [Qemu-devel] [PATCH v1 01/10] qdict: implement a qdict_crumple method for un-flattening a dict,
Eric Blake <=
- [Qemu-devel] [PATCH v1 02/10] qapi: allow QmpInputVisitor to auto-cast types, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 04/10] util: add QAuthZ object as an authorization base class, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 03/10] qom: support arbitrary non-scalar properties with -object, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 07/10] qemu-nbd: add support for ACLs for TLS clients, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 06/10] acl: delete existing ACL implementation, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 08/10] nbd: allow an ACL to be set with nbd-server-start QMP command, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 09/10] chardev: add support for ACLs for TLS clients, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 05/10] util: add QAuthZSimple object type for a simple access control list, Daniel P. Berrange, 2016/02/19
- [Qemu-devel] [PATCH v1 10/10] vnc: allow specifying a custom ACL object name, Daniel P. Berrange, 2016/02/19