virt-v2v/0023-input-libvirt-Share-a-...

46 lines
1.8 KiB
Diff

From 2a3b0da09e3a89eb9a6c84fd6015367ba3022e24 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 25 Jan 2022 10:06:37 +0000
Subject: [PATCH] input: libvirt: Share a single connection to the source NBD
server
When using virt-p2v from RHEL 7, it starts a very old qemu-nbd server
(probably 1.5.3) which required the --shared parameter to enable
sharing even in read-only mode. Since it doesn't pass this parameter
only a single connection at a time is allowed, and further connections
will deadlock. Note that later versions of qemu-nbd changed this so
that read-only connections permit sharing automatically.
In modular virt-v2v we now use nbdkit-nbd-plugin to proxy the
connection to virt-p2v / qemu-nbd. When you connect to this multiple
times, as virt-v2v does, it will make multiple connections to the
backend qemu-nbd. This will cause a deadlock.
We can use the nbdkit-nbd-plugin shared=true flag to enable the plugin
to share a single connection to the backend between multiple nbdkit
clients.
Reported-by: Tingting Zheng
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2044911
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
(cherry picked from commit 20019b5cadc1434ac09842e2045a7d5635561835)
---
input/input_libvirt.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/input/input_libvirt.ml b/input/input_libvirt.ml
index 33f61086..42050c15 100644
--- a/input/input_libvirt.ml
+++ b/input/input_libvirt.ml
@@ -76,6 +76,7 @@ and libvirt_servers dir disks =
Nbdkit.add_filter cmd "cow";
Nbdkit.add_arg cmd "hostname" hostname;
Nbdkit.add_arg cmd "port" (string_of_int port);
+ Nbdkit.add_arg cmd "shared" "true";
let _, pid = Nbdkit.run_unix ~socket cmd in
(* --exit-with-parent should ensure nbdkit is cleaned
--
2.19.1.3.g30247aa5d201