render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
0a7476
From 7b795534a39ad44d93ff1864ed98071c1f5bf6af Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <7b795534a39ad44d93ff1864ed98071c1f5bf6af@dist-git>
0a7476
From: Michal Privoznik <mprivozn@redhat.com>
0a7476
Date: Thu, 11 Apr 2019 15:14:18 -0400
0a7476
Subject: [PATCH] qemu_hotplug: Attach guestfwd using netdev_add
0a7476
0a7476
https://bugzilla.redhat.com/show_bug.cgi?id=1624204
0a7476
0a7476
The guestfwd channels are -netdevs really. Hotplug them as such.
0a7476
0a7476
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
Reviewed-by: John Ferlan <jferlan@redhat.com>
0a7476
(cherry picked from commit 903315dc8ffeb2af651207f090a53526decabc92)
0a7476
0a7476
Partially-Resolves: https://bugzilla.redhat.com/1658198
0a7476
Signed-off-by: Laine Stump <laine@redhat.com>
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
Message-Id: <20190411191453.24055-7-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 20 +++++++++++++++-----
0a7476
 1 file changed, 15 insertions(+), 5 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index 46cafef4c2..680c06c1ed 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -1753,10 +1753,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
0a7476
     char *tlsAlias = NULL;
0a7476
     const char *secAlias = NULL;
0a7476
     bool need_release = false;
0a7476
+    bool guestfwd = false;
0a7476
 
0a7476
-    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
0a7476
-        qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0)
0a7476
-        goto cleanup;
0a7476
+    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) {
0a7476
+        guestfwd = chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD;
0a7476
+
0a7476
+        if (qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0)
0a7476
+            goto cleanup;
0a7476
+    }
0a7476
 
0a7476
     if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0)
0a7476
         goto cleanup;
0a7476
@@ -1798,8 +1802,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
0a7476
         goto exit_monitor;
0a7476
     chardevAttached = true;
0a7476
 
0a7476
-    if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
0a7476
-        goto exit_monitor;
0a7476
+    if (guestfwd) {
0a7476
+        if (qemuMonitorAddNetdev(priv->mon, devstr,
0a7476
+                                 NULL, NULL, 0, NULL, NULL, 0) < 0)
0a7476
+            goto exit_monitor;
0a7476
+    } else {
0a7476
+        if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
0a7476
+            goto exit_monitor;
0a7476
+    }
0a7476
 
0a7476
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
0a7476
         goto audit;
0a7476
-- 
0a7476
2.21.0
0a7476