[PATCH 2/3] qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data

Peter Krempa via Devel posted 3 patches 8 months, 1 week ago
[PATCH 2/3] qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data
Posted by Peter Krempa via Devel 8 months, 1 week ago
From: Peter Krempa <pkrempa@redhat.com>

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 stroage 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>
---
 src/qemu/qemu_driver.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6ce949dd07..f657751057 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -14384,13 +14384,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.
@@ -14401,6 +14394,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 &&
-- 
2.49.0
Re: [PATCH 2/3] qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data
Posted by Ján Tomko via Devel 8 months, 1 week ago
On a Thursday in 2025, Peter Krempa via Devel wrote:
>From: Peter Krempa <pkrempa@redhat.com>
>
>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 stroage source, while normally e.g. in

*storage

>qemuDomainPrepareStorageSource() it happens before.
>
>Reorder it despite not having an effect currently.
>
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_driver.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>