mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
qemu: Validate PCI controller options (chassis and port)
https://bugzilla.redhat.com/show_bug.cgi?id=1483816 Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Laine Stump <laine@laine.org>
This commit is contained in:
parent
6fef5bf301
commit
97727e060c
@ -4320,12 +4320,6 @@ qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef *contro
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
|
||||
if (pciopts->chassis == -1 || pciopts->port == -1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("autogenerated pcie-root-port options not set"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_IOH3420) &&
|
||||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_IOH3420)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@ -4355,13 +4349,6 @@ qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef *contro
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
|
||||
if (pciopts->chassis == -1 || pciopts->port == -1) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("autogenerated pcie-switch-downstream-port "
|
||||
"options not set"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_XIO3130_DOWNSTREAM)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("The pcie-switch-downstream-port "
|
||||
@ -4791,6 +4778,43 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* chassis and port */
|
||||
switch ((virDomainControllerModelPCI) cont->model) {
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_PORT:
|
||||
if (pciopts->chassis == -1) {
|
||||
virReportControllerMissingOption(cont, model, modelName, "chassis");
|
||||
return -1;
|
||||
}
|
||||
if (pciopts->port == -1) {
|
||||
virReportControllerMissingOption(cont, model, modelName, "port");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_EXPANDER_BUS:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_EXPANDER_BUS:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
|
||||
if (pciopts->chassis != -1) {
|
||||
virReportControllerInvalidOption(cont, model, modelName, "chassis");
|
||||
return -1;
|
||||
}
|
||||
if (pciopts->port != -1) {
|
||||
virReportControllerInvalidOption(cont, model, modelName, "port");
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
|
||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
|
||||
default:
|
||||
virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
|
||||
}
|
||||
|
||||
return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user