|
|
6ae9ed |
From fef66972e7387805fbcdf42695b9b25d0c4f4630 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <fef66972e7387805fbcdf42695b9b25d0c4f4630@dist-git>
|
|
|
6ae9ed |
From: Laine Stump <laine@laine.org>
|
|
|
6ae9ed |
Date: Wed, 10 Aug 2016 11:00:11 -0400
|
|
|
6ae9ed |
Subject: [PATCH] conf: improve error log when PCI devices don't match
|
|
|
6ae9ed |
requested controller
|
|
|
6ae9ed |
|
|
|
6ae9ed |
The virDomainPCIAddressFlagsCompatible() error logs report that a
|
|
|
6ae9ed |
device required a controller that accepted standard PCI endpoint
|
|
|
6ae9ed |
devices, or PCI Express endpoint devices, and if hotplug was required
|
|
|
6ae9ed |
by the configuration but not provided by the selected controller. But
|
|
|
6ae9ed |
the wording of the error messages was apparently confusing (according
|
|
|
6ae9ed |
to the bugzilla report referenced below). On top of that, if the
|
|
|
6ae9ed |
device was something other than an endpoint device (e.g. a
|
|
|
6ae9ed |
pcie-switch-downstream-port) the error message was a complete punt -
|
|
|
6ae9ed |
it would just say that the flags were incorrect.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
This patch makes the messages for PCI/PCIe endpoint and hotplug
|
|
|
6ae9ed |
requirements more clear, and also specifically indicates what was the
|
|
|
6ae9ed |
device type when it is other than an endpoint device.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1363627
|
|
|
6ae9ed |
(cherry picked from commit 10031fe5f218fe0acbf873a3063ce42a02fa83d9)
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/conf/domain_addr.c | 58 ++++++++++++++++++++++++++++----------------------
|
|
|
6ae9ed |
1 file changed, 33 insertions(+), 25 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
|
|
|
6ae9ed |
index c3469ee..61c4074 100644
|
|
|
6ae9ed |
--- a/src/conf/domain_addr.c
|
|
|
6ae9ed |
+++ b/src/conf/domain_addr.c
|
|
|
6ae9ed |
@@ -118,38 +118,46 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
|
|
6ae9ed |
* hot-plug and this bus doesn't have it, return false.
|
|
|
6ae9ed |
*/
|
|
|
6ae9ed |
if (!(devFlags & busFlags & VIR_PCI_CONNECT_TYPES_MASK)) {
|
|
|
6ae9ed |
- if (reportError) {
|
|
|
6ae9ed |
- if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_DEVICE) {
|
|
|
6ae9ed |
- virReportError(errType,
|
|
|
6ae9ed |
- _("PCI bus is not compatible with the device "
|
|
|
6ae9ed |
- "at %s. Device requires a standard PCI slot, "
|
|
|
6ae9ed |
- "which is not provided by bus %.4x:%.2x"),
|
|
|
6ae9ed |
- addrStr, addr->domain, addr->bus);
|
|
|
6ae9ed |
- } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) {
|
|
|
6ae9ed |
- virReportError(errType,
|
|
|
6ae9ed |
- _("PCI bus is not compatible with the device "
|
|
|
6ae9ed |
- "at %s. Device requires a PCI Express slot, "
|
|
|
6ae9ed |
- "which is not provided by bus %.4x:%.2x"),
|
|
|
6ae9ed |
- addrStr, addr->domain, addr->bus);
|
|
|
6ae9ed |
- } else {
|
|
|
6ae9ed |
- /* this should never happen. If it does, there is a
|
|
|
6ae9ed |
- * bug in the code that sets the flag bits for devices.
|
|
|
6ae9ed |
- */
|
|
|
6ae9ed |
- virReportError(errType,
|
|
|
6ae9ed |
- _("The device information for %s has no PCI "
|
|
|
6ae9ed |
- "connection types listed"), addrStr);
|
|
|
6ae9ed |
- }
|
|
|
6ae9ed |
+ const char *connectStr;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (!reportError)
|
|
|
6ae9ed |
+ return false;
|
|
|
6ae9ed |
+
|
|
|
6ae9ed |
+ if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_DEVICE) {
|
|
|
6ae9ed |
+ connectStr = "standard PCI device";
|
|
|
6ae9ed |
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) {
|
|
|
6ae9ed |
+ connectStr = "PCI Express device";
|
|
|
6ae9ed |
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT) {
|
|
|
6ae9ed |
+ connectStr = "pcie-root-port";
|
|
|
6ae9ed |
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT) {
|
|
|
6ae9ed |
+ connectStr = "pci-switch-upstream-port";
|
|
|
6ae9ed |
+ } else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT) {
|
|
|
6ae9ed |
+ connectStr = "pci-switch-downstream-port";
|
|
|
6ae9ed |
+ } else {
|
|
|
6ae9ed |
+ /* this should never happen. If it does, there is a
|
|
|
6ae9ed |
+ * bug in the code that sets the flag bits for devices.
|
|
|
6ae9ed |
+ */
|
|
|
6ae9ed |
+ virReportError(errType,
|
|
|
6ae9ed |
+ _("The device at PCI address %s has "
|
|
|
6ae9ed |
+ "unrecognized connection type flags 0x%.2x"),
|
|
|
6ae9ed |
+ addrStr, devFlags & VIR_PCI_CONNECT_TYPES_MASK);
|
|
|
6ae9ed |
+ return false;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
+ virReportError(errType,
|
|
|
6ae9ed |
+ _("The device at PCI address %s cannot be "
|
|
|
6ae9ed |
+ "plugged into the PCI controller with index='%d'. "
|
|
|
6ae9ed |
+ "It requires a controller that accepts a %s."),
|
|
|
6ae9ed |
+ addrStr, addr->bus, connectStr);
|
|
|
6ae9ed |
return false;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
|
|
|
6ae9ed |
!(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
|
|
|
6ae9ed |
if (reportError) {
|
|
|
6ae9ed |
virReportError(errType,
|
|
|
6ae9ed |
- _("PCI bus is not compatible with the device "
|
|
|
6ae9ed |
- "at %s. Device requires hot-plug capability, "
|
|
|
6ae9ed |
- "which is not provided by bus %.4x:%.2x"),
|
|
|
6ae9ed |
- addrStr, addr->domain, addr->bus);
|
|
|
6ae9ed |
+ _("The device at PCI address %s requires "
|
|
|
6ae9ed |
+ "hotplug capability, but the PCI controller "
|
|
|
6ae9ed |
+ "with index='%d' doesn't support hotplug"),
|
|
|
6ae9ed |
+ addrStr, addr->bus);
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
return false;
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|