virt-v2v/0013-lib-qemuNBD.ml-Use-qemu-nbd-discard-unmap.patch
Richard W.M. Jones 211690d47b Fix virt-v2v hang when given incorrect vpx:// URL
resolves: rhbz#2041886
2022-01-20 12:46:20 +00:00

34 lines
993 B
Diff

From 0d880dc288a10f29f6e52066514435c73af97be3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 19 Jan 2022 18:54:11 +0000
Subject: [PATCH] lib/qemuNBD.ml: Use qemu-nbd --discard=unmap
The default for qemu-nbd is to ignore discard requests. This meant
that for input files in qcow2 format the "Mapping ..." (ie. fstrim)
step did nothing, all the work was ignored and we copied deleted data
over to the destination.
This was detected by the test-v2v-trim.sh test.
Fixes: commit 255722cbf39afc0b012e2ac00d16fa6ba2f8c21f
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
lib/qemuNBD.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/qemuNBD.ml b/lib/qemuNBD.ml
index 89c93d70..54139ce0 100644
--- a/lib/qemuNBD.ml
+++ b/lib/qemuNBD.ml
@@ -93,6 +93,7 @@ let run_unix ?socket { disk; snapshot; format } =
["qemu-nbd";
"-t";
"--shared=0";
+ "--discard=unmap";
"--pid-file"; pidfile;
"--socket"; socket];
--
2.31.1