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