37 lines
1.5 KiB
Diff
37 lines
1.5 KiB
Diff
|
From 956b1a0e2c7ffec0ba7564e7f299f53508d8043c Mon Sep 17 00:00:00 2001
|
||
|
Message-ID: <956b1a0e2c7ffec0ba7564e7f299f53508d8043c.1729611061.git.jdenemar@redhat.com>
|
||
|
From: Peter Krempa <pkrempa@redhat.com>
|
||
|
Date: Mon, 30 Sep 2024 14:16:58 +0200
|
||
|
Subject: [PATCH] qemu: migration: Pre-create QCOW2 images for non-shared
|
||
|
storage with 0 allocation
|
||
|
|
||
|
Specify that the <allocation> parameter for the newly-created qcow2
|
||
|
image is 0 so that only metadata gets preallocated. Otherwise the
|
||
|
storage driver code instructs qemu to use 'fallocate' preallocation mode
|
||
|
and considers the image fully allocated.
|
||
|
|
||
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||
|
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
|
||
|
(cherry picked from commit 165b30e06a6d14e8719c82af290d3b20e4cbc462)
|
||
|
|
||
|
https://issues.redhat.com/browse/RHEL-61177
|
||
|
---
|
||
|
src/qemu/qemu_migration.c | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
||
|
index 4fd7a0aafb..920b254351 100644
|
||
|
--- a/src/qemu/qemu_migration.c
|
||
|
+++ b/src/qemu/qemu_migration.c
|
||
|
@@ -361,6 +361,8 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn,
|
||
|
virBufferAddLit(&buf, "<volume>\n");
|
||
|
virBufferAdjustIndent(&buf, 2);
|
||
|
virBufferEscapeString(&buf, "<name>%s</name>\n", volName);
|
||
|
+ if (disk->src->format == VIR_STORAGE_FILE_QCOW2)
|
||
|
+ virBufferAddLit(&buf, "<allocation>0</allocation>\n");
|
||
|
virBufferAsprintf(&buf, "<capacity>%llu</capacity>\n", capacity);
|
||
|
virBufferAddLit(&buf, "<target>\n");
|
||
|
virBufferAdjustIndent(&buf, 2);
|
||
|
--
|
||
|
2.47.0
|