|
From: | Paolo Bonzini |
Subject: | Re: [PATCH v3 00/30] qapi/qom: QAPIfy --object and object-add |
Date: | Thu, 11 Mar 2021 12:00:12 +0100 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 |
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.
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.
Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |