Markus Armbruster 2860b2b2cb block: Fix -blockdev / blockdev-add for empty objects and arrays
-blockdev and blockdev-add silently ignore empty objects and arrays in
their argument.  That's because qmp_blockdev_add() converts the
argument to a flat QDict, and qdict_flatten() eats empty QDict and
QList members.  For instance, we ignore an empty BlockdevOptions
member @cache.  No real harm, as absent means the same as empty there.

Thus, the flaw puts an artificial restriction on the QAPI schema: we
can't have potentially empty objects and arrays within
BlockdevOptions, except when they're optional and "empty" has the same
meaning as "absent".

Our QAPI schema satisfies this restriction (I checked), but it's a
trap for the unwary, and a temptation to employ awkward workarounds
for the wary.  Let's get rid of it.

Change qdict_flatten() and qdict_crumple() to treat empty dictionaries
and lists exactly like scalars.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2018-06-15 14:49:44 +02:00
..
2018-02-22 15:44:07 -08:00
2017-09-22 10:46:25 +08:00
2018-03-21 15:13:40 +01:00
2018-03-26 14:17:04 -07:00
2017-03-01 11:51:28 +04:00
2017-03-01 11:51:05 +04:00
2017-03-01 11:51:04 +04:00
2017-10-20 13:32:10 +02:00
2017-03-01 11:51:05 +04:00
2018-06-04 10:15:16 +01:00
2017-10-20 13:32:10 +02:00
2018-02-09 05:05:11 +01:00
2018-03-06 14:01:27 +01:00
2017-01-10 08:49:59 -08:00
2018-06-01 15:13:46 +02:00
2018-02-08 09:22:03 +08:00
2017-09-05 22:34:40 +02:00
2017-12-20 22:01:24 +08:00