|
|
99cbc7 |
From 7f3efe3ed7d9f6e83323f62ffd020d9762c2fef0 Mon Sep 17 00:00:00 2001
|
|
|
99cbc7 |
Message-Id: <7f3efe3ed7d9f6e83323f62ffd020d9762c2fef0@dist-git>
|
|
|
99cbc7 |
From: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
Date: Thu, 11 Apr 2019 15:14:52 -0400
|
|
|
99cbc7 |
Subject: [PATCH] qemu_hotplug: don't shutdown net device until the guest has
|
|
|
99cbc7 |
released it
|
|
|
99cbc7 |
|
|
|
99cbc7 |
For [some unknown reason, possibly/probably pure chance], Net devices
|
|
|
99cbc7 |
have been taken offline and their bandwidth tc rules cleared as the
|
|
|
99cbc7 |
very first operation when detaching the device. This is contrary to
|
|
|
99cbc7 |
every other type of device, where all hostside teardown is delayed
|
|
|
99cbc7 |
until we receive the DEVICE_DELETED event back from qemu, indicating
|
|
|
99cbc7 |
that the guest has finished with the device.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
This patch delays these two operations until receipt of
|
|
|
99cbc7 |
DEVICE_DELETED, which removes an ugly wart from
|
|
|
99cbc7 |
qemuDomainDetachDeviceLive(), and also seems to be a more correct
|
|
|
99cbc7 |
sequence of events.
|
|
|
99cbc7 |
|
|
|
99cbc7 |
Signed-off-by: Laine Stump <laine@laine.org>
|
|
|
99cbc7 |
ACKed-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
99cbc7 |
(cherry picked from commit 34086fc59e7c59148409d6780176e84d0f1dbfb4)
|
|
|
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-41-laine@redhat.com>
|
|
|
99cbc7 |
Acked-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
99cbc7 |
---
|
|
|
99cbc7 |
src/qemu/qemu_hotplug.c | 50 +++++++++--------------------------------
|
|
|
99cbc7 |
1 file changed, 11 insertions(+), 39 deletions(-)
|
|
|
99cbc7 |
|
|
|
99cbc7 |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
index 27d09d173b..ff88a827dd 100644
|
|
|
99cbc7 |
--- a/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
99cbc7 |
@@ -4287,6 +4287,17 @@ qemuDomainRemoveNetDevice(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
!(charDevAlias = qemuAliasChardevFromDevAlias(net->info.alias)))
|
|
|
99cbc7 |
goto cleanup;
|
|
|
99cbc7 |
|
|
|
99cbc7 |
+ if (virDomainNetGetActualBandwidth(net) &&
|
|
|
99cbc7 |
+ virNetDevSupportBandwidth(virDomainNetGetActualType(net)) &&
|
|
|
99cbc7 |
+ virNetDevBandwidthClear(net->ifname) < 0)
|
|
|
99cbc7 |
+ VIR_WARN("cannot clear bandwidth setting for device : %s",
|
|
|
99cbc7 |
+ net->ifname);
|
|
|
99cbc7 |
+
|
|
|
99cbc7 |
+ /* deactivate the tap/macvtap device on the host, which could also
|
|
|
99cbc7 |
+ * affect the parent device (e.g. macvtap passthrough mode sets
|
|
|
99cbc7 |
+ * the parent device offline)
|
|
|
99cbc7 |
+ */
|
|
|
99cbc7 |
+ ignore_value(qemuInterfaceStopDevice(net));
|
|
|
99cbc7 |
|
|
|
99cbc7 |
qemuDomainObjEnterMonitor(driver, vm);
|
|
|
99cbc7 |
if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
|
|
|
99cbc7 |
@@ -5249,34 +5260,6 @@ qemuDomainDetachPrepNet(virDomainObjPtr vm,
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
|
|
|
99cbc7 |
-static void
|
|
|
99cbc7 |
-qemuDomainDetachShutdownNet(virDomainNetDefPtr net)
|
|
|
99cbc7 |
-{
|
|
|
99cbc7 |
-/*
|
|
|
99cbc7 |
- * These operations are in a separate function from
|
|
|
99cbc7 |
- * qemuDomainDetachPrepNet() because they can't be done until after
|
|
|
99cbc7 |
- * we've validated that this device really can be removed - in
|
|
|
99cbc7 |
- * particular we need to check for multifunction PCI devices and
|
|
|
99cbc7 |
- * presence of a device alias, which isn't done until *after* the
|
|
|
99cbc7 |
- * return from qemuDomainDetachPrepNet(). Since we've already passed
|
|
|
99cbc7 |
- * the "point of no return", we ignore any errors, and trudge ahead
|
|
|
99cbc7 |
- * with shutting down and detaching the device even if there is an
|
|
|
99cbc7 |
- * error in one of these functions.
|
|
|
99cbc7 |
- */
|
|
|
99cbc7 |
- if (virDomainNetGetActualBandwidth(net) &&
|
|
|
99cbc7 |
- virNetDevSupportBandwidth(virDomainNetGetActualType(net)) &&
|
|
|
99cbc7 |
- virNetDevBandwidthClear(net->ifname) < 0)
|
|
|
99cbc7 |
- VIR_WARN("cannot clear bandwidth setting for device : %s",
|
|
|
99cbc7 |
- net->ifname);
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
- /* deactivate the tap/macvtap device on the host, which could also
|
|
|
99cbc7 |
- * affect the parent device (e.g. macvtap passthrough mode sets
|
|
|
99cbc7 |
- * the parent device offline)
|
|
|
99cbc7 |
- */
|
|
|
99cbc7 |
- ignore_value(qemuInterfaceStopDevice(net));
|
|
|
99cbc7 |
-}
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
static int
|
|
|
99cbc7 |
qemuDomainDetachDeviceChr(virQEMUDriverPtr driver,
|
|
|
99cbc7 |
virDomainObjPtr vm,
|
|
|
99cbc7 |
@@ -5607,17 +5590,6 @@ qemuDomainDetachDeviceLive(virDomainObjPtr vm,
|
|
|
99cbc7 |
return -1;
|
|
|
99cbc7 |
}
|
|
|
99cbc7 |
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
- /*
|
|
|
99cbc7 |
- * Do any device-specific shutdown that should be
|
|
|
99cbc7 |
- * done after all validation checks, but before issuing the qemu
|
|
|
99cbc7 |
- * command to delete the device. For now, the only type of device
|
|
|
99cbc7 |
- * that has such shutdown needs is the net device.
|
|
|
99cbc7 |
- */
|
|
|
99cbc7 |
- if (detach.type == VIR_DOMAIN_DEVICE_NET)
|
|
|
99cbc7 |
- qemuDomainDetachShutdownNet(detach.data.net);
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
-
|
|
|
99cbc7 |
/*
|
|
|
99cbc7 |
* Issue the qemu monitor command to delete the device (based on
|
|
|
99cbc7 |
* its alias), and optionally wait a short time in case the
|
|
|
99cbc7 |
--
|
|
|
99cbc7 |
2.21.0
|
|
|
99cbc7 |
|