|
|
b971b8 |
From f52197675b2babfafb1b89058e3fd01decebd8ab Mon Sep 17 00:00:00 2001
|
|
|
b971b8 |
Message-Id: <f52197675b2babfafb1b89058e3fd01decebd8ab@dist-git>
|
|
|
b971b8 |
From: Laine Stump <laine@redhat.com>
|
|
|
b971b8 |
Date: Sun, 26 Apr 2020 13:04:12 -0400
|
|
|
b971b8 |
Subject: [PATCH] conf: simplify logic when checking for AUTOASSIGN PCI
|
|
|
b971b8 |
addresses
|
|
|
b971b8 |
|
|
|
b971b8 |
Old behavior: If the address was manually provided by config, copy
|
|
|
b971b8 |
device AUTOASSIGN flag into the bus flag, and then later on in the
|
|
|
b971b8 |
function *always* check for a match of the flags (which will always
|
|
|
b971b8 |
match if the address came from config, since we just copied it).
|
|
|
b971b8 |
|
|
|
b971b8 |
New behavior: Don't mess with the bus flags - just directly check if
|
|
|
b971b8 |
the AUTOASSIGN flag matches in bus and dev, but only make the check if
|
|
|
b971b8 |
the address didn't come from config (i.e. it was auto-assigned by
|
|
|
b971b8 |
libvirt).
|
|
|
b971b8 |
|
|
|
b971b8 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
b971b8 |
(cherry picked from commit fcdf87d3ef14de9dfb0acaf4b4445e1580dfc629)
|
|
|
b971b8 |
|
|
|
b971b8 |
https://bugzilla.redhat.com/1802592
|
|
|
b971b8 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
b971b8 |
Message-Id: <20200426170415.18328-10-laine@redhat.com>
|
|
|
b971b8 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
b971b8 |
---
|
|
|
b971b8 |
src/conf/domain_addr.c | 27 ++++++++++-----------------
|
|
|
b971b8 |
1 file changed, 10 insertions(+), 17 deletions(-)
|
|
|
b971b8 |
|
|
|
b971b8 |
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
|
|
b971b8 |
index 53be6cd34b..05f036e3e6 100644
|
|
|
b971b8 |
--- a/src/conf/domain_addr.c
|
|
|
b971b8 |
+++ b/src/conf/domain_addr.c
|
|
|
b971b8 |
@@ -358,18 +358,22 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
|
|
b971b8 |
*/
|
|
|
b971b8 |
if (busFlags & VIR_PCI_CONNECT_TYPES_ENDPOINT)
|
|
|
b971b8 |
busFlags |= VIR_PCI_CONNECT_TYPES_ENDPOINT;
|
|
|
b971b8 |
- /* Also allow manual specification of bus to override
|
|
|
b971b8 |
- * libvirt's assumptions about whether or not hotplug
|
|
|
b971b8 |
- * capability will be required.
|
|
|
b971b8 |
- */
|
|
|
b971b8 |
- if (devFlags & VIR_PCI_CONNECT_AUTOASSIGN)
|
|
|
b971b8 |
- busFlags |= VIR_PCI_CONNECT_AUTOASSIGN;
|
|
|
b971b8 |
/* if the device is a pci-bridge, allow manually
|
|
|
b971b8 |
* assigning to any bus that would also accept a
|
|
|
b971b8 |
* standard PCI device.
|
|
|
b971b8 |
*/
|
|
|
b971b8 |
if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_BRIDGE)
|
|
|
b971b8 |
devFlags |= VIR_PCI_CONNECT_TYPE_PCI_DEVICE;
|
|
|
b971b8 |
+ } else if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
|
|
|
b971b8 |
+ !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
|
|
|
b971b8 |
+ if (reportError) {
|
|
|
b971b8 |
+ virReportError(errType,
|
|
|
b971b8 |
+ _("The device at PCI address %s was auto-assigned "
|
|
|
b971b8 |
+ "this address, but the PCI controller "
|
|
|
b971b8 |
+ "with index='%d' doesn't allow auto-assignment"),
|
|
|
b971b8 |
+ addrStr, addr->bus);
|
|
|
b971b8 |
+ }
|
|
|
b971b8 |
+ return false;
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
/* If this bus doesn't allow the type of connection (PCI
|
|
|
b971b8 |
@@ -419,17 +423,6 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
|
|
b971b8 |
addrStr, addr->bus, connectStr);
|
|
|
b971b8 |
return false;
|
|
|
b971b8 |
}
|
|
|
b971b8 |
- if ((devFlags & VIR_PCI_CONNECT_AUTOASSIGN) &&
|
|
|
b971b8 |
- !(busFlags & VIR_PCI_CONNECT_AUTOASSIGN)) {
|
|
|
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 |
return true;
|
|
|
b971b8 |
}
|
|
|
b971b8 |
|
|
|
b971b8 |
--
|
|
|
b971b8 |
2.26.2
|
|
|
b971b8 |
|