render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
c480ed
From c120b5738e38dfa06bcd958d65c18308cab977b2 Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <c120b5738e38dfa06bcd958d65c18308cab977b2@dist-git>
c480ed
From: Michal Privoznik <mprivozn@redhat.com>
c480ed
Date: Thu, 27 Jun 2019 14:44:46 +0200
c480ed
Subject: [PATCH] qemu_hotplug: Attach guestfwd using netdev_add
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1624204
c480ed
c480ed
The guestfwd channels are -netdevs really. Hotplug them as such.
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Reviewed-by: John Ferlan <jferlan@redhat.com>
c480ed
(cherry picked from commit 903315dc8ffeb2af651207f090a53526decabc92)
c480ed
c480ed
https://bugzilla.redhat.com/show_bug.cgi?id=1624204
c480ed
c480ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c480ed
Message-Id: <16a7ca67708755fe216f78295c56eae44275f5b1.1561639408.git.mprivozn@redhat.com>
c480ed
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
c480ed
---
c480ed
 src/qemu/qemu_hotplug.c | 20 +++++++++++++++-----
c480ed
 1 file changed, 15 insertions(+), 5 deletions(-)
c480ed
c480ed
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c480ed
index da9d56ffb1..468389fa7a 100644
c480ed
--- a/src/qemu/qemu_hotplug.c
c480ed
+++ b/src/qemu/qemu_hotplug.c
c480ed
@@ -1864,10 +1864,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
c480ed
     char *tlsAlias = NULL;
c480ed
     const char *secAlias = NULL;
c480ed
     bool need_release = false;
c480ed
+    bool guestfwd = false;
c480ed
 
c480ed
-    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
c480ed
-        qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0)
c480ed
-        goto cleanup;
c480ed
+    if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) {
c480ed
+        guestfwd = chr->targetType == VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD;
c480ed
+
c480ed
+        if (qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0)
c480ed
+            goto cleanup;
c480ed
+    }
c480ed
 
c480ed
     if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0)
c480ed
         goto cleanup;
c480ed
@@ -1909,8 +1913,14 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
c480ed
         goto exit_monitor;
c480ed
     chardevAttached = true;
c480ed
 
c480ed
-    if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
c480ed
-        goto exit_monitor;
c480ed
+    if (guestfwd) {
c480ed
+        if (qemuMonitorAddNetdev(priv->mon, devstr,
c480ed
+                                 NULL, NULL, 0, NULL, NULL, 0) < 0)
c480ed
+            goto exit_monitor;
c480ed
+    } else {
c480ed
+        if (qemuMonitorAddDevice(priv->mon, devstr) < 0)
c480ed
+            goto exit_monitor;
c480ed
+    }
c480ed
 
c480ed
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
c480ed
         goto audit;
c480ed
-- 
c480ed
2.22.0
c480ed