[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 05/11] v2v: -i vmx -it ssh: Replace qemu block ssh driver with nbdkit-ssh-plugin.



One immediately advantage is we can use libvirt again.
---
 v2v/input_vmx.ml | 32 +++++++-------------------------
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git a/v2v/input_vmx.ml b/v2v/input_vmx.ml
index b169b2537..f521346e5 100644
--- a/v2v/input_vmx.ml
+++ b/v2v/input_vmx.ml
@@ -230,24 +230,14 @@ and qemu_uri_of_filename vmx_source filename =
        if remote_file_exists uri flat_vmdk then (flat_vmdk, "raw")
        else (abs_path, format) in
 
-     let json_params = [
-       "file.driver", JSON.String "ssh";
-       "file.path", JSON.String abs_path;
-       "file.host", JSON.String (server_of_uri uri);
-       "file.host_key_check", JSON.String "no";
-     ] in
-     let json_params =
-       match uri.Xml.uri_user with
-       | None -> json_params
-       | Some user ->
-          ("file.user", JSON.String user) :: json_params in
-     let json_params =
-       match port_of_uri uri with
-       | None -> json_params
-       | Some port ->
-          ("file.port", JSON.Int (Int64.of_int port)) :: json_params in
+     let server = server_of_uri uri in
+     let port = Option.map string_of_int (port_of_uri uri) in
+     let user = uri.Xml.uri_user in
 
-     "json:" ^ JSON.string_of_doc json_params, format
+     let nbdkit = Nbdkit.create_ssh ~password:NoPassword ~server
+                                    ?port ?user abs_path in
+     let qemu_uri = Nbdkit.run nbdkit in
+     qemu_uri, format
 
 and absolute_path_from_other_file other_filename filename =
   if not (Filename.is_relative filename) then filename
@@ -396,14 +386,6 @@ object
 
   method as_options = "-i vmx " ^ arg
 
-  method precheck () =
-    match input_transport with
-    | None -> ()
-    | Some `SSH ->
-       if backend_is_libvirt () then
-         error (f_"because libvirtd doesn't pass the SSH_AUTH_SOCK environment variable to qemu you must set this environment variable:\n\nexport LIBGUESTFS_BACKEND=direct\n\nand then rerun the virt-v2v command.");
-       error_if_no_ssh_agent ()
-
   method source () =
     let vmx_source = vmx_source_of_arg input_transport arg in
 
-- 
2.22.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]