]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data
authorPeter Krempa <pkrempa@redhat.com>
Thu, 10 Apr 2025 13:26:14 +0000 (15:26 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 10 Apr 2025 15:00:27 +0000 (17:00 +0200)
While exploring an idea that modified the setup of the mirror I've
noticed that the code setting up the 'discard' field in the block copy
job happens after setup of the storage source, while normally e.g. in
qemuDomainPrepareStorageSource() it happens before.

Reorder it despite not having an effect currently.

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

index ebdec2c6fad00e393217baf51108b1a77471821e..64ed85e8ad7f8a6b7068233c78b2d003f726a02c 100644 (file)
@@ -14387,13 +14387,6 @@ qemuDomainBlockCopyCommon(virDomainObj *vm,
      * as read-write for the duration of the copy job */
     mirror->readonly = false;
 
-    /* we must initialize XML-provided chain prior to detecting to keep semantics
-     * with VM startup */
-    for (n = mirror; virStorageSourceIsBacking(n); n = n->backingStore) {
-        if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0)
-            goto endjob;
-    }
-
     /* 'qemuDomainPrepareStorageSourceBlockdev' calls
      * 'qemuDomainPrepareDiskSourceData' which propagates 'detect_zeroes'
      * into the topmost virStorage source of the disk chain.
@@ -14404,6 +14397,13 @@ qemuDomainBlockCopyCommon(virDomainObj *vm,
     mirror->detect_zeroes = disk->detect_zeroes;
     mirror->discard_no_unref = disk->discard_no_unref;
 
+    /* we must initialize XML-provided chain prior to detecting to keep semantics
+     * with VM startup */
+    for (n = mirror; virStorageSourceIsBacking(n); n = n->backingStore) {
+        if (qemuDomainPrepareStorageSourceBlockdev(disk, n, priv, cfg) < 0)
+            goto endjob;
+    }
+
     /* If reusing an external image that includes a backing file but the user
      * did not enumerate the chain in the XML we need to detect the chain */
     if (mirror_reuse &&