[PATCH 3/6] conf: validate: Run global device definition validation before callbacks

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

 



The validation infrastructure doesn't modify the definition and
additionally it makes sense to run the global code first as it's
validating certain corner cases.

The changed error messages from qemuxml2argvtest show that this is
indeed the proper ordering as all changed messages are actually better
describing the error.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/conf/domain_validate.c                                  | 6 +++---
 .../default-video-type-x86_64-caps-test-0.err               | 2 +-
 tests/qemuxml2argvdata/disk-fdc-incompatible-address.err    | 2 +-
 tests/qemuxml2argvdata/disk-ide-incompatible-address.err    | 2 +-
 tests/qemuxml2argvdata/disk-sata-incompatible-address.err   | 2 +-
 tests/qemuxml2argvdata/disk-scsi-incompatible-address.err   | 2 +-
 tests/qemuxml2argvdata/pseries-default-phb-numa-node.err    | 2 +-
 .../qemuxml2argvdata/pseries-phb-invalid-target-index-1.err | 2 +-
 .../qemuxml2argvdata/pseries-phb-invalid-target-index-2.err | 2 +-
 .../qemuxml2argvdata/pseries-phb-invalid-target-index-3.err | 2 +-
 tests/qemuxml2argvdata/video-invalid-multiple-devices.err   | 2 +-
 ...video-ramfb-display-device-pci-address.x86_64-latest.err | 2 +-
 12 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index dbabb953af..9069b60e37 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2289,11 +2289,11 @@ virDomainDeviceDefValidate(const virDomainDeviceDef *dev,
     if (parseFlags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)
         return 0;

-    if (xmlopt->config.deviceValidateCallback &&
-        xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.priv, parseOpaque))
+    if (virDomainDeviceDefValidateInternal(dev, def) < 0)
         return -1;

-    if (virDomainDeviceDefValidateInternal(dev, def) < 0)
+    if (xmlopt->config.deviceValidateCallback &&
+        xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.priv, parseOpaque))
         return -1;

     return 0;
diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
index f7b6b57926..28ffb0c7a2 100644
--- a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
+++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
@@ -1 +1 @@
-unsupported configuration: domain configuration does not support video model 'default'
+internal error: missing video model and cannot determine default
diff --git a/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err b/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err
index 169da75bf0..74075aa80c 100644
--- a/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err
+++ b/tests/qemuxml2argvdata/disk-fdc-incompatible-address.err
@@ -1 +1 @@
-internal error: unexpected address type for fdc disk
+unsupported configuration: Invalid address type 'pci' for the disk 'fda' with the bus type 'fdc'
diff --git a/tests/qemuxml2argvdata/disk-ide-incompatible-address.err b/tests/qemuxml2argvdata/disk-ide-incompatible-address.err
index 03eea59410..29abf07365 100644
--- a/tests/qemuxml2argvdata/disk-ide-incompatible-address.err
+++ b/tests/qemuxml2argvdata/disk-ide-incompatible-address.err
@@ -1 +1 @@
-internal error: unexpected address type for ide disk
+unsupported configuration: Invalid address type 'pci' for the disk 'hda' with the bus type 'ide'
diff --git a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err b/tests/qemuxml2argvdata/disk-sata-incompatible-address.err
index 09395bcd6b..cdb176b7d6 100644
--- a/tests/qemuxml2argvdata/disk-sata-incompatible-address.err
+++ b/tests/qemuxml2argvdata/disk-sata-incompatible-address.err
@@ -1 +1 @@
-internal error: unexpected address type for sata disk
+unsupported configuration: Invalid address type 'pci' for the disk 'sda' with the bus type 'sata'
diff --git a/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err b/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err
index 13d619a3e2..3458311d44 100644
--- a/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err
+++ b/tests/qemuxml2argvdata/disk-scsi-incompatible-address.err
@@ -1 +1 @@
-internal error: unexpected address type for scsi disk
+unsupported configuration: Invalid address type 'pci' for the disk 'sda' with the bus type 'scsi'
diff --git a/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err b/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err
index e46b710330..20dade0530 100644
--- a/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err
+++ b/tests/qemuxml2argvdata/pseries-default-phb-numa-node.err
@@ -1 +1 @@
-unsupported configuration: Option 'numaNode' is not valid for PCI controller with index '0', model 'pci-root' and modelName 'spapr-pci-host-bridge'
+unsupported configuration: The PCI controller with index=0 can't be associated with a NUMA node
diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err
index 9c9eb69ae4..91f67d4876 100644
--- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err
+++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err
@@ -1 +1 @@
-unsupported configuration: The 'spapr-pci-host-bridge' device is not supported by this QEMU binary
+unsupported configuration: Only the PCI controller with index 0 can have target index 0, and vice versa
diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err
index 9c9eb69ae4..91f67d4876 100644
--- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err
+++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err
@@ -1 +1 @@
-unsupported configuration: The 'spapr-pci-host-bridge' device is not supported by this QEMU binary
+unsupported configuration: Only the PCI controller with index 0 can have target index 0, and vice versa
diff --git a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err
index 9c9eb69ae4..c008dd5838 100644
--- a/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err
+++ b/tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err
@@ -1 +1 @@
-unsupported configuration: The 'spapr-pci-host-bridge' device is not supported by this QEMU binary
+unsupported configuration: PCI controller target index '31' out of range - must be 0-30
diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.err b/tests/qemuxml2argvdata/video-invalid-multiple-devices.err
index 5c1e557021..69fe45e1a4 100644
--- a/tests/qemuxml2argvdata/video-invalid-multiple-devices.err
+++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.err
@@ -1 +1 @@
-unsupported configuration: domain configuration does not support video model 'qxl'
+unsupported configuration: a 'none' video type must be the only video device defined for the domain
diff --git a/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-latest.err b/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-latest.err
index 00e409e1db..04aaabca72 100644
--- a/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-latest.err
+++ b/tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-latest.err
@@ -1 +1 @@
-unsupported configuration: 'address' is not supported for 'ramfb' video devices
+unsupported configuration: address not supported for video type ramfb
-- 
2.31.1




[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