[Libguestfs] [v2v PATCH 1/2] v2v: nbdkit: change base dir for nbdkit sockets/pidfiles

Pino Toscano ptoscano at redhat.com
Mon Apr 6 15:40:44 UTC 2020


Since this new temporary directory will contain UNIX sockets for
communicating with nbdkit, then its path must not be too long.

Use the existing directory that libguestfs exposes for this, i.e.
sockdir.
---
 v2v/nbdkit.ml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/v2v/nbdkit.ml b/v2v/nbdkit.ml
index 65317f9b..46b20c9d 100644
--- a/v2v/nbdkit.ml
+++ b/v2v/nbdkit.ml
@@ -103,9 +103,12 @@ let add_filter_if_available cmd filter =
   if probe_filter filter then add_filter cmd filter else cmd
 
 let run_unix cmd =
-  (* Create a temporary directory where we place the socket and PID file. *)
+  (* Create a temporary directory where we place the socket and PID file.
+   * Use the libguestfs socket directory, so it is more likely the full path
+   * of the UNIX sockets will fit in the (limited) socket pathname.
+   *)
   let tmpdir =
-    let base_dir = (open_guestfs ())#get_cachedir () in
+    let base_dir = (open_guestfs ())#get_sockdir () in
     let t = Mkdtemp.temp_dir ~base_dir "v2vnbdkit." in
     (* tmpdir must be readable (but not writable) by "other" so that
      * qemu can open the sockets.
-- 
2.25.1




More information about the Libguestfs mailing list