[PATCH 17/21] domain_conf.c: move pci-root/pcie-root address check to post parse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Move the check made in virDomainControllerDefParseXML() to
virDomainControllerDefPostParse().

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/conf/domain_conf.c                      | 16 ++++++++++------
 tests/qemuxml2argvdata/pci-root-address.err |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9ca979b345..c17f5479ba 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -5382,6 +5382,16 @@ virDomainControllerDefPostParse(virDomainControllerDefPtr cdev)
     if (cdev->type == VIR_DOMAIN_CONTROLLER_TYPE_PCI) {
         virDomainPCIControllerOpts pciOpts = cdev->opts.pciopts;
 
+        if (cdev->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT ||
+            cdev->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) {
+            if (cdev->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 (pciOpts.chassisNr != -1) {
             if (pciOpts.chassisNr < 1 || pciOpts.chassisNr > 255) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -11423,12 +11433,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"));
-                goto error;
-            }
             if ((rc = virParseScaledValue("./pcihole64", NULL,
                                           ctxt, &bytes, 1024,
                                           1024ULL * ULONG_MAX, false)) < 0)
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
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux