From: Daniel Henrique Barboza Date: Tue, 8 Dec 2020 21:01:37 +0000 (-0300) Subject: domain_conf: move pci-root/pcie-root address check to domain_validate.c X-Git-Tag: v7.0.0-rc1~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f91f4c4e363bfe472c8d1f3741735920b525cc7;p=thirdparty%2Flibvirt.git domain_conf: move pci-root/pcie-root address check to domain_validate.c Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index fd15d88398..33020093b8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10825,12 +10825,6 @@ virDomainControllerDefParseXML(virDomainXMLOptionPtr xmlopt, case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT: case VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT: { unsigned long long bytes; - if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("pci-root and pcie-root controllers should not " - "have an address")); - return NULL; - } if ((rc = virParseScaledValue("./pcihole64", NULL, ctxt, &bytes, 1024, 1024ULL * ULONG_MAX, false)) < 0) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f47e80ca38..35deb9f017 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -525,6 +525,16 @@ virDomainControllerDefValidate(const virDomainControllerDef *controller) if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) { const virDomainPCIControllerOpts *opts = &controller->opts.pciopts; + if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT || + controller->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) { + if (controller->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("pci-root and pcie-root controllers " + "should not have an address")); + return -1; + } + } + if (controller->idx > 255) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("PCI controller index %d too high, maximum is 255"), diff --git a/tests/qemuxml2argvdata/pci-root-address.err b/tests/qemuxml2argvdata/pci-root-address.err index 53dad81985..ffe5438224 100644 --- a/tests/qemuxml2argvdata/pci-root-address.err +++ b/tests/qemuxml2argvdata/pci-root-address.err @@ -1 +1 @@ -XML error: pci-root and pcie-root controllers should not have an address +unsupported configuration: pci-root and pcie-root controllers should not have an address