53 lines
2.1 KiB
Diff
53 lines
2.1 KiB
Diff
From eeef445131b8fb327d6850cf582dabc6ffd1ba80 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <eeef445131b8fb327d6850cf582dabc6ffd1ba80.1729611062.git.jdenemar@redhat.com>
|
|
From: Peter Krempa <pkrempa@redhat.com>
|
|
Date: Fri, 11 Oct 2024 18:31:28 +0200
|
|
Subject: [PATCH] qemu: migration: Fix blockdev config with
|
|
VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES
|
|
|
|
The idea of migration with VIR_MIGRATE_PARAM_MIGRATE_DISKS_DETECT_ZEROES
|
|
populated is to sparsify the image. The QEMU NBD client as it was
|
|
configured in commit 621f879adf98e2c93ac5c8c869733a57f06cd9aa would
|
|
signal to the destination to do thick allocation of holes which would
|
|
result in a non-sparse image for any backend except a qcow2 image which
|
|
I used to test it.
|
|
|
|
Switch to VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP and
|
|
VIR_DOMAIN_DISK_DISCARD_UNMAP which tells the NBD client (and that in
|
|
turn the NBD server) to preserve the sparse blocks it detected from the
|
|
image.
|
|
|
|
Fixes: 621f879adf98e2c93ac5c8c869733a57f06cd9aa
|
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
(cherry picked from commit 04d6a0ec5d80c7618e00fcd6456e1bd0773207a9)
|
|
|
|
https://issues.redhat.com/browse/RHEL-61177
|
|
---
|
|
src/qemu/qemu_migration.c | 10 ++++++++--
|
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
index 5ebe4748ce..d67cae56f6 100644
|
|
--- a/src/qemu/qemu_migration.c
|
|
+++ b/src/qemu/qemu_migration.c
|
|
@@ -1032,8 +1032,14 @@ qemuMigrationSrcNBDStorageCopyBlockdevPrepareSource(virDomainDiskDef *disk,
|
|
copysrc->protocol = VIR_STORAGE_NET_PROTOCOL_NBD;
|
|
copysrc->format = VIR_STORAGE_FILE_RAW;
|
|
|
|
- if (detect_zeroes)
|
|
- copysrc->detect_zeroes = VIR_DOMAIN_DISK_DETECT_ZEROES_ON;
|
|
+ if (detect_zeroes) {
|
|
+ /* We need to use both VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP and
|
|
+ * VIR_DOMAIN_DISK_DISCARD_UNMAP as the qemu NBD client otherwise singals
|
|
+ * to the server to fully allocate the zero blocks
|
|
+ */
|
|
+ copysrc->detect_zeroes = VIR_DOMAIN_DISK_DETECT_ZEROES_UNMAP;
|
|
+ copysrc->discard = VIR_DOMAIN_DISK_DISCARD_UNMAP;
|
|
+ }
|
|
|
|
copysrc->backingStore = virStorageSourceNew();
|
|
|
|
--
|
|
2.47.0
|