libvirt/SOURCES/libvirt-conf-during-PCI-hotplug-require-that-the-controller-support-hotplug.patch
2021-09-10 11:58:15 +00:00

48 lines
1.7 KiB
Diff

From 5ec240811e391f97378d0b6b726e0dee13ae8a40 Mon Sep 17 00:00:00 2001
Message-Id: <5ec240811e391f97378d0b6b726e0dee13ae8a40@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Sun, 26 Apr 2020 13:17:03 -0400
Subject: [PATCH] conf: during PCI hotplug, require that the controller support
hotplug
Before this patch we would simply rely on QEMU failing to attach the
device. Since we have a flag in the address set telling us which
controllers support hotplug, we can fail the operation sooner.
This also assures that when hotplugging with no provided PCI address,
that we skip any controllers with hotplug='off', and attempt to assign
the device to a controller that not only supports hotplug, but also
has it enabled.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 7118bdee1550b6022e7362402ca8204add4cf80b)
https://bugzilla.redhat.com/1802592
Signed-off-by: Laine Stump <laine@redhat.com>
Message-Id: <20200426171703.18808-3-laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_addr.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index ed41eca114..34ea7bc051 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -936,6 +936,11 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
if (!flags)
return 0;
+ /* This function is only called during hotplug, so we require hotplug
+ * support from the controller.
+ */
+ flags |= VIR_PCI_CONNECT_HOTPLUGGABLE;
+
if (!(addrStr = virPCIDeviceAddressAsString(&dev->addr.pci)))
goto cleanup;
--
2.26.2