Rebase to virt-v2v 2.4.0

Fix -i vmx when remote filename contains literal '*'
resolves: RHEL-21365

Add new virt-v2v-release-notes-2.4(1) man page to %files
This commit is contained in:
Richard W.M. Jones 2024-01-18 17:52:43 +00:00
parent 9871c4190e
commit c2a2dc32f2
32 changed files with 3343 additions and 149 deletions

View File

@ -1,31 +0,0 @@
From ec542c5cc09c49a7af9072581d5090bc18bfb6ec Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 9 Dec 2023 12:22:40 +0000
Subject: [PATCH] ocaml-dep.sh: Add common/mlcustomize to list of directories
to search
Avoids this error when you change a file under common/mlcustomize and
then rebuild virt-v2v:
Error: Files ../convert/mlconvert.cmxa
and ../common/mlcustomize/mlcustomize.cmxa
make inconsistent assumptions over implementation Inject_virtio_win
Fixes: commit 4b9c8e1560d67ac17e287450f61f4903d237fc47
See-also: commit c30df7ffb8fc04142b99cbb7ec1bebbb32ffb654
---
ocaml-dep.sh.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/ocaml-dep.sh.in b/ocaml-dep.sh.in
index 1e191d6d..7f3130e5 100755
--- a/ocaml-dep.sh.in
+++ b/ocaml-dep.sh.in
@@ -33,6 +33,7 @@ set -e
# directories must have unique names (eg. not Utils) else
# dependencies don't get built right.
include_dirs="
+common/mlcustomize
common/mldrivers
common/mlgettext
common/mlpcre

View File

@ -0,0 +1,39 @@
From af68f253d1a11c4abaa30ae348ee3855cdec74e9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 11 Jan 2024 15:33:08 +0000
Subject: [PATCH] virt-v2v: -i vmx: Remove scp -T option
This reverts the following commit:
commit d265639c2ab31418cfdbdedd0cc3e68cf290d834
Author: Richard W.M. Jones <rjones@redhat.com>
Date: Thu Jul 25 14:52:42 2019 +0100
v2v: -i vmx: Use scp -T option if available to unbreak scp (RHBZ#1733168).
See also the referenced bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1733168
My rationale for removing this option is that since we now require
OpenSSH 8.8 we must be using sftp for file transfer so we no longer
need to defeat the check for correct expansion of wildcards. That
check was only relevant for OpenSSH <= 8.7 using the old scp protocol.
Reverts: commit d265639c2ab31418cfdbdedd0cc3e68cf290d834
---
input/parse_domain_from_vmx.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index 2e75e785..f24990f8 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -68,7 +68,7 @@ let scp_from_remote_to_temporary uri tmpdir filename =
let localfile = tmpdir // filename in
let cmd =
- sprintf "scp -T%s%s %s%s:%s %s"
+ sprintf "scp%s%s %s%s:%s %s"
(if verbose () then "" else " -q")
(match port_of_uri uri with
| None -> ""

View File

@ -0,0 +1,48 @@
From 60d4a517e43f0715fb9dc4f87cbd2f5c88ab662a Mon Sep 17 00:00:00 2001
From: Weblate Translation Memory
<noreply-mt-weblate-translation-memory@weblate.org>
Date: Mon, 15 Jan 2024 14:37:13 +0100
Subject: [PATCH] Translated using Weblate (Polish)
Currently translated at 7.2% (35 of 481 strings)
Translation: libguestfs/virt-v2v-master
Translate-URL: https://translate.fedoraproject.org/projects/libguestfs/virt-v2v-master/pl/
---
po/pl.po | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/po/pl.po b/po/pl.po
index d4bee25f..e3a5b11d 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -14,8 +14,9 @@ msgstr ""
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug."
"cgi?component=libguestfs&product=Virtualization+Tools\n"
"POT-Creation-Date: 2023-11-02 11:07+0000\n"
-"PO-Revision-Date: 2023-11-26 21:01+0000\n"
-"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
+"PO-Revision-Date: 2024-01-15 13:36+0000\n"
+"Last-Translator: Weblate Translation Memory <noreply-mt-weblate-translation-"
+"memory@weblate.org>\n"
"Language-Team: Polish <https://translate.fedoraproject.org/projects/"
"libguestfs/virt-v2v-master/pl/>\n"
"Language: pl\n"
@@ -24,7 +25,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2;\n"
-"X-Generator: Weblate 5.2.1\n"
+"X-Generator: Weblate 5.3.1\n"
#: input/input_ova.ml:136 common/mltools/tools_utils.ml:235
msgid "%s"
@@ -735,7 +736,7 @@ msgstr ""
#. common/mlcustomize/customize_cmdline.ml:245
#: common/mlcustomize/customize_cmdline.ml:453
msgid "PATH"
-msgstr ""
+msgstr "ŚCIEŻKA"
#: common/mlcustomize/customize_cmdline.ml:191
msgid "PERMISSIONS:FILE"

View File

@ -1,26 +0,0 @@
From 056401c8c6db33536c477078008649054f347a9c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 9 Dec 2023 12:59:13 +0000
Subject: [PATCH] Update common submodule
Pick up this bug fix:
mltools/libosinfo-c.c: Fix off-by-one error
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common cd29aee9..0dba002c:
diff --git a/common/mltools/libosinfo-c.c b/common/mltools/libosinfo-c.c
index 93357fd9..a48c8989 100644
--- a/common/mltools/libosinfo-c.c
+++ b/common/mltools/libosinfo-c.c
@@ -296,7 +296,7 @@ v2v_osinfo_os_get_device_drivers (value osv)
driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
- vi = caml_alloc (6, 0);
+ vi = caml_alloc (7, 0);
str = osinfo_device_driver_get_architecture (driver);
copyv = caml_copy_string (str);
Store_field (vi, 0, copyv);

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
From 6f2536bd9fbc335d3fb460d8c3317664d0bd813a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 19 Dec 2023 12:53:56 +0000
Subject: [PATCH] input/parse_vmx.ml: Reject VMDK files
Instead of the confusing warnings printed before, it now prints
an error indicating the incorrect input format:
$ virt-v2v -i vmx -it ssh ssh://root@xxx/vmfs/volumes/esx8.0-function/Auto-esx8.0-rhell9.3-efi-with-empty-cdrom/Auto-esx8.0-rhell9.3-efi-with-empty-cdrom.vmdk -ip /tmp/passwd -o null
virt-v2v: error: input file is a VMDK (disk image), but we are expecting a
VMX (VMware metadata)
Reported-by: Ming Xie
Fixes: https://issues.redhat.com/browse/RHEL-19564
---
input/parse_vmx.ml | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/input/parse_vmx.ml b/input/parse_vmx.ml
index 65d5a0ed..43d05bf3 100644
--- a/input/parse_vmx.ml
+++ b/input/parse_vmx.ml
@@ -274,6 +274,17 @@ let rec parse_file vmx_filename =
parse_string str
and parse_string str =
+ (* Reject VMDK files early, since in virt-v2v we have seen users try
+ * to pass a .vmdk file as a .vmx file. Luckily this is easy to
+ * do with the whole file as a string.
+ *)
+ if String.is_prefix str "VMDK" ||
+ String.is_prefix str "KDMV" ||
+ String.is_prefix str "# Disk DescriptorFile\n" then
+ error "input file is a VMDK (disk image), but we are expecting a \
+ VMX (VMware metadata)";
+
+ (* Split the input into lines. *)
let lines = String.nsplit "\n" str in
(* I've never seen any VMX file with CR-LF endings, and VMware

View File

@ -0,0 +1,301 @@
From cddd07669d18a5a848f82dbde27b84ef405ef9fa Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 14:24:35 +0000
Subject: [PATCH] virt-v2v: -i vmx: Refactor ssh/scp code into a new module
This is a straight refactor of the existing code that handles ssh/scp
into a new module. In this commit I just copy the code around without
doing any cleanup; cleanup will follow in subsequent commits.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/Makefile.am | 6 ++-
input/input_vmx.ml | 8 ++--
input/parse_domain_from_vmx.ml | 60 ++-----------------------
input/parse_domain_from_vmx.mli | 6 ---
input/ssh.ml | 78 +++++++++++++++++++++++++++++++++
input/ssh.mli | 34 ++++++++++++++
6 files changed, 123 insertions(+), 69 deletions(-)
create mode 100644 input/ssh.ml
create mode 100644 input/ssh.mli
diff --git a/input/Makefile.am b/input/Makefile.am
index de016d60..4153f878 100644
--- a/input/Makefile.am
+++ b/input/Makefile.am
@@ -39,6 +39,7 @@ SOURCES_MLI = \
parse_domain_from_vmx.mli \
parse_libvirt_xml.mli \
parse_vmx.mli \
+ ssh.mli \
vCenter.mli
SOURCES_ML = \
@@ -46,11 +47,12 @@ SOURCES_ML = \
parse_libvirt_xml.ml \
OVF.ml \
OVA.ml \
- parse_vmx.ml \
- parse_domain_from_vmx.ml \
nbdkit_curl.ml \
nbdkit_ssh.ml \
nbdkit_vddk.ml \
+ ssh.ml \
+ parse_vmx.ml \
+ parse_domain_from_vmx.ml \
vCenter.ml \
input.ml \
input_disk.ml \
diff --git a/input/input_vmx.ml b/input/input_vmx.ml
index eed8a433..bd20420c 100644
--- a/input/input_vmx.ml
+++ b/input/input_vmx.ml
@@ -79,21 +79,21 @@ module VMX = struct
let socket = sprintf "%s/in%d" dir i in
On_exit.unlink socket;
- let vmx_path = path_of_uri uri in
+ let vmx_path = Ssh.path_of_uri uri in
let abs_path = absolute_path_from_other_file vmx_path filename in
let flat_vmdk = PCRE.replace (PCRE.compile "\\.vmdk$")
"-flat.vmdk" abs_path in
(* RHBZ#1774386 *)
- if not (remote_file_exists uri flat_vmdk) then
+ if not (Ssh.remote_file_exists uri flat_vmdk) then
error (f_"This transport does not support guests with snapshots. \
Either collapse the snapshots for this guest and try \
the conversion again, or use one of the alternate \
conversion methods described in \
virt-v2v-input-vmware(1) section \"NOTES\".");
- let server = server_of_uri uri in
- let port = Option.map string_of_int (port_of_uri uri) in
+ let server = Ssh.server_of_uri uri in
+ let port = Option.map string_of_int (Ssh.port_of_uri uri) in
let user = uri.Xml.uri_user in
let password =
match options.input_password with
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index f24990f8..8cf5893c 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -51,61 +51,6 @@ let vmx_source_of_arg input_transport arg =
error (f_"vmx URI path component looks incorrect");
SSH uri
-(* Return various fields from the URI. The checks in vmx_source_of_arg
- * should ensure that none of these assertions fail.
- *)
-let port_of_uri { Xml.uri_port } =
- match uri_port with i when i <= 0 -> None | i -> Some i
-let server_of_uri { Xml.uri_server } =
- match uri_server with None -> assert false | Some s -> s
-let path_of_uri { Xml.uri_path } =
- match uri_path with None -> assert false | Some p -> p
-
-(* 'scp' a remote file into a temporary local file, returning the path
- * of the temporary local file.
- *)
-let scp_from_remote_to_temporary uri tmpdir filename =
- let localfile = tmpdir // filename in
-
- let cmd =
- sprintf "scp%s%s %s%s:%s %s"
- (if verbose () then "" else " -q")
- (match port_of_uri uri with
- | None -> ""
- | Some port -> sprintf " -P %d" port)
- (match uri.Xml.uri_user with
- | None -> ""
- | Some user -> quote user ^ "@")
- (quote (server_of_uri uri))
- (quote (path_of_uri uri))
- (quote localfile) in
- if verbose () then
- eprintf "%s\n%!" cmd;
- if Sys.command cmd <> 0 then
- error (f_"could not copy the VMX file from the remote server, \
- see earlier error messages");
- localfile
-
-(* Test if [path] exists on the remote server. *)
-let remote_file_exists uri path =
- let cmd =
- sprintf "ssh%s %s%s test -f %s"
- (match port_of_uri uri with
- | None -> ""
- | Some port -> sprintf " -p %d" port)
- (match uri.Xml.uri_user with
- | None -> ""
- | Some user -> quote user ^ "@")
- (quote (server_of_uri uri))
- (* Double quoting is necessary for 'ssh', first to protect
- * from the local shell, second to protect from the remote
- * shell. https://github.com/libguestfs/virt-v2v/issues/35#issuecomment-1741730963
- *)
- (quote (quote path)) in
- if verbose () then
- eprintf "%s\n%!" cmd;
- Sys.command cmd = 0
-
let rec find_disks vmx vmx_source =
(* Set the s_disk_id field to an incrementing number. *)
List.mapi
@@ -390,7 +335,8 @@ let parse_domain_from_vmx vmx_source =
match vmx_source with
| File filename -> Parse_vmx.parse_file filename
| SSH uri ->
- let filename = scp_from_remote_to_temporary uri tmpdir "source.vmx" in
+ let filename = Ssh.scp_from_remote_to_temporary uri tmpdir
+ "source.vmx" in
Parse_vmx.parse_file filename in
let name =
@@ -400,7 +346,7 @@ let parse_domain_from_vmx vmx_source =
warning (f_"no displayName key found in VMX file");
match vmx_source with
| File filename -> name_from_disk filename
- | SSH uri -> name_from_disk (path_of_uri uri) in
+ | SSH uri -> name_from_disk (Ssh.path_of_uri uri) in
let genid =
(* See: https://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg02019.html *)
diff --git a/input/parse_domain_from_vmx.mli b/input/parse_domain_from_vmx.mli
index e354b32e..42f8100e 100644
--- a/input/parse_domain_from_vmx.mli
+++ b/input/parse_domain_from_vmx.mli
@@ -22,9 +22,3 @@ type vmx_source =
val vmx_source_of_arg : [`SSH] option -> string -> vmx_source
val parse_domain_from_vmx : vmx_source -> Types.source * string list
-
-(* XXX Exporting these is a hack. *)
-val path_of_uri : Xml.uri -> string
-val server_of_uri : Xml.uri -> string
-val port_of_uri : Xml.uri -> int option
-val remote_file_exists : Xml.uri -> string -> bool
diff --git a/input/ssh.ml b/input/ssh.ml
new file mode 100644
index 00000000..5e689d29
--- /dev/null
+++ b/input/ssh.ml
@@ -0,0 +1,78 @@
+(* virt-v2v
+ * Copyright (C) 2009-2024 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+open Std_utils
+open Tools_utils
+open Common_gettext.Gettext
+
+open Printf
+
+(* Return various fields from the URI. The checks in vmx_source_of_arg
+ * should ensure that none of these assertions fail.
+ *)
+let port_of_uri { Xml.uri_port } =
+ match uri_port with i when i <= 0 -> None | i -> Some i
+let server_of_uri { Xml.uri_server } =
+ match uri_server with None -> assert false | Some s -> s
+let path_of_uri { Xml.uri_path } =
+ match uri_path with None -> assert false | Some p -> p
+
+(* 'scp' a remote file into a temporary local file, returning the path
+ * of the temporary local file.
+ *)
+let scp_from_remote_to_temporary uri tmpdir filename =
+ let localfile = tmpdir // filename in
+
+ let cmd =
+ sprintf "scp%s%s %s%s:%s %s"
+ (if verbose () then "" else " -q")
+ (match port_of_uri uri with
+ | None -> ""
+ | Some port -> sprintf " -P %d" port)
+ (match uri.Xml.uri_user with
+ | None -> ""
+ | Some user -> quote user ^ "@")
+ (quote (server_of_uri uri))
+ (quote (path_of_uri uri))
+ (quote localfile) in
+ if verbose () then
+ eprintf "%s\n%!" cmd;
+ if Sys.command cmd <> 0 then
+ error (f_"could not copy the VMX file from the remote server, \
+ see earlier error messages");
+ localfile
+
+(* Test if [path] exists on the remote server. *)
+let remote_file_exists uri path =
+ let cmd =
+ sprintf "ssh%s %s%s test -f %s"
+ (match port_of_uri uri with
+ | None -> ""
+ | Some port -> sprintf " -p %d" port)
+ (match uri.Xml.uri_user with
+ | None -> ""
+ | Some user -> quote user ^ "@")
+ (quote (server_of_uri uri))
+ (* Double quoting is necessary for 'ssh', first to protect
+ * from the local shell, second to protect from the remote
+ * shell. https://github.com/libguestfs/virt-v2v/issues/35#issuecomment-1741730963
+ *)
+ (quote (quote path)) in
+ if verbose () then
+ eprintf "%s\n%!" cmd;
+ Sys.command cmd = 0
diff --git a/input/ssh.mli b/input/ssh.mli
new file mode 100644
index 00000000..e9a1a6a8
--- /dev/null
+++ b/input/ssh.mli
@@ -0,0 +1,34 @@
+(* virt-v2v
+ * Copyright (C) 2009-2024 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *)
+
+(** Wrappers for finding and downloading remote files over ssh. *)
+
+val path_of_uri : Xml.uri -> string
+val server_of_uri : Xml.uri -> string
+val port_of_uri : Xml.uri -> int option
+
+(** [remote_file_exists ssh_uri path] checks that [path] exists
+ on the remote server [ssh_uri] (note any path inside [ssh_uri]
+ is ignored). *)
+val remote_file_exists : Xml.uri -> string -> bool
+
+(** [scp_from_remote_to_temporary ssh_uri tmpdir filename]
+ uses scp to copy the single remote file at [ssh_uri] to
+ the local file called [tmpdir/filename]. It returns the
+ final path [tmpdir/filename]. *)
+val scp_from_remote_to_temporary : Xml.uri -> string -> string -> string

View File

@ -0,0 +1,84 @@
From a0b22af28782a485cc2241dce55b8f435d8aaefc Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 14:35:57 +0000
Subject: [PATCH] virt-v2v: -i vmx: Simplify scp wrapper
The existing 'scp_from_remote_to_temporary' wrapper around scp was
pretty weird (I think from much patching without refactoring).
Simplify it so it no longer generates the output filename, and rename
it accordingly to 'download_file' (as we will soon remove the need for
and dependency on 'scp').
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/parse_domain_from_vmx.ml | 4 ++--
input/ssh.ml | 13 ++++---------
input/ssh.mli | 7 +++----
3 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index 8cf5893c..e6500da6 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -335,8 +335,8 @@ let parse_domain_from_vmx vmx_source =
match vmx_source with
| File filename -> Parse_vmx.parse_file filename
| SSH uri ->
- let filename = Ssh.scp_from_remote_to_temporary uri tmpdir
- "source.vmx" in
+ let filename = tmpdir // "source.vmx" in
+ Ssh.download_file uri filename;
Parse_vmx.parse_file filename in
let name =
diff --git a/input/ssh.ml b/input/ssh.ml
index 5e689d29..63ffeb12 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -32,12 +32,8 @@ let server_of_uri { Xml.uri_server } =
let path_of_uri { Xml.uri_path } =
match uri_path with None -> assert false | Some p -> p
-(* 'scp' a remote file into a temporary local file, returning the path
- * of the temporary local file.
- *)
-let scp_from_remote_to_temporary uri tmpdir filename =
- let localfile = tmpdir // filename in
-
+(* 'scp' a remote file into a local file. *)
+let download_file uri output =
let cmd =
sprintf "scp%s%s %s%s:%s %s"
(if verbose () then "" else " -q")
@@ -49,13 +45,12 @@ let scp_from_remote_to_temporary uri tmpdir filename =
| Some user -> quote user ^ "@")
(quote (server_of_uri uri))
(quote (path_of_uri uri))
- (quote localfile) in
+ (quote output) in
if verbose () then
eprintf "%s\n%!" cmd;
if Sys.command cmd <> 0 then
error (f_"could not copy the VMX file from the remote server, \
- see earlier error messages");
- localfile
+ see earlier error messages")
(* Test if [path] exists on the remote server. *)
let remote_file_exists uri path =
diff --git a/input/ssh.mli b/input/ssh.mli
index e9a1a6a8..62e78bd3 100644
--- a/input/ssh.mli
+++ b/input/ssh.mli
@@ -27,8 +27,7 @@ val port_of_uri : Xml.uri -> int option
is ignored). *)
val remote_file_exists : Xml.uri -> string -> bool
-(** [scp_from_remote_to_temporary ssh_uri tmpdir filename]
+(** [download_file ssh_uri output]
uses scp to copy the single remote file at [ssh_uri] to
- the local file called [tmpdir/filename]. It returns the
- final path [tmpdir/filename]. *)
-val scp_from_remote_to_temporary : Xml.uri -> string -> string -> string
+ the local file called [output]. *)
+val download_file : Xml.uri -> string -> unit

View File

@ -0,0 +1,125 @@
From 60e72acb344e89656f7b13d9e360d05cc983a419 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 16:14:10 +0000
Subject: [PATCH] virt-v2v: -i vmx: Add the input password to vmx_source
Since we use the input password in various places in the VMX module,
store the input password in vmx_source. This neutral refactoring
makes later changes simpler.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/input_vmx.ml | 13 ++++++-------
input/parse_domain_from_vmx.ml | 12 ++++++------
input/parse_domain_from_vmx.mli | 7 ++++---
3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/input/input_vmx.ml b/input/input_vmx.ml
index bd20420c..b9cce10f 100644
--- a/input/input_vmx.ml
+++ b/input/input_vmx.ml
@@ -45,13 +45,17 @@ module VMX = struct
let vmx_source =
match args with
| [arg] ->
+ let input_password =
+ match options.input_password with
+ | None -> Nbdkit_ssh.NoPassword
+ | Some ip -> Nbdkit_ssh.PasswordFile ip in
let input_transport =
match options.input_transport with
| None -> None
| Some `SSH -> Some `SSH
| Some `VDDK ->
error (f_"-i vmx: cannot use -it vddk in this input mode") in
- vmx_source_of_arg input_transport arg
+ vmx_source_of_arg input_password input_transport arg
| _ ->
error (f_"-i vmx: expecting a VMX file or ssh:// URI") in
@@ -73,7 +77,7 @@ module VMX = struct
On_exit.kill pid
) filenames
- | SSH uri ->
+ | SSH (password, uri) ->
List.iteri (
fun i filename ->
let socket = sprintf "%s/in%d" dir i in
@@ -95,11 +99,6 @@ module VMX = struct
let server = Ssh.server_of_uri uri in
let port = Option.map string_of_int (Ssh.port_of_uri uri) in
let user = uri.Xml.uri_user in
- let password =
- match options.input_password with
- | None -> Nbdkit_ssh.NoPassword
- | Some ip -> Nbdkit_ssh.PasswordFile ip in
-
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ~password
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index e6500da6..0719738c 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -29,13 +29,13 @@ open Utils
open Name_from_disk
type vmx_source =
- | File of string (* local file or NFS *)
- | SSH of Xml.uri (* SSH URI *)
+ | File of string (* local file or NFS *)
+ | SSH of Nbdkit_ssh.password * Xml.uri (* SSH URI *)
(* The single filename on the command line is intepreted either as
* a local file or a remote SSH URI (only if -it ssh).
*)
-let vmx_source_of_arg input_transport arg =
+let vmx_source_of_arg input_password input_transport arg =
match input_transport, arg with
| None, arg -> File arg
| Some `SSH, arg ->
@@ -49,7 +49,7 @@ let vmx_source_of_arg input_transport arg =
error (f_"vmx URI remote server name omitted");
if uri.Xml.uri_path = None || uri.Xml.uri_path = Some "/" then
error (f_"vmx URI path component looks incorrect");
- SSH uri
+ SSH (input_password, uri)
let rec find_disks vmx vmx_source =
(* Set the s_disk_id field to an incrementing number. *)
@@ -334,7 +334,7 @@ let parse_domain_from_vmx vmx_source =
let vmx =
match vmx_source with
| File filename -> Parse_vmx.parse_file filename
- | SSH uri ->
+ | SSH (_, uri) ->
let filename = tmpdir // "source.vmx" in
Ssh.download_file uri filename;
Parse_vmx.parse_file filename in
@@ -346,7 +346,7 @@ let parse_domain_from_vmx vmx_source =
warning (f_"no displayName key found in VMX file");
match vmx_source with
| File filename -> name_from_disk filename
- | SSH uri -> name_from_disk (Ssh.path_of_uri uri) in
+ | SSH (_, uri) -> name_from_disk (Ssh.path_of_uri uri) in
let genid =
(* See: https://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg02019.html *)
diff --git a/input/parse_domain_from_vmx.mli b/input/parse_domain_from_vmx.mli
index 42f8100e..208797a7 100644
--- a/input/parse_domain_from_vmx.mli
+++ b/input/parse_domain_from_vmx.mli
@@ -17,8 +17,9 @@
*)
type vmx_source =
- | File of string (** local file or NFS *)
- | SSH of Xml.uri (** SSH URI *)
+ | File of string (** local file or NFS *)
+ | SSH of Nbdkit_ssh.password * Xml.uri (** SSH URI *)
-val vmx_source_of_arg : [`SSH] option -> string -> vmx_source
+val vmx_source_of_arg : Nbdkit_ssh.password -> [`SSH] option -> string ->
+ vmx_source
val parse_domain_from_vmx : vmx_source -> Types.source * string list

View File

@ -0,0 +1,205 @@
From 40730615d2f691bc72777b4cb7356e2177edc1e1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 14:48:56 +0000
Subject: [PATCH] virt-v2v: -i vmx: Remove dependency of ssh.ml on Xml.uri
Xml.uri is a convenient way to pass the multiple ssh fields to
virt-v2v and is still used internally by the -i vmx code. However
don't leak this awkward implementation into the new ssh.ml module.
Like Nbdkit_ssh, we'll only deal with the explicit (password, port,
server, user, path) fields separately.
Note after this refactoring:
- The new Ssh module interface looks broadly similar to the
Nbdkit_ssh interface.
- vmx_source_of_arg assertions are no longer required inside the new
Ssh module, which was a mild layering violation before.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/input_vmx.ml | 21 ++++++++++++++++-----
input/parse_domain_from_vmx.ml | 22 +++++++++++++++++++---
input/ssh.ml | 32 +++++++++++---------------------
input/ssh.mli | 21 ++++++++++-----------
4 files changed, 56 insertions(+), 40 deletions(-)
diff --git a/input/input_vmx.ml b/input/input_vmx.ml
index b9cce10f..b3426fa2 100644
--- a/input/input_vmx.ml
+++ b/input/input_vmx.ml
@@ -83,22 +83,33 @@ module VMX = struct
let socket = sprintf "%s/in%d" dir i in
On_exit.unlink socket;
- let vmx_path = Ssh.path_of_uri uri in
+ let vmx_path =
+ match uri.uri_path with
+ | None -> assert false (* checked by vmx_source_of_arg *)
+ | Some path -> path in
let abs_path = absolute_path_from_other_file vmx_path filename in
let flat_vmdk = PCRE.replace (PCRE.compile "\\.vmdk$")
"-flat.vmdk" abs_path in
+ let server =
+ match uri.uri_server with
+ | None -> assert false (* checked by vmx_source_of_arg *)
+ | Some server -> server in
+ let port =
+ match uri.uri_port with
+ | i when i <= 0 -> None
+ | i -> Some (string_of_int i) in
+ let user = uri.Xml.uri_user in
+
(* RHBZ#1774386 *)
- if not (Ssh.remote_file_exists uri flat_vmdk) then
+ if not (Ssh.remote_file_exists ~password ?port ~server ?user
+ flat_vmdk) then
error (f_"This transport does not support guests with snapshots. \
Either collapse the snapshots for this guest and try \
the conversion again, or use one of the alternate \
conversion methods described in \
virt-v2v-input-vmware(1) section \"NOTES\".");
- let server = Ssh.server_of_uri uri in
- let port = Option.map string_of_int (Ssh.port_of_uri uri) in
- let user = uri.Xml.uri_user in
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ~password
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index 0719738c..99c86b1a 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -334,9 +334,22 @@ let parse_domain_from_vmx vmx_source =
let vmx =
match vmx_source with
| File filename -> Parse_vmx.parse_file filename
- | SSH (_, uri) ->
+ | SSH (password, uri) ->
+ let server =
+ match uri.uri_server with
+ | None -> assert false (* checked by vmx_source_of_arg *)
+ | Some server -> server in
+ let port =
+ match uri.uri_port with
+ | i when i <= 0 -> None
+ | i -> Some (string_of_int i) in
+ let user = uri.Xml.uri_user in
+ let path =
+ match uri.uri_path with
+ | None -> assert false (* checked by vmx_source_of_arg *)
+ | Some path -> path in
let filename = tmpdir // "source.vmx" in
- Ssh.download_file uri filename;
+ Ssh.download_file ~password ?port ~server ?user path filename;
Parse_vmx.parse_file filename in
let name =
@@ -346,7 +359,10 @@ let parse_domain_from_vmx vmx_source =
warning (f_"no displayName key found in VMX file");
match vmx_source with
| File filename -> name_from_disk filename
- | SSH (_, uri) -> name_from_disk (Ssh.path_of_uri uri) in
+ | SSH (_, uri) ->
+ match uri.uri_path with
+ | None -> assert false (* checked by vmx_source_of_arg *)
+ | Some path -> name_from_disk path in
let genid =
(* See: https://lists.nongnu.org/archive/html/qemu-devel/2018-07/msg02019.html *)
diff --git a/input/ssh.ml b/input/ssh.ml
index 63ffeb12..127e818c 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -22,29 +22,19 @@ open Common_gettext.Gettext
open Printf
-(* Return various fields from the URI. The checks in vmx_source_of_arg
- * should ensure that none of these assertions fail.
- *)
-let port_of_uri { Xml.uri_port } =
- match uri_port with i when i <= 0 -> None | i -> Some i
-let server_of_uri { Xml.uri_server } =
- match uri_server with None -> assert false | Some s -> s
-let path_of_uri { Xml.uri_path } =
- match uri_path with None -> assert false | Some p -> p
-
(* 'scp' a remote file into a local file. *)
-let download_file uri output =
+let download_file ~password:_ ?port ~server ?user path output =
let cmd =
sprintf "scp%s%s %s%s:%s %s"
(if verbose () then "" else " -q")
- (match port_of_uri uri with
+ (match port with
| None -> ""
- | Some port -> sprintf " -P %d" port)
- (match uri.Xml.uri_user with
+ | Some port -> sprintf " -P %s" port)
+ (match user with
| None -> ""
| Some user -> quote user ^ "@")
- (quote (server_of_uri uri))
- (quote (path_of_uri uri))
+ (quote server)
+ (quote path)
(quote output) in
if verbose () then
eprintf "%s\n%!" cmd;
@@ -53,16 +43,16 @@ let download_file uri output =
see earlier error messages")
(* Test if [path] exists on the remote server. *)
-let remote_file_exists uri path =
+let remote_file_exists ~password:_ ?port ~server ?user path =
let cmd =
sprintf "ssh%s %s%s test -f %s"
- (match port_of_uri uri with
+ (match port with
| None -> ""
- | Some port -> sprintf " -p %d" port)
- (match uri.Xml.uri_user with
+ | Some port -> sprintf " -p %s" port)
+ (match user with
| None -> ""
| Some user -> quote user ^ "@")
- (quote (server_of_uri uri))
+ (quote server)
(* Double quoting is necessary for 'ssh', first to protect
* from the local shell, second to protect from the remote
* shell. https://github.com/libguestfs/virt-v2v/issues/35#issuecomment-1741730963
diff --git a/input/ssh.mli b/input/ssh.mli
index 62e78bd3..1f39cd1b 100644
--- a/input/ssh.mli
+++ b/input/ssh.mli
@@ -18,16 +18,15 @@
(** Wrappers for finding and downloading remote files over ssh. *)
-val path_of_uri : Xml.uri -> string
-val server_of_uri : Xml.uri -> string
-val port_of_uri : Xml.uri -> int option
+(** [remote_file_exists password ?port server ?user path]
+ checks that [path] exists on the remote server. *)
+val remote_file_exists : password:Nbdkit_ssh.password ->
+ ?port:string -> server:string -> ?user:string ->
+ string -> bool
-(** [remote_file_exists ssh_uri path] checks that [path] exists
- on the remote server [ssh_uri] (note any path inside [ssh_uri]
- is ignored). *)
-val remote_file_exists : Xml.uri -> string -> bool
-
-(** [download_file ssh_uri output]
- uses scp to copy the single remote file at [ssh_uri] to
+(** [download_file password ?port server ?user path output]
+ uses scp to copy the single remote file at [path] to
the local file called [output]. *)
-val download_file : Xml.uri -> string -> unit
+val download_file : password:Nbdkit_ssh.password ->
+ ?port:string -> server:string -> ?user:string -> string ->
+ string -> unit

View File

@ -0,0 +1,55 @@
From 72c9734050f0235c80ff7d685282a57836a70bd5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 16:21:34 +0000
Subject: [PATCH] input/nbdkit_ssh: Make retry filter optional
This filter retries a request on failure. Add a flag to make this
filter optional, but default to using it if available (so there's no
change to default behaviour).
The reason we want to make this optional is that the next commit will
want to use nbdkit-ssh-plugin to probe to see if a remote file is
present, and we don't want to retry that probe on failure.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/nbdkit_ssh.ml | 6 ++++--
input/nbdkit_ssh.mli | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/input/nbdkit_ssh.ml b/input/nbdkit_ssh.ml
index 3f6da9b6..3b72d3ad 100644
--- a/input/nbdkit_ssh.ml
+++ b/input/nbdkit_ssh.ml
@@ -44,7 +44,8 @@ let error_unless_nbdkit_min_version config =
error_unless_nbdkit_version_ge config nbdkit_min_version
(* Create an nbdkit module specialized for reading from SSH sources. *)
-let create_ssh ?bandwidth ?cor ~password ?port ~server ?user path =
+let create_ssh ?bandwidth ?cor ?(retry=true)
+ ~password ?port ~server ?user path =
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
@@ -67,7 +68,8 @@ let create_ssh ?bandwidth ?cor ~password ?port ~server ?user path =
(* Retry filter (if it exists) can be used to get around brief
* interruptions in service. It must be closest to the plugin.
*)
- Nbdkit.add_filter_if_available cmd "retry";
+ if retry then
+ Nbdkit.add_filter_if_available cmd "retry";
(* Caching extents speeds up qemu-img, especially its consecutive
* block_status requests with req_one=1.
diff --git a/input/nbdkit_ssh.mli b/input/nbdkit_ssh.mli
index bc798c5a..daa20bb2 100644
--- a/input/nbdkit_ssh.mli
+++ b/input/nbdkit_ssh.mli
@@ -25,6 +25,7 @@ type password =
val create_ssh : ?bandwidth:Types.bandwidth ->
?cor:string ->
+ ?retry:bool ->
password:password ->
?port:string ->
server:string ->

View File

@ -0,0 +1,167 @@
From fb72e059863a60503b6011b8590c25c3a010a58f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 15 Jan 2024 15:38:30 +0000
Subject: [PATCH] virt-v2v: -i vmx: Replace external ssh/scp with
nbdkit-ssh-plugin
If you use a -i vmx ssh filename containing '*' then it will expand
the glob at the remote side. New scp is weird and silently creates a
directory on the local side. For example suppose there's a remote
file literally called "/tmp/test*" (ie. the '*' is part of the
filename) and you thought you could copy that to local using:
scp 'remote:/tmp/test*' '/tmp/test*'
scp treats the first parameter (only) as a wildcard and if there are
multiple files matching the wildcard /tmp/test*, will create a local
directory literally called "/tmp/test*/" and put the files into it.
Who expected any of that?
You might think that double quoting (as we used to use) might work,
but that breaks with spaces and quotes. I guess scp is using
different code paths internally for glob versus everything else.
The only way to really make this work is to stop using scp entirely
and just use sftp directly. The easiest way to use sftp is to use
nbdkit-ssh-plugin. We already depend on nbdkit-ssh-plugin, nbdcopy
and nbdinfo for other parts of virt-v2v, so might as well use the
whole lot here.
One advantage of this change is that now the -ip (input password)
parameter actually works in -i vmx -it ssh mode.
Other approaches that would have been possible:
- Use the OCaml NBD library instead of nbdcopy/nbdinfo
- Use 'nbdkit -U - ssh --run ...'
- Direct binding to libssh.
See also commit e2af12ba69c4463bb73d30db63290a887cdd41eb
("input: -i vmx: Remove support for openssh scp < 8.8")
See also commit 22c5b98ab78c734b478c26e14ee62e2a065aaa0c
("-it ssh: Double quote ssh command which tests remote file exists")
See also https://unix.stackexchange.com/a/587710
Reported-by: Ming Xie
Fixes: https://issues.redhat.com/browse/RHEL-21365
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
---
input/ssh.ml | 70 +++++++++++++++++++++++++--------------------------
input/ssh.mli | 7 ++++--
2 files changed, 40 insertions(+), 37 deletions(-)
diff --git a/input/ssh.ml b/input/ssh.ml
index 127e818c..71ebbf2a 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -18,46 +18,46 @@
open Std_utils
open Tools_utils
+open Unix_utils
open Common_gettext.Gettext
open Printf
-(* 'scp' a remote file into a local file. *)
-let download_file ~password:_ ?port ~server ?user path output =
- let cmd =
- sprintf "scp%s%s %s%s:%s %s"
- (if verbose () then "" else " -q")
- (match port with
- | None -> ""
- | Some port -> sprintf " -P %s" port)
- (match user with
- | None -> ""
- | Some user -> quote user ^ "@")
- (quote server)
- (quote path)
- (quote output) in
- if verbose () then
- eprintf "%s\n%!" cmd;
- if Sys.command cmd <> 0 then
+let start_nbdkit ~password ?port ~server ?user path =
+ (* Create a random location for the socket used to talk to nbdkit. *)
+ let sockdir = Mkdtemp.temp_dir "v2vssh." in
+ On_exit.rm_rf sockdir;
+ let id = unique () in
+ let socket = sockdir // sprintf "nbdkit%d.sock" id in
+
+ (* Note: Disabling the retry filter helps in the missing file case,
+ * otherwise nbdkit takes ages to time out. We're not expecting that
+ * the VMX file is large, so using this filter isn't necessary.
+ *)
+ let nbdkit =
+ Nbdkit_ssh.create_ssh ~retry:false ~password ~server ?port ?user path in
+ Nbdkit.set_readonly nbdkit true;
+ let _, pid = Nbdkit.run_unix socket nbdkit in
+ On_exit.kill pid;
+
+ (* Return the URI of nbdkit. *)
+ "nbd+unix://?socket=" ^ socket
+
+(* Download a remote file into a local file. *)
+let download_file ~password ?port ~server ?user path output =
+ let uri = start_nbdkit ~password ?port ~server ?user path in
+
+ let cmd = [ "nbdcopy"; uri; output ] in
+ if run_command cmd <> 0 then
error (f_"could not copy the VMX file from the remote server, \
see earlier error messages")
(* Test if [path] exists on the remote server. *)
-let remote_file_exists ~password:_ ?port ~server ?user path =
- let cmd =
- sprintf "ssh%s %s%s test -f %s"
- (match port with
- | None -> ""
- | Some port -> sprintf " -p %s" port)
- (match user with
- | None -> ""
- | Some user -> quote user ^ "@")
- (quote server)
- (* Double quoting is necessary for 'ssh', first to protect
- * from the local shell, second to protect from the remote
- * shell. https://github.com/libguestfs/virt-v2v/issues/35#issuecomment-1741730963
- *)
- (quote (quote path)) in
- if verbose () then
- eprintf "%s\n%!" cmd;
- Sys.command cmd = 0
+let remote_file_exists ~password ?port ~server ?user path =
+ let uri = start_nbdkit ~password ?port ~server ?user path in
+
+ (* Testing for remote size using nbdinfo should be sufficient to
+ * prove the remote file exists.
+ *)
+ let cmd = [ "nbdinfo"; "--size"; uri ] in
+ run_command cmd = 0
diff --git a/input/ssh.mli b/input/ssh.mli
index 1f39cd1b..40843024 100644
--- a/input/ssh.mli
+++ b/input/ssh.mli
@@ -16,7 +16,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
-(** Wrappers for finding and downloading remote files over ssh. *)
+(** Wrappers for finding and downloading remote files over ssh.
+
+ Internally this uses nbdkit-ssh-plugin (which uses sftp) as
+ that is much more predictable than running external ssh / scp. *)
(** [remote_file_exists password ?port server ?user path]
checks that [path] exists on the remote server. *)
@@ -25,7 +28,7 @@ val remote_file_exists : password:Nbdkit_ssh.password ->
string -> bool
(** [download_file password ?port server ?user path output]
- uses scp to copy the single remote file at [path] to
+ downloads the single remote file at [path] to
the local file called [output]. *)
val download_file : password:Nbdkit_ssh.password ->
?port:string -> server:string -> ?user:string -> string ->

View File

@ -0,0 +1,255 @@
From a99d9f2afee17688ec07e2ea0b130341a0cabce2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 16 Jan 2024 10:27:30 +0000
Subject: [PATCH] input/nbdkit_ssh: Make password parameter optional
Instead of storing an explicit NoPassword case, make the password
parameter optional and encode NoPassword as None. This is simple
refactoring.
---
input/input_vmx.ml | 8 ++++----
input/input_xen_ssh.ml | 6 +++---
input/nbdkit_ssh.ml | 13 ++++++-------
input/nbdkit_ssh.mli | 9 ++++-----
input/parse_domain_from_vmx.ml | 6 +++---
input/parse_domain_from_vmx.mli | 8 ++++----
input/ssh.ml | 12 ++++++------
input/ssh.mli | 8 ++++----
8 files changed, 34 insertions(+), 36 deletions(-)
diff --git a/input/input_vmx.ml b/input/input_vmx.ml
index b3426fa2..f81a9674 100644
--- a/input/input_vmx.ml
+++ b/input/input_vmx.ml
@@ -47,8 +47,8 @@ module VMX = struct
| [arg] ->
let input_password =
match options.input_password with
- | None -> Nbdkit_ssh.NoPassword
- | Some ip -> Nbdkit_ssh.PasswordFile ip in
+ | None -> None
+ | Some ip -> Some (Nbdkit_ssh.PasswordFile ip) in
let input_transport =
match options.input_transport with
| None -> None
@@ -102,7 +102,7 @@ module VMX = struct
let user = uri.Xml.uri_user in
(* RHBZ#1774386 *)
- if not (Ssh.remote_file_exists ~password ?port ~server ?user
+ if not (Ssh.remote_file_exists ?password ?port ~server ?user
flat_vmdk) then
error (f_"This transport does not support guests with snapshots. \
Either collapse the snapshots for this guest and try \
@@ -112,7 +112,7 @@ module VMX = struct
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
- let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ~password
+ let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ?password
~server ?port ?user flat_vmdk in
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid
diff --git a/input/input_xen_ssh.ml b/input/input_xen_ssh.ml
index b583bd55..c4235a4b 100644
--- a/input/input_xen_ssh.ml
+++ b/input/input_xen_ssh.ml
@@ -96,8 +96,8 @@ module XenSSH = struct
let password =
match options.input_password with
- | None -> Nbdkit_ssh.NoPassword
- | Some ip -> Nbdkit_ssh.PasswordFile ip in
+ | None -> None
+ | Some ip -> Some (Nbdkit_ssh.PasswordFile ip) in
(* Create an nbdkit instance for each disk. *)
List.iteri (
@@ -122,7 +122,7 @@ module XenSSH = struct
| LocalFile path ->
let cor = dir // "convert" in
let bandwidth = options.bandwidth in
- let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ~password
+ let nbdkit = Nbdkit_ssh.create_ssh ?bandwidth ~cor ?password
?port ~server ?user path in
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid
diff --git a/input/nbdkit_ssh.ml b/input/nbdkit_ssh.ml
index 3b72d3ad..bc96df13 100644
--- a/input/nbdkit_ssh.ml
+++ b/input/nbdkit_ssh.ml
@@ -28,9 +28,8 @@ open Utils
let nbdkit_min_version = (1, 12, 0)
type password =
-| NoPassword (* no password option at all *)
-| AskForPassword (* password=- *)
-| PasswordFile of string (* password=+file *)
+ | AskForPassword
+ | PasswordFile of string
let error_unless_nbdkit_version_ge config min_version =
let version = Nbdkit.version config in
@@ -45,7 +44,7 @@ let error_unless_nbdkit_min_version config =
(* Create an nbdkit module specialized for reading from SSH sources. *)
let create_ssh ?bandwidth ?cor ?(retry=true)
- ~password ?port ~server ?user path =
+ ?password ?port ~server ?user path =
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
@@ -108,8 +107,8 @@ let create_ssh ?bandwidth ?cor ?(retry=true)
(* Handle the password parameter specially. *)
(match password with
- | NoPassword -> ()
- | AskForPassword ->
+ | None -> ()
+ | Some AskForPassword ->
(* Because we will start nbdkit in the background and then wait
* for 30 seconds for it to start up, we cannot use the
* password=- feature of nbdkit to read the password
@@ -130,7 +129,7 @@ let create_ssh ?bandwidth ?cor ?(retry=true)
On_exit.unlink password_file;
with_open_out password_file (fun chan -> output_string chan password);
Nbdkit.add_arg cmd "password" ("+" ^ password_file)
- | PasswordFile password_file ->
+ | Some (PasswordFile password_file) ->
Nbdkit.add_arg cmd "password" ("+" ^ password_file)
);
diff --git a/input/nbdkit_ssh.mli b/input/nbdkit_ssh.mli
index daa20bb2..8ea8dea4 100644
--- a/input/nbdkit_ssh.mli
+++ b/input/nbdkit_ssh.mli
@@ -18,15 +18,14 @@
(** nbdkit when used as a source. *)
-type password =
-| NoPassword
-| AskForPassword
-| PasswordFile of string
+type password = (** Use [None] for no password *)
+ | AskForPassword (** [password=-] *)
+ | PasswordFile of string (** [password=+file] *)
val create_ssh : ?bandwidth:Types.bandwidth ->
?cor:string ->
?retry:bool ->
- password:password ->
+ ?password:password ->
?port:string ->
server:string ->
?user:string ->
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
index 99c86b1a..eeac6597 100644
--- a/input/parse_domain_from_vmx.ml
+++ b/input/parse_domain_from_vmx.ml
@@ -29,8 +29,8 @@ open Utils
open Name_from_disk
type vmx_source =
- | File of string (* local file or NFS *)
- | SSH of Nbdkit_ssh.password * Xml.uri (* SSH URI *)
+ | File of string (* local file or NFS *)
+ | SSH of Nbdkit_ssh.password option * Xml.uri (* SSH URI *)
(* The single filename on the command line is intepreted either as
* a local file or a remote SSH URI (only if -it ssh).
@@ -349,7 +349,7 @@ let parse_domain_from_vmx vmx_source =
| None -> assert false (* checked by vmx_source_of_arg *)
| Some path -> path in
let filename = tmpdir // "source.vmx" in
- Ssh.download_file ~password ?port ~server ?user path filename;
+ Ssh.download_file ?password ?port ~server ?user path filename;
Parse_vmx.parse_file filename in
let name =
diff --git a/input/parse_domain_from_vmx.mli b/input/parse_domain_from_vmx.mli
index 208797a7..e26a1035 100644
--- a/input/parse_domain_from_vmx.mli
+++ b/input/parse_domain_from_vmx.mli
@@ -17,9 +17,9 @@
*)
type vmx_source =
- | File of string (** local file or NFS *)
- | SSH of Nbdkit_ssh.password * Xml.uri (** SSH URI *)
+ | File of string (** local file or NFS *)
+ | SSH of Nbdkit_ssh.password option * Xml.uri (** SSH URI *)
-val vmx_source_of_arg : Nbdkit_ssh.password -> [`SSH] option -> string ->
- vmx_source
+val vmx_source_of_arg : Nbdkit_ssh.password option -> [`SSH] option ->
+ string -> vmx_source
val parse_domain_from_vmx : vmx_source -> Types.source * string list
diff --git a/input/ssh.ml b/input/ssh.ml
index 71ebbf2a..10c61bbf 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -23,7 +23,7 @@ open Common_gettext.Gettext
open Printf
-let start_nbdkit ~password ?port ~server ?user path =
+let start_nbdkit ?password ?port ~server ?user path =
(* Create a random location for the socket used to talk to nbdkit. *)
let sockdir = Mkdtemp.temp_dir "v2vssh." in
On_exit.rm_rf sockdir;
@@ -35,7 +35,7 @@ let start_nbdkit ~password ?port ~server ?user path =
* the VMX file is large, so using this filter isn't necessary.
*)
let nbdkit =
- Nbdkit_ssh.create_ssh ~retry:false ~password ~server ?port ?user path in
+ Nbdkit_ssh.create_ssh ~retry:false ?password ~server ?port ?user path in
Nbdkit.set_readonly nbdkit true;
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid;
@@ -44,8 +44,8 @@ let start_nbdkit ~password ?port ~server ?user path =
"nbd+unix://?socket=" ^ socket
(* Download a remote file into a local file. *)
-let download_file ~password ?port ~server ?user path output =
- let uri = start_nbdkit ~password ?port ~server ?user path in
+let download_file ?password ?port ~server ?user path output =
+ let uri = start_nbdkit ?password ?port ~server ?user path in
let cmd = [ "nbdcopy"; uri; output ] in
if run_command cmd <> 0 then
@@ -53,8 +53,8 @@ let download_file ~password ?port ~server ?user path output =
see earlier error messages")
(* Test if [path] exists on the remote server. *)
-let remote_file_exists ~password ?port ~server ?user path =
- let uri = start_nbdkit ~password ?port ~server ?user path in
+let remote_file_exists ?password ?port ~server ?user path =
+ let uri = start_nbdkit ?password ?port ~server ?user path in
(* Testing for remote size using nbdinfo should be sufficient to
* prove the remote file exists.
diff --git a/input/ssh.mli b/input/ssh.mli
index 40843024..6d9f1370 100644
--- a/input/ssh.mli
+++ b/input/ssh.mli
@@ -21,15 +21,15 @@
Internally this uses nbdkit-ssh-plugin (which uses sftp) as
that is much more predictable than running external ssh / scp. *)
-(** [remote_file_exists password ?port server ?user path]
+(** [remote_file_exists ?password ?port server ?user path]
checks that [path] exists on the remote server. *)
-val remote_file_exists : password:Nbdkit_ssh.password ->
+val remote_file_exists : ?password:Nbdkit_ssh.password ->
?port:string -> server:string -> ?user:string ->
string -> bool
-(** [download_file password ?port server ?user path output]
+(** [download_file ?password ?port server ?user path output]
downloads the single remote file at [path] to
the local file called [output]. *)
-val download_file : password:Nbdkit_ssh.password ->
+val download_file : ?password:Nbdkit_ssh.password ->
?port:string -> server:string -> ?user:string -> string ->
string -> unit

View File

@ -0,0 +1,104 @@
From 4f0758a95a4b32a5c837cf86d2fa4442d3e136ec Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 16 Jan 2024 10:31:50 +0000
Subject: [PATCH] input/ssh: Rearrange parameters specifying ssh server
---
input/nbdkit_ssh.ml | 2 +-
input/nbdkit_ssh.mli | 4 ++--
input/ssh.ml | 10 +++++-----
input/ssh.mli | 13 +++++++------
4 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/input/nbdkit_ssh.ml b/input/nbdkit_ssh.ml
index bc96df13..ae93e4e8 100644
--- a/input/nbdkit_ssh.ml
+++ b/input/nbdkit_ssh.ml
@@ -44,7 +44,7 @@ let error_unless_nbdkit_min_version config =
(* Create an nbdkit module specialized for reading from SSH sources. *)
let create_ssh ?bandwidth ?cor ?(retry=true)
- ?password ?port ~server ?user path =
+ ~server ?port ?user ?password path =
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
diff --git a/input/nbdkit_ssh.mli b/input/nbdkit_ssh.mli
index 8ea8dea4..c26f539a 100644
--- a/input/nbdkit_ssh.mli
+++ b/input/nbdkit_ssh.mli
@@ -25,10 +25,10 @@ type password = (** Use [None] for no password *)
val create_ssh : ?bandwidth:Types.bandwidth ->
?cor:string ->
?retry:bool ->
- ?password:password ->
- ?port:string ->
server:string ->
+ ?port:string ->
?user:string ->
+ ?password:password ->
string -> Nbdkit.cmd
(** Create a nbdkit object using the SSH plugin. The required
string parameter is the remote path.
diff --git a/input/ssh.ml b/input/ssh.ml
index 10c61bbf..d3b6dc0c 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -23,7 +23,7 @@ open Common_gettext.Gettext
open Printf
-let start_nbdkit ?password ?port ~server ?user path =
+let start_nbdkit ~server ?port ?user ?password path =
(* Create a random location for the socket used to talk to nbdkit. *)
let sockdir = Mkdtemp.temp_dir "v2vssh." in
On_exit.rm_rf sockdir;
@@ -44,8 +44,8 @@ let start_nbdkit ?password ?port ~server ?user path =
"nbd+unix://?socket=" ^ socket
(* Download a remote file into a local file. *)
-let download_file ?password ?port ~server ?user path output =
- let uri = start_nbdkit ?password ?port ~server ?user path in
+let download_file ~server ?port ?user ?password path output =
+ let uri = start_nbdkit ~server ?port ?user ?password path in
let cmd = [ "nbdcopy"; uri; output ] in
if run_command cmd <> 0 then
@@ -53,8 +53,8 @@ let download_file ?password ?port ~server ?user path output =
see earlier error messages")
(* Test if [path] exists on the remote server. *)
-let remote_file_exists ?password ?port ~server ?user path =
- let uri = start_nbdkit ?password ?port ~server ?user path in
+let remote_file_exists ~server ?port ?user ?password path =
+ let uri = start_nbdkit ~server ?port ?user ?password path in
(* Testing for remote size using nbdinfo should be sufficient to
* prove the remote file exists.
diff --git a/input/ssh.mli b/input/ssh.mli
index 6d9f1370..ebce46ff 100644
--- a/input/ssh.mli
+++ b/input/ssh.mli
@@ -21,15 +21,16 @@
Internally this uses nbdkit-ssh-plugin (which uses sftp) as
that is much more predictable than running external ssh / scp. *)
-(** [remote_file_exists ?password ?port server ?user path]
+(** [remote_file_exists server ?port ?user ?password path]
checks that [path] exists on the remote server. *)
-val remote_file_exists : ?password:Nbdkit_ssh.password ->
- ?port:string -> server:string -> ?user:string ->
+val remote_file_exists : server:string -> ?port:string ->
+ ?user:string -> ?password:Nbdkit_ssh.password ->
string -> bool
-(** [download_file ?password ?port server ?user path output]
+(** [download_file server ?port ?user ?password path output]
downloads the single remote file at [path] to
the local file called [output]. *)
-val download_file : ?password:Nbdkit_ssh.password ->
- ?port:string -> server:string -> ?user:string -> string ->
+val download_file : server:string -> ?port:string ->
+ ?user:string -> ?password:Nbdkit_ssh.password ->
+ string ->
string -> unit

View File

@ -0,0 +1,54 @@
From 67fcf66904c7f1f6da858eba35e95dad670427c0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 17 Jan 2024 14:16:10 +0000
Subject: [PATCH] docs: Remove paragraph about -ip passwords and ssh/scp
The documentation suggested (correctly) that the -ip option did not
cover all cases where we make an ssh connection to either VMware or
Xen. However with the recent change where we use nbdkit-ssh-plugin in
preference to ssh/scp (commit fb72e05986, "virt-v2v: -i vmx: Replace
external ssh/scp with nbdkit-ssh-plugin") this should no longer be
true for VMware. And I don't think it was true for Xen for a while.
Therefore remove this paragraph in the documentation (in two places).
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1854275
See-also: https://lists.libguestfs.org/archives/list/guestfs@lists.libguestfs.org/thread/CKBEYJHUZWLDUUDWAJM2JU6QIKZGTD6F/
Suggested-by: Laszlo Ersek
---
docs/virt-v2v-input-vmware.pod | 5 -----
docs/virt-v2v-input-xen.pod | 5 -----
2 files changed, 10 deletions(-)
diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
index 48849f88..fe59222a 100644
--- a/docs/virt-v2v-input-vmware.pod
+++ b/docs/virt-v2v-input-vmware.pod
@@ -155,11 +155,6 @@ virt-v2v server to the ESXi hypervisor. For example:
$ ssh root@esxi.example.com
[ logs straight into the shell, no password is requested ]
-Note that support for non-interactive authentication via the I<-ip>
-option is incomplete. Some operations remain that still require the
-user to enter the password manually. Therefore ssh-agent is recommended
-over the I<-ip> option. See L<https://bugzilla.redhat.com/1854275>.
-
=head3 VMX: Construct the SSH URI
When using the SSH input transport you must specify a remote
diff --git a/docs/virt-v2v-input-xen.pod b/docs/virt-v2v-input-xen.pod
index 4a0544f8..38dc8f7b 100644
--- a/docs/virt-v2v-input-xen.pod
+++ b/docs/virt-v2v-input-xen.pod
@@ -32,11 +32,6 @@ server to the Xen host. For example:
$ ssh root@xen.example.com
[ logs straight into the shell, no password is requested ]
-Note that support for non-interactive authentication via the I<-ip>
-option is incomplete. Some operations remain that still require the
-user to enter the password manually. Therefore ssh-agent is recommended
-over the I<-ip> option. See L<https://bugzilla.redhat.com/1854275>.
-
With some modern ssh implementations, legacy crypto algorithms required
to interoperate with RHEL 5 sshd are disabled. To enable them, you may
need to add the following C<Host> stanza to your F<~/.ssh/config>:

View File

@ -0,0 +1,62 @@
From 970d7123c2025bc148870f4bc6fa75fa9e95905f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jan 2024 17:22:26 +0000
Subject: [PATCH] input/ssh: Use nbdinfo --can connect (instead of --size)
nbdinfo --size prints the size on stdout, causing it to appear in
virt-v2v output. Using --can connect instead is silent.
Note that nbdinfo --can connect was added in libnbd 1.9.2 (Jul 2021)
and our previous minimum version of libnbd was 1.9.3 so we're OK.
However since neither of these was a stable version I also updated the
minimum libnbd requirement to 1.10 (Sep 2021), and added a proper
check in ./configure
Fixes: commit fb72e059863a60503b6011b8590c25c3a010a58f
---
README | 2 +-
input/ssh.ml | 4 ++--
m4/guestfs-libraries.m4 | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/README b/README
index 5810f77d..f94bd6de 100644
--- a/README
+++ b/README
@@ -51,7 +51,7 @@ REQUIREMENTS
* OCaml bindings for libvirt (https://gitlab.com/libvirt/libvirt-ocaml)
-* libnbd >= 1.9.3 (https://gitlab.com/nbdkit/libnbd)
+* libnbd >= 1.10 (https://gitlab.com/nbdkit/libnbd)
* OCaml bindings for libnbd
diff --git a/input/ssh.ml b/input/ssh.ml
index d3b6dc0c..e35a2b5a 100644
--- a/input/ssh.ml
+++ b/input/ssh.ml
@@ -56,8 +56,8 @@ let download_file ~server ?port ?user ?password path output =
let remote_file_exists ~server ?port ?user ?password path =
let uri = start_nbdkit ~server ?port ?user ?password path in
- (* Testing for remote size using nbdinfo should be sufficient to
+ (* Testing that we can connect to the nbdkit server is enough to
* prove the remote file exists.
*)
- let cmd = [ "nbdinfo"; "--size"; uri ] in
+ let cmd = [ "nbdinfo"; "--can"; "connect"; uri ] in
run_command cmd = 0
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 33b5100e..6789a2cb 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -21,7 +21,7 @@ dnl Of course we need libguestfs.
PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.44])
dnl And libnbd.
-PKG_CHECK_MODULES([LIBNBD], [libnbd])
+PKG_CHECK_MODULES([LIBNBD], [libnbd >= 1.10])
dnl Test if it's GNU or XSI strerror_r.
AC_FUNC_STRERROR_R

View File

@ -0,0 +1,43 @@
From aafcd0d11453d8d58a32e66285f12ec3ba3440de Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jan 2024 17:32:01 +0000
Subject: [PATCH] build: Document that nbdinfo and nbdcopy are required, and
check
Update README to document that these tools have been needed (ever
since virt-v2v 2.0), and update ./configure to check it.
---
README | 2 ++
m4/guestfs-progs.m4 | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/README b/README
index f94bd6de..4354754f 100644
--- a/README
+++ b/README
@@ -53,6 +53,8 @@ REQUIREMENTS
* libnbd >= 1.10 (https://gitlab.com/nbdkit/libnbd)
+* The 'nbdinfo' and 'nbdcopy' programs from libnbd.
+
* OCaml bindings for libnbd
* nbdkit >= 1.27.4 (https://gitlab.com/nbdkit/nbdkit)
diff --git a/m4/guestfs-progs.m4 b/m4/guestfs-progs.m4
index 7c5f0d81..ae5094ce 100644
--- a/m4/guestfs-progs.m4
+++ b/m4/guestfs-progs.m4
@@ -59,6 +59,12 @@ AM_CONDITIONAL([HAVE_ZIP],[test "x$ZIP" != "xno"])
AC_PATH_PROGS([UNZIP],[unzip],[no])
AC_DEFINE_UNQUOTED([UNZIP],["$UNZIP"],[Name of unzip program.])
+dnl nbdinfo, nbdcopy, required by virt-v2v
+AC_CHECK_PROG([NBDINFO], [nbdinfo], [nbdinfo], [no])
+AC_CHECK_PROG([NBDCOPY], [nbdcopy], [nbdcopy], [no])
+AS_IF([test "x$NBDINFO" = "xno" || test "x$NBDCOPY" = "xno"],
+ [AC_MSG_ERROR([nbdinfo and nbdcopy (from libnbd) must be installed])])
+
dnl Check for valgrind
AC_CHECK_PROG([VALGRIND],[valgrind],[valgrind],[no])
AS_IF([test "x$VALGRIND" != "xno"],[

132
0015-Version-2.5.1.patch Normal file
View File

@ -0,0 +1,132 @@
From 2d2ee75166abd6ccae28b71f474b734341997e63 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 18 Jan 2024 17:25:54 +0000
Subject: [PATCH] Version 2.5.1.
---
configure.ac | 4 ++--
po/POTFILES-ml | 1 +
po/virt-v2v.pot | 22 +++++++++++-----------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/configure.ac b/configure.ac
index 622563ff..2e630d87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,8 +19,8 @@
# add extra information using --with-extra="..." which may be any
# freeform string.
m4_define([v2v_major], [2])
-m4_define([v2v_minor], [4])
-m4_define([v2v_release], [0])
+m4_define([v2v_minor], [5])
+m4_define([v2v_release], [1])
AC_INIT([virt-v2v],v2v_major.v2v_minor.v2v_release)
diff --git a/po/POTFILES-ml b/po/POTFILES-ml
index 5b0f99aa..ec98cecf 100644
--- a/po/POTFILES-ml
+++ b/po/POTFILES-ml
@@ -52,6 +52,7 @@ input/nbdkit_vddk.ml
input/parse_domain_from_vmx.ml
input/parse_libvirt_xml.ml
input/parse_vmx.ml
+input/ssh.ml
input/vCenter.ml
inspector/inspector.ml
lib/YAML.ml
diff --git a/po/virt-v2v.pot b/po/virt-v2v.pot
index 4c6334ee..ad814ad8 100644
--- a/po/virt-v2v.pot
+++ b/po/virt-v2v.pot
@@ -6,10 +6,10 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: virt-v2v 2.4.0\n"
+"Project-Id-Version: virt-v2v 2.5.1\n"
"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?"
"component=libguestfs&product=Virtualization+Tools\n"
-"POT-Creation-Date: 2024-01-04 17:06+0000\n"
+"POT-Creation-Date: 2024-01-18 17:14+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -203,11 +203,11 @@ msgid ""
"-i ova: invalid OVA file: path %s references a file outside the archive"
msgstr ""
-#: input/input_vmx.ml:53
+#: input/input_vmx.ml:57
msgid "-i vmx: cannot use -it vddk in this input mode"
msgstr ""
-#: input/input_vmx.ml:56
+#: input/input_vmx.ml:60
msgid "-i vmx: expecting a VMX file or ssh:// URI"
msgstr ""
@@ -993,7 +993,7 @@ msgid ""
"require a separate password to connect."
msgstr ""
-#: input/input_vmx.ml:89
+#: input/input_vmx.ml:107
msgid ""
"This transport does not support guests with snapshots. Either collapse the "
"snapshots for this guest and try the conversion again, or use one of the "
@@ -1171,7 +1171,7 @@ msgstr ""
msgid "could not add grub2 serial console (ignored)"
msgstr ""
-#: input/parse_domain_from_vmx.ml:85
+#: input/ssh.ml:52
msgid ""
"could not copy the VMX file from the remote server, see earlier error "
"messages"
@@ -1505,7 +1505,7 @@ msgstr ""
msgid "invalid -n/--network parameter"
msgstr ""
-#: input/parse_domain_from_vmx.ml:440
+#: input/parse_domain_from_vmx.ml:402
msgid "invalid cpuid.coresPerSocket < number of vCPUs"
msgstr ""
@@ -1678,7 +1678,7 @@ msgstr ""
msgid "nbdkit is not new enough, you need to upgrade to nbdkit ≥ %s"
msgstr ""
-#: input/nbdkit_vddk.ml:40 input/nbdkit_ssh.ml:39 input/nbdkit_curl.ml:32
+#: input/nbdkit_vddk.ml:40 input/nbdkit_ssh.ml:38 input/nbdkit_curl.ml:32
msgid "nbdkit is too old. nbdkit >= %d.%d.%d is required."
msgstr ""
@@ -1751,7 +1751,7 @@ msgstr ""
msgid "no bootloader detected"
msgstr ""
-#: input/parse_domain_from_vmx.ml:400
+#: input/parse_domain_from_vmx.ml:359
msgid "no displayName key found in VMX file"
msgstr ""
@@ -2116,7 +2116,7 @@ msgstr ""
msgid "unknown block driver --block-driver %s"
msgstr ""
-#: input/parse_domain_from_vmx.ml:453
+#: input/parse_domain_from_vmx.ml:415
msgid "unknown firmware value '%s', assuming BIOS"
msgstr ""
@@ -2128,7 +2128,7 @@ msgstr ""
msgid "unknown input transport -it %s"
msgstr ""
-#: input/parse_domain_from_vmx.ml:462
+#: input/parse_domain_from_vmx.ml:424
msgid "unknown sound device '%s' ignored"
msgstr ""

View File

@ -1,4 +1,4 @@
From 9a814bbb788b8c1e353ac16a3117af7ebdea7f96 Mon Sep 17 00:00:00 2001
From 77924fa409b5239615a797646eb293ab412d5ae1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Sep 2014 19:14:43 +0100
Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode

View File

@ -1,4 +1,4 @@
From 601bcb0602e1944c4350ce612dd838e0e6895f6a Mon Sep 17 00:00:00 2001
From fce209290507857a5e26f4bf153f42f0a95f2a48 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Sep 2014 10:50:27 +0100
Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option
@ -44,10 +44,10 @@ index d2a1c270..0be37f5e 100644
=item B<-o null>
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index ac15108a..e993e21a 100644
index bc946dc1..55545e11 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -144,11 +144,6 @@ Since F<guest-domain.xml> contains the path(s) to the guest disk
@@ -146,11 +146,6 @@ Since F<guest-domain.xml> contains the path(s) to the guest disk
image(s) you do not need to specify the name of the disk image on the
command line.
@ -59,7 +59,7 @@ index ac15108a..e993e21a 100644
=head1 OPTIONS
=over 4
@@ -520,9 +515,6 @@ This is similar to I<-o local>, except that a shell script is written
@@ -522,9 +517,6 @@ This is similar to I<-o local>, except that a shell script is written
which you can use to boot the guest in qemu. The converted disks and
shell script are written to the directory specified by I<-os>.
@ -69,7 +69,7 @@ index ac15108a..e993e21a 100644
=item B<-o> B<rhev>
This is the same as I<-o rhv>.
@@ -601,11 +593,6 @@ For I<-o openstack> (L<virt-v2v-output-openstack(1)>) only, set a guest ID
@@ -603,11 +595,6 @@ For I<-o openstack> (L<virt-v2v-output-openstack(1)>) only, set a guest ID
which is saved on each Cinder volume in the C<virt_v2v_guest_id>
volume property.
@ -81,7 +81,7 @@ index ac15108a..e993e21a 100644
=item B<-oo verify-server-certificate>
=item B<-oo verify-server-certificate=>C<true|false>
@@ -776,10 +763,6 @@ Print information about the source guest and stop. This option is
@@ -778,10 +765,6 @@ Print information about the source guest and stop. This option is
useful when you are setting up network and bridge maps.
See L</Networks and bridges>.

View File

@ -1,4 +1,4 @@
From 5dfbc9275e29c24d8c31652379e76b9cc7cb2988 Mon Sep 17 00:00:00 2001
From 9b3d4513662f52a17c61468efcb9ec9d3915612f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu

View File

@ -1,4 +1,4 @@
From 1ea4fcbb9e4794cd59efe482cf122608dd0a0689 Mon Sep 17 00:00:00 2001
From 0c24b94cc16c51a72d927a534af446b9b21f30b5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.

View File

@ -1,4 +1,4 @@
From 68a5971a7b214e2d29c4ccba23efef4e0624e294 Mon Sep 17 00:00:00 2001
From 943c16948ef5fd7adee045875e52e5d3202eca09 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2017 14:21:37 +0100
Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)

View File

@ -1,4 +1,4 @@
From a291a35c4b51455707c5f2540994324c784f0d5c Mon Sep 17 00:00:00 2001
From 2a1a6cb793ee4d0840ef51ee97d77242960660d4 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 8 Mar 2017 11:03:40 +0100
Subject: [PATCH] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)
@ -9,7 +9,7 @@ They are not supported in RHEL.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/virt-v2v-input-xen.pod b/docs/virt-v2v-input-xen.pod
index 4a0544f8..9c3981e1 100644
index 38dc8f7b..05c4e3f5 100644
--- a/docs/virt-v2v-input-xen.pod
+++ b/docs/virt-v2v-input-xen.pod
@@ -11,7 +11,7 @@ virt-v2v-input-xen - Using virt-v2v to convert guests from Xen

View File

@ -1,4 +1,4 @@
From 5ddad54bc131bbdd88c39640957924c077e5456e Mon Sep 17 00:00:00 2001
From 07242da3ffd27a686bfe9913d8eb9a8d6a9881d8 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 09:42:25 +0100
Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests

View File

@ -1,4 +1,4 @@
From 8ccb0f161424ba54fb48cc8b6c9734eeca49267f Mon Sep 17 00:00:00 2001
From 330933e88be20150a3caf1d03e565cbefa79bbb8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH] RHEL: Disable -o glance
@ -98,10 +98,10 @@ index cd4862b1..54cd276e 100644
=head1 AUTHOR
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index e993e21a..a5c844f1 100644
index 55545e11..8d5d54d3 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -433,14 +433,6 @@ See L</Networks and bridges> below.
@@ -435,14 +435,6 @@ See L</Networks and bridges> below.
This is the same as I<-o local>.
@ -116,7 +116,7 @@ index e993e21a..a5c844f1 100644
=item B<-o> B<kubevirt>
Set the output method to I<kubevirt>. B<Note the way this mode works
@@ -1185,11 +1177,6 @@ and output methods may use disk space, as outlined in the table below.
@@ -1187,11 +1179,6 @@ and output methods may use disk space, as outlined in the table below.
This temporarily places a full copy of the uncompressed source disks
in C<$VIRT_V2V_TMPDIR> (or F</var/tmp>).
@ -128,7 +128,7 @@ index e993e21a..a5c844f1 100644
=item I<-o local>
=item I<-o qemu>
@@ -1375,13 +1362,6 @@ See also L</Starting the libvirt system instance>.
@@ -1377,13 +1364,6 @@ See also L</Starting the libvirt system instance>.
Because of how Cinder volumes are presented as F</dev> block devices,
using I<-o openstack> normally requires that virt-v2v is run as root.

View File

@ -1,4 +1,4 @@
From 6ea8c70cbebdfb1a12bbcd2d57b5c6c157369478 Mon Sep 17 00:00:00 2001
From 817143c2e72f2f269caf4bc40cd78f8c2733d27f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Dec 2021 11:56:05 +0000
Subject: [PATCH] RHEL: Remove the --in-place option
@ -12,7 +12,7 @@ wish to support in RHEL.
3 files changed, 17 deletions(-)
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index a5c844f1..d85a2029 100644
index 8d5d54d3..0738f492 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -24,9 +24,6 @@ virtualize those machines (physical to virtual, or p2v).
@ -36,7 +36,7 @@ index a5c844f1..d85a2029 100644
=head2 Other virt-v2v topics
L<virt-v2v-support(1)> — Supported hypervisors, virtualization
@@ -1643,7 +1636,6 @@ L<https://rwmj.wordpress.com/2015/09/18/importing-kvm-guests-to-ovirt-or-rhev/#c
@@ -1645,7 +1638,6 @@ L<https://rwmj.wordpress.com/2015/09/18/importing-kvm-guests-to-ovirt-or-rhev/#c
L<virt-p2v(1)>,
L<virt-v2v-inspector(1)>,

View File

@ -1,4 +1,4 @@
From 3bf6f17ce219c24931701addc986ab953c9446d5 Mon Sep 17 00:00:00 2001
From 0395abbc0a3b5286cdef040b8c8d484b8716fb7c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:56:54 +0100
Subject: [PATCH] RHEL 9: -oo compressed: Remove nbdcopy version check and test

View File

@ -1,4 +1,4 @@
From 7f9cacaaa25ec7beed6ca21b758cfd6f2204ca19 Mon Sep 17 00:00:00 2001
From ab52795e1b6834bb682682a7df07e1ad0baf9be6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:58:09 +0100
Subject: [PATCH] RHEL 9: tests: Remove btrfs test

View File

@ -1,4 +1,4 @@
From a126df43b1155d7ab2fea8beb2b36baee7b83264 Mon Sep 17 00:00:00 2001
From cf1a9ba127ae581d42b309c6112f67c5e7edbfd2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 28 Apr 2023 12:28:19 +0100
Subject: [PATCH] RHEL 9: Remove --block-driver option
@ -37,10 +37,10 @@ index ce57e229..6e1c5363 100644
=item B<--colours>
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index d85a2029..058eb800 100644
index 0738f492..021ac897 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -195,16 +195,6 @@ The options are silently ignored for other input methods.
@@ -197,16 +197,6 @@ The options are silently ignored for other input methods.
See I<--network> below.

View File

@ -1,2 +1,2 @@
SHA512 (virt-v2v-2.3.7.tar.gz) = 7b17319c2dbcb594a98d0f2b0605ea9fd6cd6c01fd9cc21f8964b438a280d2c39cb5badb7d992e65d3823a44c8d662a00bdf8b7922991c078cd34d5943db4c1f
SHA512 (virt-v2v-2.3.7.tar.gz.sig) = 2b66218532f8e85804b4cdf059cabb9b64b4619c4c238cca41682581af073fba2389ebad6874ad756c0d382f09e1ca7bc4b89441f7c298406c44ea2a6729dc25
SHA512 (virt-v2v-2.4.0.tar.gz) = c59c613bcc2474c1efec6a68401d3c1dd4dd6f0e8bfdbc0f77ff2fff2191982c35d14944ca1727aee31e111361ab498e0c0e0d840099a340d05603a36f6e6639
SHA512 (virt-v2v-2.4.0.tar.gz.sig) = 4b1bd638f0e5489ed4fe076d0b2d2c7e7a7514bca8a4d44f201253147adfbb2d97a4b9b35f884520c6dfbb94f84733d7a61981fbba5e2ecc636eb5d64635658c

View File

@ -11,12 +11,12 @@
%endif
# The source directory.
%global source_directory 2.3-development
%global source_directory 2.4-stable
Name: virt-v2v
Epoch: 1
Version: 2.3.7
Release: 2%{?dist}
Version: 2.4.0
Release: 1%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -36,21 +36,33 @@ Source3: copy-patches.sh
# https://github.com/libguestfs/virt-v2v/commits/rhel-9.4
# Patches.
Patch0001: 0001-ocaml-dep.sh-Add-common-mlcustomize-to-list-of-direc.patch
Patch0002: 0002-Update-common-submodule.patch
Patch0003: 0003-input-parse_vmx.ml-Reject-VMDK-files.patch
Patch0004: 0004-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0005: 0005-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0006: 0006-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0007: 0007-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0008: 0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0009: 0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0010: 0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0011: 0011-RHEL-Disable-o-glance.patch
Patch0012: 0012-RHEL-Remove-the-in-place-option.patch
Patch0013: 0013-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0014: 0014-RHEL-9-tests-Remove-btrfs-test.patch
Patch0015: 0015-RHEL-9-Remove-block-driver-option.patch
Patch0001: 0001-virt-v2v-i-vmx-Remove-scp-T-option.patch
Patch0002: 0002-Translated-using-Weblate-Polish.patch
Patch0003: 0003-Update-translation-files.patch
Patch0004: 0004-virt-v2v-i-vmx-Refactor-ssh-scp-code-into-a-new-modu.patch
Patch0005: 0005-virt-v2v-i-vmx-Simplify-scp-wrapper.patch
Patch0006: 0006-virt-v2v-i-vmx-Add-the-input-password-to-vmx_source.patch
Patch0007: 0007-virt-v2v-i-vmx-Remove-dependency-of-ssh.ml-on-Xml.ur.patch
Patch0008: 0008-input-nbdkit_ssh-Make-retry-filter-optional.patch
Patch0009: 0009-virt-v2v-i-vmx-Replace-external-ssh-scp-with-nbdkit-.patch
Patch0010: 0010-input-nbdkit_ssh-Make-password-parameter-optional.patch
Patch0011: 0011-input-ssh-Rearrange-parameters-specifying-ssh-server.patch
Patch0012: 0012-docs-Remove-paragraph-about-ip-passwords-and-ssh-scp.patch
Patch0013: 0013-input-ssh-Use-nbdinfo-can-connect-instead-of-size.patch
Patch0014: 0014-build-Document-that-nbdinfo-and-nbdcopy-are-required.patch
Patch0015: 0015-Version-2.5.1.patch
Patch0016: 0016-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0017: 0017-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0018: 0018-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0019: 0019-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0020: 0020-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0021: 0021-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0022: 0022-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0023: 0023-RHEL-Disable-o-glance.patch
Patch0024: 0024-RHEL-Remove-the-in-place-option.patch
Patch0025: 0025-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0026: 0026-RHEL-9-tests-Remove-btrfs-test.patch
Patch0027: 0027-RHEL-9-Remove-block-driver-option.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -334,6 +346,7 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check
%{_mandir}/man1/virt-v2v-release-notes-1.42.1*
%{_mandir}/man1/virt-v2v-release-notes-2.0.1*
%{_mandir}/man1/virt-v2v-release-notes-2.2.1*
%{_mandir}/man1/virt-v2v-release-notes-2.4.1*
%{_mandir}/man1/virt-v2v-support.1*
%{_datadir}/virt-tools
@ -354,18 +367,18 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check
%changelog
* Tue Dec 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.3.7-2
- Improve the error message for -i vmx with a .vmdk file
resolves: RHEL-19564
* Mon Dec 11 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.3.7-1
- Rebase to virt-v2v 2.3.7
* Thu Jan 18 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.4.0-1
- Rebase to virt-v2v 2.4.0
- -it ssh: Double quote ssh command which tests remote file exists
resolves: RHEL-12105
- Implement --key all:...
resolves: RHEL-18142
- Fix off-by-one error causing rare crash
resolves: RHEL-19061
- Improve the error message for -i vmx with a .vmdk file
resolves: RHEL-19564
- Fix -i vmx when remote filename contains literal '*'
resolves: RHEL-21365
* Mon Jul 03 2023 Laszlo Ersek <lersek@redhat.com> - 1:2.3.4-5
- improve UX when running as root and we can't chown v2v tmpdir or socks