|
|
43fe83 |
From 26ad7ab7a6c2b626d79bde63f9a5199d8ed9362a Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <26ad7ab7a6c2b626d79bde63f9a5199d8ed9362a.1382534061.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Laine Stump <laine@laine.org>
|
|
|
43fe83 |
Date: Mon, 21 Oct 2013 10:13:00 -0600
|
|
|
43fe83 |
Subject: [PATCH] qemu: fix removal of <interface type='hostdev'>
|
|
|
43fe83 |
|
|
|
43fe83 |
This patch (and the two patches that precede it) resolve:
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1005682
|
|
|
43fe83 |
|
|
|
43fe83 |
When libvirt was changed to delay the final cleanup of device removal
|
|
|
43fe83 |
until the qemu process had signaled it with a DEVICE_DELETED event for
|
|
|
43fe83 |
that device, the hostdev removal function
|
|
|
43fe83 |
(qemuDomainRemoveHostDevice()) was written to properly handle the
|
|
|
43fe83 |
removal of a hostdev that was actually an SRIOV virtual function
|
|
|
43fe83 |
(defined with <interface type='hostdev'>). However, the function used
|
|
|
43fe83 |
to search for a device matching the alias name provided in the
|
|
|
43fe83 |
DEVICE_DELETED message (virDomainDefFindDevice()) would search through
|
|
|
43fe83 |
the list of netdevs before hostdevs, so qemuDomainRemoveHostDevice()
|
|
|
43fe83 |
was never called; instead the netdev function,
|
|
|
43fe83 |
qemuDomainRemoveNetDevice() (which *doesn't* properly cleanup after
|
|
|
43fe83 |
removal of <interface type='hostdev'>), was called.
|
|
|
43fe83 |
|
|
|
43fe83 |
(As a reminder - each <interface type='hostdev'> results in a
|
|
|
43fe83 |
virDomainNetDef which contains a virDomainHostdevDef having a parent
|
|
|
43fe83 |
type of VIR_DOMAIN_DEVICE_NET, and parent.data.net pointing back to
|
|
|
43fe83 |
the virDomainNetDef; both Defs point to the same device info object
|
|
|
43fe83 |
(and the info contains the device's "alias", which is used by qemu to
|
|
|
43fe83 |
identify the device). The virDomainHostdevDef is added to the domain's
|
|
|
43fe83 |
hostdevs list *and* the virDomainNetDef is added to the domain's nets
|
|
|
43fe83 |
list, so searching either list for a particular alias will yield a
|
|
|
43fe83 |
positive result.)
|
|
|
43fe83 |
|
|
|
43fe83 |
This function modifies the qemuDomainRemoveNetDevice() to short
|
|
|
43fe83 |
circuit itself and call qemu DomainRemoveHostDevice() instead when the
|
|
|
43fe83 |
actual device is a VIR_DOMAIN_NET_TYPE_HOSTDEV (similar logic to what
|
|
|
43fe83 |
is done in the higher level qemuDomainDetachNetDevice())
|
|
|
43fe83 |
|
|
|
43fe83 |
Note that even if virDomainDefFindDevice() changes in the future so
|
|
|
43fe83 |
that it finds the hostdev entry first, the current code will continue
|
|
|
43fe83 |
to work properly.
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit 69e047ae214d92feea6e54dfe821b1498d0004a9)
|
|
|
43fe83 |
|
|
|
43fe83 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/qemu/qemu_hotplug.c | 6 ++++++
|
|
|
43fe83 |
1 file changed, 6 insertions(+)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
index 4d29e18..f87b893 100644
|
|
|
43fe83 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
43fe83 |
@@ -2471,6 +2471,12 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
|
|
43fe83 |
virDomainEventPtr event;
|
|
|
43fe83 |
size_t i;
|
|
|
43fe83 |
|
|
|
43fe83 |
+ if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
43fe83 |
+ /* this function handles all hostdev and netdev cleanup */
|
|
|
43fe83 |
+ qemuDomainRemoveHostDevice(driver, vm, virDomainNetGetActualHostdev(net));
|
|
|
43fe83 |
+ return;
|
|
|
43fe83 |
+ }
|
|
|
43fe83 |
+
|
|
|
43fe83 |
VIR_DEBUG("Removing network interface %s from domain %p %s",
|
|
|
43fe83 |
net->info.alias, vm, vm->def->name);
|
|
|
43fe83 |
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.4
|
|
|
43fe83 |
|