[PATCH v3 00/30] qapi/qom: QAPIfy --object and object-add
Markus Armbruster
armbru at redhat.com
Thu Mar 11 14:08:12 UTC 2021
Paolo Bonzini <pbonzini at redhat.com> writes:
> On 11/03/21 11:38, Markus Armbruster wrote:
>> Here's a differently terrible hack. We have
>> keyval_parse() visitor
>> optarg --------> QObject --------> QAPI type
>> Idea: hack the QObject. If we're working for -object, and QObject
>> maps
>> key "qom-type" to value "memory-backend-ram", get the value of
>> host-nodes, and if it's a string, parse it into a list like the opts
>> visitor does, and put that back, replacing the string value.
>> Same for other uses of Memdev and NumaNodeOptions with -object, if
>> they
>> exist.
>
> This doesn't help with backwards compatibility, since keyval loses the
> first of host-nodes=0,host-nodes=4.
You're right, I missed the fact that we rely on both hacks working
together for the full syntax.
> I would rather keep the OptsVisitor here. Do the same check for JSON
> syntax that you have in qobject_input_visitor_new_str, and whenever
> you need to walk all -object arguments, use something like this:
>
> typedef struct ObjectArgument {
> const char *id;
> QDict *json; /* or NULL for QemuOpts */
> QSIMPLEQ_ENTRY(ObjectArgument) next;
> }
>
> I already had patches in my queue to store -object in a GSList of
> dictionaries, changing it to use the above is easy enough.
I think I'd prefer following -display's precedence. See my reply to
Kevin for details.
More information about the libvir-list
mailing list