mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
conf: improve error log when PCI devices don't match requested controller
The virDomainPCIAddressFlagsCompatible() error logs report that a device required a controller that accepted standard PCI endpoint devices, or PCI Express endpoint devices, and if hotplug was required by the configuration but not provided by the selected controller. But the wording of the error messages was apparently confusing (according to the bugzilla report referenced below). On top of that, if the device was something other than an endpoint device (e.g. a pcie-switch-downstream-port) the error message was a complete punt - it would just say that the flags were incorrect. This patch makes the messages for PCI/PCIe endpoint and hotplug requirements more clear, and also specifically indicates what was the device type when it is other than an endpoint device. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1363627
This commit is contained in:
parent
4914494eb8
commit
10031fe5f2
@ -118,38 +118,46 @@ virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr,
|
|||||||
* hot-plug and this bus doesn't have it, return false.
|
* hot-plug and this bus doesn't have it, return false.
|
||||||
*/
|
*/
|
||||||
if (!(devFlags & busFlags & VIR_PCI_CONNECT_TYPES_MASK)) {
|
if (!(devFlags & busFlags & VIR_PCI_CONNECT_TYPES_MASK)) {
|
||||||
if (reportError) {
|
const char *connectStr;
|
||||||
|
|
||||||
|
if (!reportError)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_DEVICE) {
|
if (devFlags & VIR_PCI_CONNECT_TYPE_PCI_DEVICE) {
|
||||||
virReportError(errType,
|
connectStr = "standard PCI device";
|
||||||
_("PCI bus is not compatible with the device "
|
|
||||||
"at %s. Device requires a standard PCI slot, "
|
|
||||||
"which is not provided by bus %.4x:%.2x"),
|
|
||||||
addrStr, addr->domain, addr->bus);
|
|
||||||
} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) {
|
} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_DEVICE) {
|
||||||
virReportError(errType,
|
connectStr = "PCI Express device";
|
||||||
_("PCI bus is not compatible with the device "
|
} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT) {
|
||||||
"at %s. Device requires a PCI Express slot, "
|
connectStr = "pcie-root-port";
|
||||||
"which is not provided by bus %.4x:%.2x"),
|
} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT) {
|
||||||
addrStr, addr->domain, addr->bus);
|
connectStr = "pci-switch-upstream-port";
|
||||||
|
} else if (devFlags & VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT) {
|
||||||
|
connectStr = "pci-switch-downstream-port";
|
||||||
} else {
|
} else {
|
||||||
/* this should never happen. If it does, there is a
|
/* this should never happen. If it does, there is a
|
||||||
* bug in the code that sets the flag bits for devices.
|
* bug in the code that sets the flag bits for devices.
|
||||||
*/
|
*/
|
||||||
virReportError(errType,
|
virReportError(errType,
|
||||||
_("The device information for %s has no PCI "
|
_("The device at PCI address %s has "
|
||||||
"connection types listed"), addrStr);
|
"unrecognized connection type flags 0x%.2x"),
|
||||||
}
|
addrStr, devFlags & VIR_PCI_CONNECT_TYPES_MASK);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
virReportError(errType,
|
||||||
|
_("The device at PCI address %s cannot be "
|
||||||
|
"plugged into the PCI controller with index='%d'. "
|
||||||
|
"It requires a controller that accepts a %s."),
|
||||||
|
addrStr, addr->bus, connectStr);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
|
if ((devFlags & VIR_PCI_CONNECT_HOTPLUGGABLE) &&
|
||||||
!(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
|
!(busFlags & VIR_PCI_CONNECT_HOTPLUGGABLE)) {
|
||||||
if (reportError) {
|
if (reportError) {
|
||||||
virReportError(errType,
|
virReportError(errType,
|
||||||
_("PCI bus is not compatible with the device "
|
_("The device at PCI address %s requires "
|
||||||
"at %s. Device requires hot-plug capability, "
|
"hotplug capability, but the PCI controller "
|
||||||
"which is not provided by bus %.4x:%.2x"),
|
"with index='%d' doesn't support hotplug"),
|
||||||
addrStr, addr->domain, addr->bus);
|
addrStr, addr->bus);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user