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

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