Re: [PATCH 16/21] qemuBuildChannelGuestfwdNetdevProps: Convert to generating JSON props

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
  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@xxxxxxxxxx>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux