conf: validate: Run global device definition validation before callbacks

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>
This commit is contained in:
Peter Krempa 2021-09-07 10:55:06 +02:00
parent 7dee442677
commit 002de683c6
12 changed files with 14 additions and 14 deletions

View File

@ -2289,12 +2289,12 @@ virDomainDeviceDefValidate(const virDomainDeviceDef *dev,
if (parseFlags & VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE)
return 0;
if (virDomainDeviceDefValidateInternal(dev, def) < 0)
return -1;
if (xmlopt->config.deviceValidateCallback &&
xmlopt->config.deviceValidateCallback(dev, def, xmlopt->config.priv, parseOpaque))
return -1;
if (virDomainDeviceDefValidateInternal(dev, def) < 0)
return -1;
return 0;
}

View File

@ -1 +1 @@
unsupported configuration: domain configuration does not support video model 'default'
internal error: missing video model and cannot determine default

View 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'

View 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'

View 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'

View 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'

View 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

View 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

View 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

View 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

View 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

View File

@ -1 +1 @@
unsupported configuration: 'address' is not supported for 'ramfb' video devices
unsupported configuration: address not supported for video type ramfb