提交 b899f365 编写于 作者: A Andrea Bolognani

qemu: Tweak index number checking

Moving the check and rewriting it this way doesn't alter
the current behavior, but will allow us to special-case
pci-root down the line.
Signed-off-by: NAndrea Bolognani <abologna@redhat.com>
Reviewed-by: NLaine Stump <laine@laine.org>
上级 0e943cec
......@@ -2717,6 +2717,26 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
break;
case VIR_DOMAIN_CONTROLLER_TYPE_PCI:
switch ((virDomainControllerModelPCI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
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:
if (def->idx == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("index for pci controllers of model '%s' must be > 0"),
virDomainControllerModelPCITypeToString(def->model));
goto error;
}
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT:
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST:
break;
}
switch ((virDomainControllerModelPCI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
if (def->opts.pciopts.modelName
......@@ -2977,12 +2997,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
_("wrong function called"));
goto error;
}
if (def->idx == 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("index for pci controllers of model '%s' must be > 0"),
virDomainControllerModelPCITypeToString(def->model));
goto error;
}
break;
case VIR_DOMAIN_CONTROLLER_TYPE_IDE:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册