]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: hotplug: Detect disk backing images before setting up security access
authorPeter Krempa <pkrempa@redhat.com>
Thu, 23 Nov 2023 13:07:48 +0000 (14:07 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 24 Nov 2023 14:53:38 +0000 (15:53 +0100)
The VM will require access also to the detected images. Unfortunately a
recent reordering of the code introduced a bug where the backing chain
was probed after setting up cgroups/selinux/namespaces, which caused
that any detected images were not allowed/added and qemu was then not
able to use them.

Fixes: 9b8bb536ff999fa61e41869bd98a026b8e23378f
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_hotplug.c

index f197a9d5ffc83632aa21172c7e02d39e419c31c7..4e2fc724c03a01d3d7197f52d1f7a828dfc1cee9 100644 (file)
@@ -1001,17 +1001,17 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriver *driver,
         goto cleanup;
 
     if (!virStorageSourceIsEmpty(disk->src)) {
-        if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src) < 0)
-            goto cleanup;
-
-        releaseSeclabel = true;
-
         if (qemuDomainPrepareDiskSource(disk, priv, cfg) < 0)
             goto cleanup;
 
         if (qemuDomainDetermineDiskChain(driver, vm, disk, NULL) < 0)
             goto cleanup;
 
+        if (qemuDomainStorageSourceChainAccessAllow(driver, vm, disk->src) < 0)
+            goto cleanup;
+
+        releaseSeclabel = true;
+
         if (qemuProcessPrepareHostStorageDisk(vm, disk) < 0)
             goto cleanup;