[Libguestfs] [PATCH v2v 2/3] lib/qemuNBD.ml: Use qemu-nbd --shared=0 flag to allow multiple connections

Richard W.M. Jones rjones at redhat.com
Wed Jan 19 18:57:48 UTC 2022


qemu-nbd --shared (-e) flag controls how many clients can connect
concurrently.  0 means unlimited.

We want to allow the sockets to be queried by other processes while
virt-v2v is running and it should be safe to do this.  The default
configuration of qemu-nbd doesn't allow this so add --shared=0.

Note this does not (in current qemu) enable multi-conn because we
aren't using the -r (read-only) flag.
---
 lib/qemuNBD.ml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/qemuNBD.ml b/lib/qemuNBD.ml
index 12d083aeb7..89c93d7072 100644
--- a/lib/qemuNBD.ml
+++ b/lib/qemuNBD.ml
@@ -90,7 +90,11 @@ let run_unix ?socket { disk; snapshot; format } =
   (* Construct the qemu-nbd command line. *)
   let args = ref [] in
   List.push_back_list args
-    ["qemu-nbd"; "-t"; "--pid-file"; pidfile; "--socket"; socket];
+    ["qemu-nbd";
+     "-t";
+     "--shared=0";
+     "--pid-file"; pidfile;
+     "--socket"; socket];
 
   (* -s adds a protective overlay. *)
   if snapshot then List.push_back args "-s";
-- 
2.32.0




More information about the Libguestfs mailing list