Eric Blake <ebl...@redhat.com> writes: > On 08/10/2017 07:25 AM, Markus Armbruster wrote: >> We've wanted -object to support non-scalar properties for a while. >> Dan Berrange tried in "[PATCH v4 00/10]Provide a QOM-based >> authorization API". Review led to the conclusion that we need to >> replace rather than add to QemuOpts. Initial work towards that goal >> has been merged to provide -blockdev (commit 8746709), but there's >> substantial work left, mostly due to an bewildering array of >> compatibility problems. >> >> Even if a full solution is still out of reach, we can have a partial >> solution now: accept -object argument in JSON syntax. This should >> unblock development work that needs non-scalar properties with -object >> > > Trailing dot?
Will fix. >> The implementation is similar to -blockdev, except we use the new >> infrastructure only for the new JSON case, and stick to QemuOpts for >> the existing KEY=VALUE,... case, to sidestep compatibility problems. >> >> If we did this for more options, we'd have to factor out common code. >> But for one option, this will do. >> >> Signed-off-by: Markus Armbruster <arm...@redhat.com> >> --- >> qapi-schema.json | 14 +++++++++++--- >> vl.c | 55 >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 66 insertions(+), 3 deletions(-) >> > > 2.11 material. Yes. >> @@ -4078,6 +4102,29 @@ int main(int argc, char **argv, char **envp) >> #endif >> break; >> case QEMU_OPTION_object: >> + /* >> + * TODO Use qobject_input_visitor_new_str() instead of >> + * QemuOpts, not in addition to. Not done now because >> + * keyval_parse() isn't wart-compatible with QemuOpts. >> + */ >> + if (optarg[0] == '{') { > > So we DON'T allow " {...}", even though that is valid JSON. I'm okay > with stating that { is magic only as the first byte. Consistent with -blockdev. Can improve later, if we want to. > Reviewed-by: Eric Blake <ebl...@redhat.com> > > Do we need any documentation additions (whether in --help output, or in > the man page, or ?) Let's not advertise this just yet. It's mostly so that Manos can make progress while we work on the full solution (he wants to use -object for throttle filters, and needs non-scalar properties).