]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: hotplug: Validate definition of 'FS' device after address allocation
authorPeter Krempa <pkrempa@redhat.com>
Thu, 30 May 2024 14:25:33 +0000 (16:25 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 31 May 2024 10:54:32 +0000 (12:54 +0200)
Some of the checks make sense only after the address is allocated and
thus we need to re-do the validation after the address is assigned.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_hotplug.c

index c98b0b5d523ba9d0292ded83d22655f90978f17b..4a3f4f657e2db96d5bb526651b16c28de57e3f7c 100644 (file)
@@ -40,6 +40,7 @@
 #include "domain_audit.h"
 #include "domain_cgroup.h"
 #include "domain_interface.h"
+#include "domain_validate.h"
 #include "netdev_bandwidth_conf.h"
 #include "domain_nwfilter.h"
 #include "virlog.h"
@@ -3216,6 +3217,9 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver,
 
     qemuAssignDeviceFSAlias(vm->def, fs);
 
+    if (virDomainDeviceDefValidate(&dev, vm->def, 0, driver->xmlopt, priv->qemuCaps) < 0)
+        goto cleanup;
+
     chardev = virDomainChrSourceDefNew(priv->driver->xmlopt);
     chardev->type = VIR_DOMAIN_CHR_TYPE_UNIX;
     chardev->data.nix.path = qemuDomainGetVHostUserFSSocketPath(priv, fs);