]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: validate: Run global device definition validation before callbacks
authorPeter Krempa <pkrempa@redhat.com>
Tue, 7 Sep 2021 08:55:06 +0000 (10:55 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 9 Sep 2021 08:17:28 +0000 (10:17 +0200)
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@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
12 files changed:
src/conf/domain_validate.c
tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.err
tests/qemuxml2argvdata/disk-fdc-incompatible-address.err
tests/qemuxml2argvdata/disk-ide-incompatible-address.err
tests/qemuxml2argvdata/disk-sata-incompatible-address.err
tests/qemuxml2argvdata/disk-scsi-incompatible-address.err
tests/qemuxml2argvdata/pseries-default-phb-numa-node.err
tests/qemuxml2argvdata/pseries-phb-invalid-target-index-1.err
tests/qemuxml2argvdata/pseries-phb-invalid-target-index-2.err
tests/qemuxml2argvdata/pseries-phb-invalid-target-index-3.err
tests/qemuxml2argvdata/video-invalid-multiple-devices.err
tests/qemuxml2argvdata/video-ramfb-display-device-pci-address.x86_64-latest.err

index dbabb953aff3c008ba2c83395b326218847f0510..9069b60e374f927eb2e2c52e0fd12b6163f771e8 100644 (file)
@@ -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;
index f7b6b57926d4ba090dc16b104759ca88729f31ed..28ffb0c7a24ea1a401bc590d43cd98b2756d763b 100644 (file)
@@ -1 +1 @@
-unsupported configuration: domain configuration does not support video model 'default'
+internal error: missing video model and cannot determine default
index 169da75bf0a14d265c06b0a7884a0e1b56d842ee..74075aa80c533d7ac18e1b1e896cd034492b930b 100644 (file)
@@ -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'
index 03eea594105f0ed182baf72f7ce4ac22f4ffee29..29abf073659240110370860636c9c6ab919d2c00 100644 (file)
@@ -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'
index 09395bcd6b0a7c7ae28b622559c7976125af1c0b..cdb176b7d664ca01f1b3cb2b7c5e9d9ece256c6d 100644 (file)
@@ -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'
index 13d619a3e252fde08018cc729e49c01db39800d6..3458311d446fe33464d6f4a93ef4cd392ddc6fcc 100644 (file)
@@ -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'
index e46b7103308b4f2bce65adecc5ff0e146d3ad645..20dade05307bc6f7ea1497b309bb3b5183503afa 100644 (file)
@@ -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
index 9c9eb69ae4c894cade571eca8e80f8dc59d019d1..91f67d48768f00c11be39fad796ea3358ca2c96d 100644 (file)
@@ -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
index 9c9eb69ae4c894cade571eca8e80f8dc59d019d1..91f67d48768f00c11be39fad796ea3358ca2c96d 100644 (file)
@@ -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
index 9c9eb69ae4c894cade571eca8e80f8dc59d019d1..c008dd5838ecd565365226e8d93d7dc048894342 100644 (file)
@@ -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
index 5c1e557021c93d2b19dcae78487482cfe5bc59c1..69fe45e1a4f322f0b17cb4d24dc23f786ad17d85 100644 (file)
@@ -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
index 00e409e1db5faa9590048af8e55a4e68e31e71bf..04aaabca72a47188c48f8f967d98328bde884c00 100644 (file)
@@ -1 +1 @@
-unsupported configuration: 'address' is not supported for 'ramfb' video devices
+unsupported configuration: address not supported for video type ramfb