QObject *obj;
Visitor *v = qobject_output_visitor_new(&obj);
QDict *qdict;
+ const QDictEntry *ent;
Error *local_err = NULL;
visit_type_BlockdevOptions(v, NULL, &options, &local_err);
qdict_flatten(qdict);
+ /*
+ * Rewrite "backing": null to "backing": ""
+ * TODO Rewrite "" to null instead, and perhaps not even here
+ */
+ for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) {
+ char *dot = strrchr(ent->key, '.');
+
+ if (!strcmp(dot ? dot + 1 : ent->key, "backing")
+ && qobject_type(ent->value) == QTYPE_QNULL) {
+ qdict_put(qdict, ent->key, qstring_new());
+ }
+ }
+
if (!qdict_get_try_str(qdict, "node-name")) {
error_setg(errp, "'node-name' must be specified for the root node");
goto fail;