mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-08 14:29:56 +00:00
qemu: Validate PCI controller options (chassisNr)
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
c651cdbce6
commit
6fef5bf301
@ -4290,12 +4290,6 @@ qemuDomainDeviceDefValidateControllerPCIOld(const virDomainControllerDef *contro
|
|||||||
/* Second pass - now the model specific checks */
|
/* Second pass - now the model specific checks */
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
|
||||||
if (pciopts->chassisNr == -1) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
||||||
_("autogenerated pci-bridge options not set"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) {
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_PCI_BRIDGE)) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
_("the pci-bridge controller is not supported "
|
_("the pci-bridge controller is not supported "
|
||||||
@ -4767,6 +4761,36 @@ qemuDomainDeviceDefValidateControllerPCI(const virDomainControllerDef *cont,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* chassisNr */
|
||||||
|
switch ((virDomainControllerModelPCI) cont->model) {
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
|
||||||
|
if (pciopts->chassisNr == -1) {
|
||||||
|
virReportControllerMissingOption(cont, model, modelName, "chassisNr");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_DMI_TO_PCI_BRIDGE:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT_PORT:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_UPSTREAM_PORT:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_SWITCH_DOWNSTREAM_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->chassisNr != -1) {
|
||||||
|
virReportControllerInvalidOption(cont, model, modelName, "chassisNr");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_DEFAULT:
|
||||||
|
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
|
||||||
|
default:
|
||||||
|
virReportEnumRangeError(virDomainControllerModelPCI, cont->model);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
|
return qemuDomainDeviceDefValidateControllerPCIOld(cont, def, qemuCaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user