]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
domain_conf: move pci-root/pcie-root address check to domain_validate.c
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Tue, 8 Dec 2020 21:01:37 +0000 (18:01 -0300)
committerDaniel Henrique Barboza <danielhb413@gmail.com>
Wed, 9 Dec 2020 12:51:52 +0000 (09:51 -0300)
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/conf/domain_conf.c
src/conf/domain_validate.c
tests/qemuxml2argvdata/pci-root-address.err

index fd15d883989984d7fe4c8de564d303fb46dcc82d..33020093b8e7d07f7b509de1e275a07f4effa9ae 100644 (file)
@@ -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)
index f47e80ca38b53c5198d4269a7e3205b18cfb5d63..35deb9f017ba140c8030983ed2283d21d6484602 100644 (file)
@@ -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"),
index 53dad81985323349b0373ca15d2447b77645f107..ffe5438224da37b9af3cc2701131f16988e9a01d 100644 (file)
@@ -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