render / rpms / libvirt

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