From: Peter Krempa Date: Thu, 10 Apr 2025 13:26:14 +0000 (+0200) Subject: qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data X-Git-Tag: v11.3.0-rc1~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=63c348e88abf10e3edb1792ac00823c694beb637;p=thirdparty%2Flibvirt.git qemuDomainBlockCopyCommon: Reorder setup of 'mirror' data 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 Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ebdec2c6fa..64ed85e8ad 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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 &&