render / rpms / libvirt

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