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? > 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. > @@ -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. Reviewed-by: Eric Blake <ebl...@redhat.com> Do we need any documentation additions (whether in --help output, or in the man page, or ?) -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature