50 lines
1.5 KiB
Diff
50 lines
1.5 KiB
Diff
From d74842f209b5461692a2d283d622157862bdc230 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Thu, 25 Jul 2019 14:52:42 +0100
|
|
Subject: [PATCH] v2v: -i vmx: Use scp -T option if available to unbreak scp
|
|
(RHBZ#1733168).
|
|
|
|
Tested using:
|
|
|
|
cd v2v
|
|
LIBGUESTFS_BACKEND=direct ../run virt-v2v -i vmx -it ssh "ssh://localhost/$PWD/test-v2v-i-vmx-1.vmx" -o null -v -x
|
|
|
|
and manually examining the debug output.
|
|
|
|
Thanks: Ming Xie, Jakub Jelen.
|
|
(cherry picked from commit 7692c31494f7b1d37e380eed9eb99c5952940dbf)
|
|
---
|
|
v2v/input_vmx.ml | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/v2v/input_vmx.ml b/v2v/input_vmx.ml
|
|
index b169b2537..e3469308d 100644
|
|
--- a/v2v/input_vmx.ml
|
|
+++ b/v2v/input_vmx.ml
|
|
@@ -61,6 +61,11 @@ let server_of_uri { Xml.uri_server } =
|
|
let path_of_uri { Xml.uri_path } =
|
|
match uri_path with None -> assert false | Some p -> p
|
|
|
|
+let scp_supports_T_option = lazy (
|
|
+ let cmd = "LANG=C scp -T |& grep \"unknown option\"" in
|
|
+ shell_command cmd <> 0
|
|
+)
|
|
+
|
|
(* 'scp' a remote file into a temporary local file, returning the path
|
|
* of the temporary local file.
|
|
*)
|
|
@@ -68,8 +73,9 @@ let scp_from_remote_to_temporary uri tmpdir filename =
|
|
let localfile = tmpdir // filename in
|
|
|
|
let cmd =
|
|
- sprintf "scp%s%s %s%s:%s %s"
|
|
+ sprintf "scp%s%s%s %s%s:%s %s"
|
|
(if verbose () then "" else " -q")
|
|
+ (if Lazy.force scp_supports_T_option then " -T" else "")
|
|
(match port_of_uri uri with
|
|
| None -> ""
|
|
| Some port -> sprintf " -P %d" port)
|
|
--
|
|
2.24.1
|
|
|