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