[PATCH 16/21] qemuBuildChannelGuestfwdNetdevProps: Convert to generating JSON props
Eric Blake
eblake at redhat.com
Mon May 18 15:35:47 UTC 2020
On 5/15/20 10:28 AM, Peter Krempa wrote:
> Syntax of guestfwd channel also needs to be modified to conform to the
> QAPI schema.
>
> Signed-off-by: Peter Krempa <pkrempa at redhat.com>
> ---
> src/qemu/qemu_command.c | 37 +++++++++++++++++++++++++++++++------
> src/qemu/qemu_command.h | 2 +-
> src/qemu/qemu_hotplug.c | 6 +++++-
> 3 files changed, 37 insertions(+), 8 deletions(-)
>
>
> - port = virSocketAddrGetPort(chr->target.addr);
> + /* this may seem weird, but qemu indeed decided that 'guestfwd' parameter
> + * is an array of objects which have just one member named 'str' which
> + * contains the description */
> + if (virJSONValueObjectAppendStringPrintf(guestfwdstrobj, "str",
> + "tcp:%s:%i-chardev:char%s",
> + addr,
> + virSocketAddrGetPort(chr->target.addr),
> + chr->info.alias) < 0)
> + return NULL;
If we were designing the netdev QMP from scratch, it would be an object
with multiple components rather than a single string that has to be
subsequently parsed. But in the meantime, yes, this looks like you are
properly handling existing quirks correctly.
Reviewed-by: Eric Blake <eblake at redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
More information about the libvir-list
mailing list