Blame SOURCES/libvirt-qemu_hotplug-eliminate-unnecessary-call-to-qemuDomainDetachNetDevice.patch

0a7476
From 7a533f8dbc018411d53eb4436cfc584b070c232b Mon Sep 17 00:00:00 2001
0a7476
Message-Id: <7a533f8dbc018411d53eb4436cfc584b070c232b@dist-git>
0a7476
From: Laine Stump <laine@laine.org>
0a7476
Date: Thu, 11 Apr 2019 15:14:33 -0400
0a7476
Subject: [PATCH] qemu_hotplug: eliminate unnecessary call to
0a7476
 qemuDomainDetachNetDevice()
0a7476
0a7476
qemuDomainDetachHostDevice() has a check at the end that calls
0a7476
qemuDomainDetachNetDevice() in the case that the hostdev is actually a
0a7476
Net device of type='hostdev'. A long time ago when device removal was
0a7476
(supposedly but not actually) synchronous, this would cause some extra
0a7476
code to be run prior to removing the device (e.g. restoring the original MAC
0a7476
address of the device, undoing some sort of virtual port profile, etc).
0a7476
0a7476
For quite awhile now the device removal has been asynchronous, so that
0a7476
"extra teardown" isn't handled by the detach function, but instead is
0a7476
handled by the Remove function called at a later time. The result is
0a7476
that when we call qemuDomainDetachNetDevice() from
0a7476
qemuDomainDetachHostDevice(), it ends up just calling
0a7476
qemuDomainDetachThisHostDevice() and returning, which is exactly what
0a7476
we do for all other hostdevs anyway.
0a7476
0a7476
Based on that, remove the behavioral difference when parent.type ==
0a7476
VIR_DOMAIN_DEVICE_NET, and just call qemuDomainDetachThisHostDevice()
0a7476
for all hostdevs.
0a7476
0a7476
Signed-off-by: Laine Stump <laine@laine.org>
0a7476
ACKed-by: Peter Krempa <pkrempa@redhat.com>
0a7476
(cherry picked from commit 1ed46f3a22fe8570b4237477de5d5adb5a05f455)
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-22-laine@redhat.com>
0a7476
Acked-by: Michal Privoznik <mprivozn@redhat.com>
0a7476
---
0a7476
 src/qemu/qemu_hotplug.c | 8 +-------
0a7476
 1 file changed, 1 insertion(+), 7 deletions(-)
0a7476
0a7476
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
0a7476
index b6fcaadd55..0ae944475e 100644
0a7476
--- a/src/qemu/qemu_hotplug.c
0a7476
+++ b/src/qemu/qemu_hotplug.c
0a7476
@@ -5085,13 +5085,7 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr driver,
0a7476
         return -1;
0a7476
     }
0a7476
 
0a7476
-    /* If this is a network hostdev, we need to use the higher-level detach
0a7476
-     * function so that mac address / virtualport are reset
0a7476
-     */
0a7476
-    if (detach->parent.type == VIR_DOMAIN_DEVICE_NET)
0a7476
-        return qemuDomainDetachNetDevice(driver, vm, &detach->parent, async);
0a7476
-    else
0a7476
-        return qemuDomainDetachThisHostDevice(driver, vm, detach, async);
0a7476
+    return qemuDomainDetachThisHostDevice(driver, vm, detach, async);
0a7476
 }
0a7476
 
0a7476
 
0a7476
-- 
0a7476
2.21.0
0a7476