Blame SOURCES/libvirt-conf-check-HOTPLUGGABLE-connect-flag-when-validating-a-PCI-address.patch

b971b8
From 28094095fe6e4b05b25e459a34d93d195b7afb62 Mon Sep 17 00:00:00 2001
b971b8
Message-Id: <28094095fe6e4b05b25e459a34d93d195b7afb62@dist-git>
b971b8
From: Laine Stump <laine@redhat.com>
b971b8
Date: Sun, 26 Apr 2020 13:17:02 -0400
b971b8
Subject: [PATCH] conf: check HOTPLUGGABLE connect flag when validating a PCI
b971b8
 address
b971b8
b971b8
The HOTPLUGGABLE flag is set for appropriates buses in a PCI address
b971b8
set, and thnis patch updates virDomainPCIAddressFlagsCompatible() to
b971b8
check the HOTPLUGGABLE flag when searching for a suitable bus/slot for
b971b8
a device. No devices request HOTPLUGGABLE though (yet), so there is no
b971b8
observable effect.
b971b8
b971b8
Signed-off-by: Laine Stump <laine@redhat.com>
b971b8
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
b971b8
(cherry picked from commit a283189f8c64882681ea99259ccfc8d1b8e524dd)
b971b8
b971b8
https://bugzilla.redhat.com/1802592
b971b8
Signed-off-by: Laine Stump <laine@redhat.com>
b971b8
Message-Id: <20200426171703.18808-2-laine@redhat.com>
b971b8
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
b971b8
---
b971b8
 src/conf/domain_addr.c | 12 ++++++++++++
b971b8
 1 file changed, 12 insertions(+)
b971b8
b971b8
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
b971b8
index cc45a0bbf1..ed41eca114 100644
b971b8
--- a/src/conf/domain_addr.c
b971b8
+++ b/src/conf/domain_addr.c
b971b8
@@ -376,6 +376,18 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
b971b8
         return false;
b971b8
     }
b971b8
 
b971b8
+    if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
b971b8
+        !(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
b971b8
+        if (reportError) {
b971b8
+            virReportError(errType,
b971b8
+                           _("The device at PCI address %s requires "
b971b8
+                             "hotplug capability, but the PCI controller "
b971b8
+                             "with index='%d' doesn't support hotplug"),
b971b8
+                           addrStr, addr->bus);
b971b8
+        }
b971b8
+        return false;
b971b8
+    }
b971b8
+
b971b8
     /* If this bus doesn't allow the type of connection (PCI
b971b8
      * vs. PCIe) required by the device, or if the device requires
b971b8
      * hot-plug and this bus doesn't have it, return false.
b971b8
-- 
b971b8
2.26.2
b971b8