On 03/07/2016 08:06 AM, Daniel P. Berrange wrote:

> So looking at the current usage of qdict_flatten,  qdict_extract_subqdict,
> qdict_array_split and qdict_array_entries, it is basically only the block
> layer.
> 
> The root cause of this usage all stems from that fact that historically
> the block layer was driven off QemuOpts CLI args which are a flat data
> structure. Over time we've tried to bolt on recursive data structure
> support, but the main APIs are still accepting QDicts whose contents are
> flat. Increasingly I see the internal code is based on QAPI which is an
> inherantly nested data structure, as a result the block layer is getting
> more & more places where it has to process the flat data structure to
> extract nested bits (qdict_extract_subqdict, qdict_array_entries and
> qdict_array_split). Conversely when fed data coming from QMP it has to
> flatten the data structure with qdict_flatten.
> 
> With this new qdict_crumple() method (or equivalently you qdict_unflatten)
> it strikes me we can significantly simplify the block layer to always use
> a nested QDict internally. All that would be required is to call the
> qdict_crumple() method in the places which have the flat QemuOpts derived
> QDict. At that point we would potentially be able to delete all of
> qdict_flatten, qdict_extract_subqdict, qdict_array_split and
> qdict_array_entries
> 
> Of course I'm not suggesting we do that for 2.6, but it actually doesn't
> look like it would be that hard todo this conversion.

Agreed that it's too late for 2.6, but would make a good project for
2.7.  For that matter, rather than passing a QDict around, I'd like to
see if we could just directly use the QAPI types instead (the way you
just recently converted from QDict to SocketAddress).

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