v2v: -i vmx -it ssh: Replace qemu block ssh driver with nbdkit-ssh-plugin.

One immediately advantage is we can use libvirt again.
This commit is contained in:
Richard W.M. Jones
2019-04-04 17:13:34 +01:00
parent 0977f4b909
commit 57f6c72a9d

View File

@@ -236,24 +236,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
@@ -402,14 +392,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