Compare commits

...

No commits in common. 'c9' and 'i9c-beta' have entirely different histories.
c9 ... i9c-beta

3
.gitignore vendored

@ -1,2 +1 @@
SOURCES/libguestfs.keyring
SOURCES/virt-v2v-2.4.0.tar.gz
SOURCES/virt-v2v-2.5.6.tar.gz

@ -1,2 +1 @@
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring
52029cc7c3f9e05ec9685995ad86955154d7b28e SOURCES/virt-v2v-2.4.0.tar.gz
7c49844a2ffb54d6fcb58eca1dbf57b110d5d47e SOURCES/virt-v2v-2.5.6.tar.gz

@ -1,20 +1,19 @@
From 48c49139b94b1081c6392ab3b14fbb72c024f18d Mon Sep 17 00:00:00 2001
From 7800049c5612e6ffb30be7f8862d147d82976ae8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 31 Jul 2024 10:09:50 +0100
Subject: [PATCH] docs: Note that --mac len field is now optional
Reported-by: Ming Xie
Updates: commit 159fda411d2f75b087106e7293d273ae142c9fbe
(cherry picked from commit 7800049c5612e6ffb30be7f8862d147d82976ae8)
---
docs/virt-v2v.pod | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 021ac897..c173563b 100644
index b53face6..dfe92d77 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -372,9 +372,9 @@ Force a particular interface (controlled by its MAC address) to have a
@@ -394,9 +394,9 @@ Force a particular interface (controlled by its MAC address) to have a
static IP address after boot.
The fields in the parameter are: C<ipaddr> is the IP address. C<gw>

@ -1,39 +0,0 @@
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 -> ""

@ -1,48 +0,0 @@
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"

@ -1,4 +1,4 @@
From bebc18c317a46cc99f50d1f6932c81df4e7da1fb Mon Sep 17 00:00:00 2001
From c57ec4fd5d4942d2320aec4a6b01977dabb87f83 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 1 Aug 2024 09:01:47 +0100
Subject: [PATCH] convert: More robust qemu-ga installation, change paths
@ -16,14 +16,12 @@ Richard W.M. Jones (3):
mlcustomize: Use Start-Process -Wait to run qemu-ga installer
mlcustomize: Add Firstboot.firstboot_dir function
mlcustomize: Place powershell scripts into <firstboot_dir>\Temp
(cherry picked from commit c57ec4fd5d4942d2320aec4a6b01977dabb87f83)
---
common | 2 +-
convert/convert_windows.ml | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Submodule common 5d1f5b84..d489469f:
Submodule common ae639ba3..d489469f:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 4b9b910b..3bbba714 100644
--- a/common/mlcustomize/firstboot.ml
@ -185,42 +183,11 @@ index eee93669..b04a3b38 100644
and configure_blnsvr t blnsvr =
let cmd = sprintf "\
diff --git a/common/mldrivers/linux_kernels.ml b/common/mldrivers/linux_kernels.ml
index 23ff76a5..e0b6b8a0 100644
--- a/common/mldrivers/linux_kernels.ml
+++ b/common/mldrivers/linux_kernels.ml
@@ -102,7 +102,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) apps in
if verbose () then (
let names = List.map (fun { G.app2_name = name } -> name) kernel_pkgs in
- eprintf "candidate kernel packages in this guest: %s%!\n"
+ eprintf "info: candidate kernel packages in this guest: %s%!\n"
(String.concat " " names)
);
List.filter_map (
@@ -306,7 +306,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) kernel_pkgs in
if verbose () then (
- eprintf "installed kernel packages in this guest:\n";
+ eprintf "info: installed kernel packages in this guest:\n";
List.iter (print_kernel_info stderr "\t") installed_kernels;
flush stderr
);
@@ -343,7 +343,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) vmlinuzes in
if verbose () then (
- eprintf "kernels offered by the bootloader in this guest (first in list is default):\n";
+ eprintf "info: kernels offered by the bootloader in this guest (first in list is default):\n";
List.iter (print_kernel_info stderr "\t") bootloader_kernels;
flush stderr
);
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 34cf341b..2ff60bad 100644
index 2d6e2059..52ca5bbe 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -391,7 +391,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
@@ -397,7 +397,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
%systemroot%\\Sysnative\\PnPutil -i -a \
%systemroot%\\Drivers\\Virtio\\*.inf" in
@ -229,7 +196,7 @@ index 34cf341b..2ff60bad 100644
Firstboot.add_firstboot_script g inspect.i_root ~prio:2000
"pnputil install drivers" fb_script;
@@ -668,7 +668,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
@@ -674,7 +674,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
* Powershell script which runs at boot.
*)
if static_ips <> [] then (

File diff suppressed because it is too large Load Diff

@ -1,4 +1,4 @@
From 692354df0bf2915955d8c66705685f66f5f44844 Mon Sep 17 00:00:00 2001
From 168eacf977ca49e96bc63ddc4109c27515ac0277 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 1 Aug 2024 10:36:52 +0100
Subject: [PATCH] common: mlcustomize: Inject qemu-ga & blnsvr into
@ -11,8 +11,6 @@ themselves).
Richard W.M. Jones (1):
mlcustomize: Inject qemu-ga & blnsvr into <firstboot_dir>/Temp
(cherry picked from commit 168eacf977ca49e96bc63ddc4109c27515ac0277)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

@ -1,4 +1,4 @@
From 696060ba5e89da4d60a7ee1187c8cfd298d50031 Mon Sep 17 00:00:00 2001
From c952f310c902e438a8b0b5240a4b486b698bede8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 5 Aug 2024 10:08:34 +0100
Subject: [PATCH] docs: Add a note about removal of VMware Tools on Windows
@ -13,16 +13,15 @@ user if they want to try the risky method.
Fixes: https://issues.redhat.com/browse/RHEL-51169
Thanks: Yan Vugenfirer
Reported-by: Ming Xie
(cherry picked from commit c952f310c902e438a8b0b5240a4b486b698bede8)
---
docs/virt-v2v.pod | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index c173563b..6df9d88b 100644
index dfe92d77..92941026 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -1248,6 +1248,21 @@ B<N.B.> Take care not to interrupt the automatic driver installation
@@ -1299,6 +1299,21 @@ B<N.B.> Take care not to interrupt the automatic driver installation
process when logging in to the guest for the first time, as this may
prevent the guest from subsequently booting correctly.

@ -1,301 +0,0 @@
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

@ -1,12 +1,10 @@
From 03249203b25d946358e73d0e418805f293bb43bb Mon Sep 17 00:00:00 2001
From 7bc9b115baba6df2969451cd6907e2d7543ef22d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 5 Aug 2024 10:18:31 +0100
Subject: [PATCH] Update common submodule
Richard W.M. Jones (1):
mlcustomize: Write qemu-ga log file name to log.txt
(cherry picked from commit 7bc9b115baba6df2969451cd6907e2d7543ef22d)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

@ -1,84 +0,0 @@
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

@ -1,4 +1,4 @@
From a6b8794cd8b90b7f100964ff8534eb24a1b32d4b Mon Sep 17 00:00:00 2001
From 50f005f8b7034916588855c15b10a0195bf54b23 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 8 Aug 2024 10:40:24 +0100
Subject: [PATCH] Pull in a fix to make Windows firstboot more reliable.
@ -10,8 +10,6 @@ Richard W.M. Jones (2):
mlcustomize: Reboot Windows between each firstboot script
Document that Windows may now reboot several times after conversion.
(cherry picked from commit 50f005f8b7034916588855c15b10a0195bf54b23)
---
common | 2 +-
docs/virt-v2v.pod | 9 ++++++---
@ -59,10 +57,10 @@ index 3bbba714..52e76401 100644
\"%%firstboot%%\\%s\" -s firstboot uninstall
" firstboot_dir_win srvany in
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 6df9d88b..7912c6b1 100644
index 92941026..587b4604 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -1244,9 +1244,12 @@ The guest will be bootable after the offline conversion stage, but
@@ -1295,9 +1295,12 @@ The guest will be bootable after the offline conversion stage, but
will not yet have all necessary drivers installed to work correctly.
These will be installed automatically the first time the guest boots.

@ -1,125 +0,0 @@
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

@ -1,4 +1,4 @@
From 8bcdddcaa612feb05c4ae5033bf9440b046ef63e Mon Sep 17 00:00:00 2001
From e9c0d63b22bcb4c31cfaac00fc1271713c8bd3b3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 8 Aug 2024 10:56:16 +0100
Subject: [PATCH] docs: Restate position on removal of VMware Tools
@ -8,16 +8,15 @@ it seems removal of VMware Tools is now more reliable. Update the
notes about this.
Updates: commit c952f310c902e438a8b0b5240a4b486b698bede8
(cherry picked from commit e9c0d63b22bcb4c31cfaac00fc1271713c8bd3b3)
---
docs/virt-v2v.pod | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 7912c6b1..50285cad 100644
index 587b4604..346be606 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -1257,9 +1257,8 @@ Virt-v2v attempts to remove VMware Tools. For Windows guests this is
@@ -1308,9 +1308,8 @@ Virt-v2v attempts to remove VMware Tools. For Windows guests this is
supposed to happen during the first boot after conversion.
We use VMware's recommended uninstallation method as that is the

@ -1,205 +0,0 @@
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

@ -1,4 +1,4 @@
From 5bdd4525570d58e7b712514f1ab57cb04f7cd8d8 Mon Sep 17 00:00:00 2001
From ed515103ba0d4054c7000568b39df42abb503f3c 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
@ -16,10 +16,10 @@ support cases.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/output/output_qemu.ml b/output/output_qemu.ml
index 1a5f7f71..97cf59a8 100644
index 26c1ba48..07dae8c2 100644
--- a/output/output_qemu.ml
+++ b/output/output_qemu.ml
@@ -142,7 +142,7 @@ module QEMU = struct
@@ -131,7 +131,7 @@ module QEMU = struct
* module deals with shell and qemu comma quoting.
*)
let cmd = Qemuopts.create () in

@ -1,55 +0,0 @@
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 ->

@ -1,4 +1,4 @@
From f063d97be8f13cc6526d3a4b4ec8be0b1d3c266f Mon Sep 17 00:00:00 2001
From 84afa8cb6933daee1585facc00557826f1fd2273 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,7 +44,7 @@ index d2a1c270..0be37f5e 100644
=item B<-o null>
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index bc946dc1..55545e11 100644
index 346be606..81a4b45a 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -146,11 +146,6 @@ Since F<guest-domain.xml> contains the path(s) to the guest disk
@ -69,7 +69,7 @@ index bc946dc1..55545e11 100644
=item B<-o> B<rhev>
This is the same as I<-o rhv>.
@@ -603,11 +595,6 @@ For I<-o openstack> (L<virt-v2v-output-openstack(1)>) only, set a guest ID
@@ -607,11 +599,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 bc946dc1..55545e11 100644
=item B<-oo verify-server-certificate>
=item B<-oo verify-server-certificate=>C<true|false>
@@ -778,10 +765,6 @@ Print information about the source guest and stop. This option is
@@ -782,10 +769,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>.
@ -93,7 +93,7 @@ index bc946dc1..55545e11 100644
=item B<--quiet>
diff --git a/output/output_qemu.ml b/output/output_qemu.ml
index 97cf59a8..ad3eb897 100644
index 07dae8c2..b6f24565 100644
--- a/output/output_qemu.ml
+++ b/output/output_qemu.ml
@@ -65,6 +65,9 @@ module QEMU = struct
@ -107,10 +107,10 @@ index 97cf59a8..ad3eb897 100644
let output_storage =
match options.output_storage with
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 3b2eafbd..696ef75e 100644
index 48c8cfba..fca5f6e9 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -275,8 +275,6 @@ let rec main () =
@@ -277,8 +277,6 @@ let rec main () =
s_"Same as -ip filename";
[ L"print-source" ], Getopt.Set print_source,
s_"Print source and stop";

@ -1,167 +0,0 @@
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 ->

@ -1,4 +1,4 @@
From 6cee48bde007be6c8242c9e1a3b83bc153c566d9 Mon Sep 17 00:00:00 2001
From abab56cf74a5005b33e962bb3d42db3d5b39e6d3 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
@ -9,7 +9,7 @@ Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/utils.ml b/lib/utils.ml
index 19c5ba91..7b3aa2e2 100644
index bf010a0a..4c9b7415 100644
--- a/lib/utils.ml
+++ b/lib/utils.ml
@@ -60,13 +60,14 @@ let kvm_arch = function

@ -1,255 +0,0 @@
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

@ -1,4 +1,4 @@
From 7374efa8aecb97a83a1ec6d4d606651a4eb569e4 Mon Sep 17 00:00:00 2001
From 2039580744223840a09b8aab7ff2fbf94a563a6c 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.
@ -12,12 +12,13 @@ https://bugzilla.redhat.com/show_bug.cgi?id=2187961#c1
convert/convert.ml | 1 +
test-data/phony-guests/make-windows-img.sh | 1 +
tests/test-v2v-block-driver.sh | 6 +++++-
tests/test-v2v-in-place.sh | 8 +++++++-
tests/test-v2v-virtio-win-iso.sh | 8 +++++++-
tests/test-v2v-windows-conversion.sh | 8 +++++++-
5 files changed, 21 insertions(+), 3 deletions(-)
6 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 9c76f76d..caaa707e 100644
index 344c5858..ecc48ad4 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -52,6 +52,7 @@ let rec convert dir options source =
@ -57,6 +58,32 @@ index db59a2cf..a0e56bed 100755
is-dir $virtio_dir
is-file $virtio_dir/$drv.cat
is-file $virtio_dir/$drv.inf
diff --git a/tests/test-v2v-in-place.sh b/tests/test-v2v-in-place.sh
index 4373f140..2b31b0bb 100755
--- a/tests/test-v2v-in-place.sh
+++ b/tests/test-v2v-in-place.sh
@@ -89,6 +89,12 @@ mktest ()
:> "$script"
:> "$expected"
+cat >> "$script" <<EOF
+ set-program virt-testing
+ run
+ mount /dev/sda2 /
+EOF
+
firstboot_dir="/Program Files/Guestfs/Firstboot"
mktest "is-dir \"$firstboot_dir\"" true
mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
@@ -101,7 +107,7 @@ for drv in netkvm vioscsi viostor; do
done
done
-guestfish --ro -a "$img" -i < "$script" > "$response"
+guestfish --ro -a "$img" < "$script" > "$response"
diff -u "$expected" "$response"
# Test the base image remained untouched
diff --git a/tests/test-v2v-virtio-win-iso.sh b/tests/test-v2v-virtio-win-iso.sh
index 69f6f414..b9b806fb 100755
--- a/tests/test-v2v-virtio-win-iso.sh

@ -1,104 +0,0 @@
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

@ -1,4 +1,4 @@
From 8b2bb3c153b44634fb3f93aae1c0c40655213506 Mon Sep 17 00:00:00 2001
From 13970ce5d6be475cf6e06185636a730584303a6e 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)
@ -9,7 +9,7 @@ The SDL output mode is not supported in RHEL's qemu-kvm.
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/input_disk.ml b/input/input_disk.ml
index 279250fe..c6b819c0 100644
index cf1f811b..27fc80de 100644
--- a/input/input_disk.ml
+++ b/input/input_disk.ml
@@ -77,7 +77,7 @@ module Disk = struct

@ -1,54 +0,0 @@
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>:

@ -1,4 +1,4 @@
From 28e3b929b94e213bc24fa27c58215fe8ccdb9ba1 Mon Sep 17 00:00:00 2001
From 98a14fe2f8a428ed4bba85aba3889467d48a5743 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 38dc8f7b..05c4e3f5 100644
index 4a0544f8..9c3981e1 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

@ -1,62 +0,0 @@
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

@ -1,4 +1,4 @@
From a2e7cf38ee640e9e806a680cf55f78d33a3c0ee8 Mon Sep 17 00:00:00 2001
From be45d1e5bca42148c295da10c27c485c72de28c3 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

@ -1,43 +0,0 @@
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"],[

@ -1,4 +1,4 @@
From 29b43856a1429148eece11f0579a01026d583161 Mon Sep 17 00:00:00 2001
From b0386851d539e414302cb646567836717fd027d9 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,7 +98,7 @@ index cd4862b1..54cd276e 100644
=head1 AUTHOR
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 55545e11..8d5d54d3 100644
index 81a4b45a..7c7069df 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -435,14 +435,6 @@ See L</Networks and bridges> below.
@ -116,7 +116,7 @@ index 55545e11..8d5d54d3 100644
=item B<-o> B<kubevirt>
Set the output method to I<kubevirt>. B<Note the way this mode works
@@ -1187,11 +1179,6 @@ and output methods may use disk space, as outlined in the table below.
@@ -1191,11 +1183,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 55545e11..8d5d54d3 100644
=item I<-o local>
=item I<-o qemu>
@@ -1377,13 +1364,6 @@ See also L</Starting the libvirt system instance>.
@@ -1398,13 +1385,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.
@ -167,10 +167,10 @@ index c0db9115..074b5e16 100755
set -e
set -x
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 696ef75e..47d2da79 100644
index fca5f6e9..4148fa50 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -195,7 +195,6 @@ let rec main () =
@@ -197,7 +197,6 @@ let rec main () =
if !output_mode <> `Not_set then
error (f_"%s option used more than once on the command line") "-o";
match mode with
@ -178,7 +178,7 @@ index 696ef75e..47d2da79 100644
| "kubevirt" -> output_mode := `Kubevirt
| "libvirt" -> output_mode := `Libvirt
| "disk" | "local" -> output_mode := `Disk
@@ -255,7 +254,7 @@ let rec main () =
@@ -257,7 +256,7 @@ let rec main () =
s_"Map network in to out";
[ L"no-trim" ], Getopt.String ("-", no_trim_warning),
s_"Ignored for backwards compatibility";
@ -187,7 +187,7 @@ index 696ef75e..47d2da79 100644
s_"Set output mode (default: libvirt)";
[ M"oa" ], Getopt.String ("sparse|preallocated", set_output_alloc),
s_"Set output allocation mode";
@@ -323,8 +322,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
@@ -325,8 +324,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
virt-v2v -i disk disk.img -o local -os /var/tmp
@ -196,7 +196,7 @@ index 696ef75e..47d2da79 100644
There is a companion front-end called \"virt-p2v\" which comes as an
ISO or CD image that can be booted on physical machines.
@@ -399,7 +396,6 @@ read the man page virt-v2v(1).
@@ -401,7 +398,6 @@ read the man page virt-v2v(1).
pr "input:libvirtxml\n";
pr "input:ova\n";
pr "input:vmx\n";
@ -204,7 +204,7 @@ index 696ef75e..47d2da79 100644
pr "output:kubevirt\n";
pr "output:libvirt\n";
pr "output:local\n";
@@ -496,7 +492,6 @@ read the man page virt-v2v(1).
@@ -498,7 +494,6 @@ read the man page virt-v2v(1).
| `Disk -> (module Output_disk.Disk)
| `Null -> (module Output_null.Null)
| `QEmu -> (module Output_qemu.QEMU)

@ -1,4 +1,4 @@
From cbebfa10e481a664a949ff07dfceca5cb45793df Mon Sep 17 00:00:00 2001
From 7cbdcc0d3acf0bc50e331ad994987c26c5917b63 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 8d5d54d3..0738f492 100644
index 7c7069df..9da6c851 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 8d5d54d3..0738f492 100644
=head2 Other virt-v2v topics
L<virt-v2v-support(1)> — Supported hypervisors, virtualization
@@ -1645,7 +1638,6 @@ L<https://rwmj.wordpress.com/2015/09/18/importing-kvm-guests-to-ovirt-or-rhev/#c
@@ -1666,7 +1659,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)>,
@ -45,7 +45,7 @@ index 8d5d54d3..0738f492 100644
L<virt-df(1)>,
L<virt-filesystems(1)>,
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5c523204..5190d055 100644
index 723a6506..4bfa1c7a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,7 +77,6 @@ TESTS = \
@ -57,10 +57,10 @@ index 5c523204..5190d055 100644
test-v2v-inspector.sh \
test-v2v-mac.sh \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 47d2da79..19f08aae 100644
index 4148fa50..834f023d 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -217,12 +217,6 @@ let rec main () =
@@ -219,12 +219,6 @@ let rec main () =
warning (f_"the --vmtype option has been removed and now does nothing")
in
@ -73,7 +73,7 @@ index 47d2da79..19f08aae 100644
let argspec = [
[ L"bandwidth" ], Getopt.String ("bps", set_string_option_once "--bandwidth" bandwidth),
s_"Set bandwidth to bits per sec";
@@ -246,8 +240,6 @@ let rec main () =
@@ -248,8 +242,6 @@ let rec main () =
s_"Use password from file to connect to input hypervisor";
[ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport),
s_"Input transport";

@ -1,4 +1,4 @@
From aec57da776543ede26a2f751594686ad36b51bad Mon Sep 17 00:00:00 2001
From f98822497a4a60a56cb4da2d5609d30150bdd718 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
@ -12,10 +12,10 @@ separately. Thus remove the version check and test.
2 files changed, 12 deletions(-)
diff --git a/output/output.ml b/output/output.ml
index e419c13d..c8f743c2 100644
index 53d4bb1b..14288bdc 100644
--- a/output/output.ml
+++ b/output/output.ml
@@ -87,17 +87,6 @@ let output_to_local_file ?(changeuid = fun f -> f ()) ?(compressed = false)
@@ -86,17 +86,6 @@ let output_to_local_file ?(changeuid = fun f -> f ()) ?(compressed = false)
if output_format <> "qcow2" then
error (f_"-oo compressed is only allowed when the output format \
is a local qcow2-format file, i.e. -of qcow2");
@ -34,12 +34,12 @@ index e419c13d..c8f743c2 100644
let g = open_guestfs () in
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5190d055..5169e2a6 100644
index 4bfa1c7a..f38342f0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -84,7 +84,6 @@ TESTS = \
test-v2v-networks-and-bridges.sh \
test-v2v-o-glance.sh \
@@ -86,7 +86,6 @@ TESTS = \
test-v2v-o-kubevirt-fedora.sh \
test-v2v-o-kubevirt-windows.sh \
test-v2v-o-libvirt.sh \
- test-v2v-o-local-qcow2-compressed.sh \
test-v2v-o-null.sh \

@ -1,4 +1,4 @@
From d9c11fcfdf832f9d3d35855e7e7458efc1908515 Mon Sep 17 00:00:00 2001
From 28311593d57777fd4d19a9ce93b4b06502a154be 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
@ -9,10 +9,10 @@ RHEL does not have btrfs so this test always fails.
1 file changed, 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5169e2a6..a1c61f8f 100644
index f38342f0..810b5b50 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -98,7 +98,6 @@ TESTS = \
@@ -100,7 +100,6 @@ TESTS = \
test-v2v-sound.sh \
test-v2v-virtio-win-iso.sh \
test-v2v-fedora-conversion.sh \

@ -1,4 +1,4 @@
From 3e2962dad1245b8c7d1255faaa6820adc0648d14 Mon Sep 17 00:00:00 2001
From 9b289e8d0f03c9d98d2b950feb889cad883779ea 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,7 +37,7 @@ index ce57e229..6e1c5363 100644
=item B<--colours>
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 0738f492..021ac897 100644
index 9da6c851..d3406be0 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -197,16 +197,6 @@ The options are silently ignored for other input methods.
@ -58,7 +58,7 @@ index 0738f492..021ac897 100644
=item B<--colours>
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
index e8c260c2..2049db16 100644
index 1fbd29d3..1c690a54 100644
--- a/in-place/in_place.ml
+++ b/in-place/in_place.ml
@@ -43,7 +43,6 @@ let rec main () =
@ -69,7 +69,7 @@ index e8c260c2..2049db16 100644
let input_conn = ref None in
let input_format = ref None in
let input_password = ref None in
@@ -157,8 +156,6 @@ let rec main () =
@@ -159,8 +158,6 @@ let rec main () =
let argspec = [
[ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge),
s_"Map bridge in to out";
@ -78,7 +78,7 @@ index e8c260c2..2049db16 100644
[ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode),
s_"Set input mode (default: libvirt)";
[ M"ic" ], Getopt.String ("uri", set_string_option_once "-ic" input_conn),
@@ -214,12 +211,6 @@ read the man page virt-v2v-in-place(1).
@@ -216,12 +213,6 @@ read the man page virt-v2v-in-place(1).
(* Dereference the arguments. *)
let args = List.rev !args in
@ -91,7 +91,7 @@ index e8c260c2..2049db16 100644
let input_conn = !input_conn in
let input_mode = !input_mode in
let print_source = !print_source in
@@ -303,7 +294,7 @@ read the man page virt-v2v-in-place(1).
@@ -305,7 +296,7 @@ read the man page virt-v2v-in-place(1).
(* Get the conversion options. *)
let conv_options = {
@ -101,7 +101,7 @@ index e8c260c2..2049db16 100644
ks = opthandle.ks;
network_map;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a1c61f8f..8e22ab64 100644
index 810b5b50..03c71882 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,7 +77,6 @@ TESTS = \
@ -113,7 +113,7 @@ index a1c61f8f..8e22ab64 100644
test-v2v-mac.sh \
test-v2v-machine-readable.sh \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 19f08aae..89c08fc5 100644
index 834f023d..be5a66e2 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -48,7 +48,6 @@ let rec main () =
@ -124,7 +124,7 @@ index 19f08aae..89c08fc5 100644
let input_conn = ref None in
let input_format = ref None in
let input_password = ref None in
@@ -224,8 +223,6 @@ let rec main () =
@@ -226,8 +225,6 @@ let rec main () =
s_"Set bandwidth dynamically from file";
[ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge),
s_"Map bridge in to out";
@ -133,7 +133,7 @@ index 19f08aae..89c08fc5 100644
[ L"compressed" ], Getopt.Unit (fun () -> set_output_option_compat "compressed" ""),
s_"Compress output file (-of qcow2 only)";
[ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode),
@@ -341,12 +338,6 @@ read the man page virt-v2v(1).
@@ -343,12 +340,6 @@ read the man page virt-v2v(1).
(* Dereference the arguments. *)
let args = List.rev !args in
@ -146,7 +146,7 @@ index 19f08aae..89c08fc5 100644
let input_conn = !input_conn in
let input_mode = !input_mode in
let input_transport =
@@ -518,7 +509,7 @@ read the man page virt-v2v(1).
@@ -520,7 +511,7 @@ read the man page virt-v2v(1).
(* Get the conversion options. *)
let conv_options = {

@ -1,16 +1,15 @@
From 919e2fdf65377bc2496a696cb10eac3881324611 Mon Sep 17 00:00:00 2001
From 1dec94e52974e45fd3962dcbd51882fde7e9c306 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 9 Jul 2024 11:30:09 +0100
Subject: [PATCH] RHEL: Add warning about virt-v2v-in-place not being supported
Fixes: https://issues.redhat.com/browse/RHEL-40903
(cherry picked from commit 1dec94e52974e45fd3962dcbd51882fde7e9c306)
---
in-place/in_place.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
index a61d9795..d55f49a0 100644
index 1c690a54..a70e812b 100644
--- a/in-place/in_place.ml
+++ b/in-place/in_place.ml
@@ -197,6 +197,9 @@ read the man page virt-v2v-in-place(1).
@ -21,5 +20,5 @@ index a61d9795..d55f49a0 100644
+ It is almost always better to use virt-v2v instead of this tool.";
+
(* Print the version, easier than asking users to tell us. *)
debug "%s: %s %s (%s)"
debug "info: %s: %s %s (%s)"
prog Config.package_name Config.package_version_full

@ -1,4 +1,4 @@
From c36ec998cc50124300ae0b31ef844b193b2db00f Mon Sep 17 00:00:00 2001
From d26ed76801f9d3ce5d3863ca09dfa653b4bcd1b2 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 27 Aug 2024 12:36:41 +0100
Subject: [PATCH] convert: windows: Online all virtio disks at first boot
@ -28,7 +28,7 @@ Acked-by: Martin Necas
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 2ff60bad..28f81e23 100644
index 52ca5bbe..352e1218 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -38,7 +38,8 @@ module G = Guestfs
@ -50,7 +50,7 @@ index 2ff60bad..28f81e23 100644
configure_network_interfaces net_driver;
fix_ntfs_heads ();
@@ -662,6 +665,40 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
@@ -668,6 +671,40 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
warning (f_"could not find registry key \
HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion")

@ -0,0 +1,40 @@
From 94619ded353081255409eb3ffae51061adcbf9a4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 29 Aug 2024 13:17:13 +0100
Subject: [PATCH] mlcustomize: Ignore sriov drivers on virtio-win disk
Fixes: https://issues.redhat.com/browse/RHEL-56383
Thanks: Vadim Rozenfeld
---
mlcustomize/inject_virtio_win.ml | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index afec1e4..88c1c8c 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -478,7 +478,10 @@ and virtio_iso_path_matches_guest_os t path =
* "./drivers/amd64/Win2012R2/netkvm.sys".
* Note we check lowercase paths.
*)
- let pathelem elem = String.find lc_path ("/" ^ elem ^ "/") >= 0 in
+ let pathelem elem =
+ String.find lc_path ("/" ^ elem ^ "/") >= 0 ||
+ String.is_prefix lc_path (elem ^ "/")
+ in
let p_arch =
if pathelem "x86" || pathelem "i386" then "i386"
else if pathelem "amd64" then "x86_64"
@@ -522,7 +525,11 @@ and virtio_iso_path_matches_guest_os t path =
else
raise Not_found in
- arch = p_arch && os_major = p_os_major && os_minor = p_os_minor &&
+ let p_sriov = pathelem "sriov" in
+
+ arch = p_arch &&
+ not p_sriov && (* always ignored, see RHEL-56383 *)
+ os_major = p_os_major && os_minor = p_os_minor &&
match_os_variant os_variant &&
match_osinfo osinfo

@ -1,68 +0,0 @@
From 88e4e0213f5dc9e60720f6a84edf36bffbea723e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 May 2024 12:32:00 +0100
Subject: [PATCH] Update common submodule
Pulls in these commits, but they are not thought to be relevant to
virt-v2v.
Ben Brown (1):
Initialise bar->fp as NULL
Richard W.M. Jones (2):
mlcustomize: Update virt-customize generated files
options: Allow nbd+unix:// URIs
(cherry picked from commit 6513fcbec9a10652cb8b5690936e7265e9c8851c)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 0dba002c..93a7f3af:
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 245d9960..48ee3344 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -157,7 +157,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 "," arg with
+ match String.nsplit ~max:3 ":" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_"invalid format for '--%s' parameter, see the man page")
diff --git a/common/options/uri.c b/common/options/uri.c
index 84d393c1..9180d6a2 100644
--- a/common/options/uri.c
+++ b/common/options/uri.c
@@ -99,7 +99,7 @@ is_uri (const char *arg)
return 0;
for (p--; p >= arg; p--) {
- if (!c_islower (*p))
+ if (! (c_islower (*p) || *p == '+'))
return 0;
}
@@ -148,7 +148,10 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
}
*/
- *protocol_ret = strdup (uri->scheme);
+ if (STREQ (uri->scheme, "nbd+unix"))
+ *protocol_ret = strdup ("nbd");
+ else
+ *protocol_ret = strdup (uri->scheme);
if (*protocol_ret == NULL) {
perror ("strdup: protocol");
return -1;
@@ -194,7 +197,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
if (path && path[0] == '/' &&
(STREQ (uri->scheme, "gluster") ||
STREQ (uri->scheme, "iscsi") ||
- STREQ (uri->scheme, "nbd") ||
+ STRPREFIX (uri->scheme, "nbd") ||
STREQ (uri->scheme, "rbd") ||
STREQ (uri->scheme, "sheepdog")))
path++;

@ -1,197 +0,0 @@
From 0c0055924a4564e15d9a69d468f315f84f30f140 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 May 2024 13:27:49 +0100
Subject: [PATCH] convert: windows: Install blnsvr from virtio-win
Also update the common module to get these two commits for the
implementation:
Richard W.M. Jones (2):
mlcustomize: Add virt-customize --inject-blnsvr generated files
mlcustomize: Add Inject_virtio_win.inject_blnsvr implementation
Fixes: https://issues.redhat.com/browse/RHEL-36591
Cherry picked from commit 70eec57765280032e08a1d738402926b14a851bf.
For the RHEL 9.4-z backport, remove blnsvr installation.
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 93a7f3af..830cbdcf:
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index ff93630d..b2ac5752 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -193,6 +193,18 @@ L<virt-builder(1)/INSTALLING PACKAGES>.
Set the hostname of the guest to C<HOSTNAME>. You can use a
dotted hostname.domainname (FQDN) if you want.
+=item B<--inject-blnsvr> METHOD
+
+Inject the Balloon Server (F<blnsvr.exe>) into a Windows guest.
+This operation also injects a firstboot script so that the Balloon
+Server is installed when the guest boots.
+
+The parameter is the same as used by the I<--inject-virtio-win> operation.
+
+Note that to do a full conversion of a Windows guest from a
+foreign hypervisor like VMware (which involves many other operations)
+you should use the L<virt-v2v(1)> tool instead of this.
+
=item B<--inject-qemu-ga> METHOD
Inject the QEMU Guest Agent into a Windows guest. The guest
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index bb0ce125..957de8cf 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -3,16 +3,16 @@
[--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR]
[--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT]
[--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..]
- [--hostname HOSTNAME] [--inject-qemu-ga METHOD]
- [--inject-virtio-win METHOD] [--install PKG,PKG..]
- [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST]
- [--password USER:SELECTOR] [--root-password SELECTOR]
- [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE]
- [--sm-attach SELECTOR] [--sm-register] [--sm-remove]
- [--sm-unregister] [--ssh-inject USER[:SELECTOR]]
- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE]
- [--truncate FILE] [--truncate-recursive PATH]
- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
- [--write FILE:CONTENT] [--no-logfile]
+ [--hostname HOSTNAME] [--inject-blnsvr METHOD]
+ [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD]
+ [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR]
+ [--move SOURCE:DEST] [--password USER:SELECTOR]
+ [--root-password SELECTOR] [--run SCRIPT]
+ [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR]
+ [--sm-register] [--sm-remove] [--sm-unregister]
+ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR]
+ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE]
+ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update]
+ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
[--selinux-relabel] [--sm-credentials SELECTOR]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 48ee3344..c4d6a77d 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -61,6 +61,8 @@ and op = [
(* --firstboot-install PKG,PKG.. *)
| `Hostname of string
(* --hostname HOSTNAME *)
+ | `InjectBalloonServer of string
+ (* --inject-blnsvr METHOD *)
| `InjectQemuGA of string
(* --inject-qemu-ga METHOD *)
| `InjectVirtioWin of string
@@ -286,6 +288,12 @@ let rec argspec () =
s_"Set the hostname"
),
Some "HOSTNAME", "Set the hostname of the guest to C<HOSTNAME>. You can use a\ndotted hostname.domainname (FQDN) if you want.";
+ (
+ [ L"inject-blnsvr" ],
+ Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectBalloonServer s) ops),
+ s_"Inject the Balloon Server into a Windows guest"
+ ),
+ Some "METHOD", "Inject the Balloon Server (F<blnsvr.exe>) into a Windows guest.\nThis operation also injects a firstboot script so that the Balloon\nServer is installed when the guest boots.\n\nThe parameter is the same as used by the I<--inject-virtio-win> operation.\n\nNote that to do a full conversion of a Windows guest from a\nforeign hypervisor like VMware (which involves many other operations)\nyou should use the L<virt-v2v(1)> tool instead of this.";
(
[ L"inject-qemu-ga" ],
Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectQemuGA s) ops),
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index 51a156ea..ee62961a 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -53,6 +53,8 @@ and op = [
(* --firstboot-install PKG,PKG.. *)
| `Hostname of string
(* --hostname HOSTNAME *)
+ | `InjectBalloonServer of string
+ (* --inject-blnsvr METHOD *)
| `InjectQemuGA of string
(* --inject-qemu-ga METHOD *)
| `InjectVirtioWin of string
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index 2a30b200..4e0ed0e0 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -24,6 +24,8 @@ open Common_gettext.Gettext
open Regedit
+let re_blnsvr = PCRE.compile ~caseless:true "\\bblnsvr\\.exe$"
+
type t = {
g : Guestfs.guestfs; (** guestfs handle *)
@@ -267,6 +269,18 @@ and inject_qemu_ga t =
configure_qemu_ga t msi_files;
msi_files <> [] (* return true if we found some qemu-ga MSI files *)
+and inject_blnsvr t =
+ let files = copy_blnsvr t in
+ match files with
+ | [] -> false (* Didn't find or install anything. *)
+
+ (* We usually find blnsvr.exe in two locations (drivers/by-os and
+ * drivers/by-driver). Pick the first.
+ *)
+ | blnsvr :: _ ->
+ configure_blnsvr t blnsvr;
+ true
+
and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid =
let ddb_node = g#hivex_node_get_child root "DriverDatabase" in
@@ -351,6 +365,11 @@ and copy_qemu_ga t =
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
+and copy_blnsvr t =
+ copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t)
+ (fun () ->
+ error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
+
(* Copy all files from virtio_win directory/ISO located in [srcdir]
* subdirectory and all its subdirectories to the [destdir]. The directory
* hierarchy is not preserved, meaning all files will be directly in [destdir].
@@ -513,6 +532,10 @@ and virtio_iso_path_matches_qemu_ga t path =
| ("x86_64", "rhev-qga64.msi") -> true
| _ -> false
+(* Find blnsvr for the current Windows version. *)
+and virtio_iso_path_matches_blnsvr t path =
+ virtio_iso_path_matches_guest_os t path && PCRE.matches re_blnsvr path
+
(* Look up in libosinfo for the OS, and copy all the locally
* available files specified as drivers for that OS to the [destdir].
*
@@ -586,3 +609,10 @@ and configure_qemu_ga t files =
Firstboot.add_firstboot_powershell t.g t.root
(sprintf "install-%s.ps1" msi_path) !psh_script;
) files
+
+and configure_blnsvr t blnsvr =
+ let cmd = sprintf "\
+ @echo off\n\
+ echo Installing %s\n\
+ c:\\%s -i\n" blnsvr blnsvr in
+ Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd
diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli
index d14f0497..d273c4dd 100644
--- a/common/mlcustomize/inject_virtio_win.mli
+++ b/common/mlcustomize/inject_virtio_win.mli
@@ -93,3 +93,11 @@ val inject_qemu_ga : t -> bool
the MSI(s).
Returns [true] iff we were able to inject qemu-ga. *)
+
+val inject_blnsvr : t -> bool
+(** Inject the Balloon Server ([blnsvr.exe]) into a Windows guest.
+
+ A firstboot script is also injected which should install
+ the server by running [blnsvr -i].
+
+ Returns [true] iff we were able to inject the Balloon Server. *)

@ -1,109 +0,0 @@
From 006bdf2599f4d56e0612192291b846b384675e96 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 25 Jul 2024 09:08:41 +0100
Subject: [PATCH] Update common submodule
This pulls in the commits below which simplify the installation of
Qemu Guest Agent on Windows.
Richard W.M. Jones (4):
mlcustomize: firstboot: Use Linux path for Powershell script path
mlcustomize: firstboot: Use powershell.exe instead of path
mlcustomize: firstboot: Use Powershell -NoProfile flag
mlcustomize: Revert delay installation of qemu-ga MSI
Fixes: https://issues.redhat.com/browse/RHEL-49761
(cherry picked from commit 4ba18d2d6d1155db7cd83641a650477c0a13dbec)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 830cbdcf..5d1f5b84:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 5dc01234..4b9b910b 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -387,16 +387,10 @@ let add_firstboot_powershell g root ?prio name code =
(* Create the temporary directory to put the Powershell file. *)
let tempdir = sprintf "%s/Temp" windows_systemroot in
g#mkdir_p tempdir;
+ let ps_path = sprintf "%s/%s" tempdir name in
let code = String.concat "\r\n" code ^ "\r\n" in
- g#write (sprintf "%s/%s" tempdir name) code;
+ g#write ps_path code;
- (* Powershell interpreter. Should we check this exists? XXX *)
- let ps_exe =
- windows_systemroot ^
- "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" in
-
- (* Windows path to the Powershell script. *)
- let ps_path = windows_systemroot ^ "\\Temp\\" ^ name in
-
- let fb = sprintf "%s -ExecutionPolicy ByPass -file %s" ps_exe ps_path in
+ let fb = sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file %s"
+ ps_path in
add_firstboot_script g root ?prio name fb
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index 4e0ed0e0..eee93669 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -575,40 +575,28 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir =
) driver.Libosinfo.files
with Not_found -> []
+(* Install qemu-ga. [files] is the non-empty list of possible qemu-ga
+ * installers we detected.
+ *)
and configure_qemu_ga t files =
+ let script = ref [] in
+ let add = List.push_back script in
+
+ add "# Virt-v2v script which installs QEMU Guest Agent";
+ add "";
+ add "# Uncomment this line for lots of debug output.";
+ add "# Set-PSDebug -Trace 2";
+ add "";
+ add "Write-Host Installing QEMU Guest Agent";
+ add "";
+ add "# Run qemu-ga installers";
List.iter (
fun msi_path ->
- (* Windows is a trashfire.
- * https://stackoverflow.com/a/18730884
- * https://bugzilla.redhat.com/show_bug.cgi?id=1895323
- *)
- let psh_script = ref [] in
- let add = List.push_back psh_script in
+ add (sprintf "C:\\%s /norestart /qn /l+*vx C:\\%s.log"
+ msi_path msi_path)
+ ) files;
- add "# Uncomment this line for lots of debug output.";
- add "# Set-PSDebug -Trace 2";
- add "";
- add "Write-Host Removing any previously scheduled qemu-ga installation";
- add "schtasks.exe /Delete /TN Firstboot-qemu-ga /F";
- add "";
- add (sprintf
- "Write-Host Scheduling delayed installation of qemu-ga from %s"
- msi_path);
- add "$d = (get-date).AddSeconds(120)";
- add "$dtfinfo = [System.Globalization.DateTimeFormatInfo]::CurrentInfo";
- add "$sdp = $dtfinfo.ShortDatePattern";
- add "$sdp = $sdp -replace 'y+', 'yyyy'";
- add "$sdp = $sdp -replace 'M+', 'MM'";
- add "$sdp = $sdp -replace 'd+', 'dd'";
- add "schtasks.exe /Create /SC ONCE `";
- add " /ST $d.ToString('HH:mm') /SD $d.ToString($sdp) `";
- add " /RU SYSTEM /TN Firstboot-qemu-ga `";
- add (sprintf " /TR \"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\""
- msi_path msi_path);
-
- Firstboot.add_firstboot_powershell t.g t.root
- (sprintf "install-%s.ps1" msi_path) !psh_script;
- ) files
+ Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga.ps1" !script
and configure_blnsvr t blnsvr =
let cmd = sprintf "\

@ -1,124 +0,0 @@
From 22691e516898b0d54ad4100c9f04beb1e70f9dc0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Jul 2024 14:49:42 +0100
Subject: [PATCH] v2v: --mac: Allow gw and len fields to be empty
Even if these appear in the middle of the list, allow them to be
empty. For example this is now permitted whereas previously it was an
error:
virt-v2v --mac <MAC>:ip:<ADDR>,,,nameserver
Reported-by: Arik Hadas
(cherry picked from commit 159fda411d2f75b087106e7293d273ae142c9fbe)
---
in-place/in_place.ml | 12 +++++++-----
inspector/inspector.ml | 12 +++++++-----
v2v/v2v.ml | 12 +++++++-----
3 files changed, 21 insertions(+), 15 deletions(-)
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
index 2049db16..a61d9795 100644
--- a/in-place/in_place.ml
+++ b/in-place/in_place.ml
@@ -90,10 +90,10 @@ let rec main () =
| "ip" ->
(match String.nsplit "," out with
| [] -> error (f_"invalid --mac ip option")
- | [ip] -> add_static_ip mac ip None None []
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
+ | [ip] -> add_static_ip mac ip "" "" []
+ | [ip; gw] -> add_static_ip mac ip gw "" []
| ip :: gw :: len :: nameservers ->
- add_static_ip mac ip (Some gw) (Some len) nameservers
+ add_static_ip mac ip gw len nameservers
)
| _ -> assert false
and add_static_ip if_mac_addr if_ip_address if_default_gateway
@@ -108,12 +108,14 @@ let rec main () =
an IP address") what addr
in
error_unless_ip_addr "ipaddr" if_ip_address;
+ let if_default_gateway =
+ match if_default_gateway with "" -> None | gw -> Some gw in
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
let if_prefix_length =
match if_prefix_length_str with
- | None -> None
- | Some len ->
+ | "" -> None
+ | len ->
let len =
try int_of_string len with
| Failure _ -> error (f_"cannot parse --mac ip prefix length \
diff --git a/inspector/inspector.ml b/inspector/inspector.ml
index 02d1a0e7..417b31c5 100644
--- a/inspector/inspector.ml
+++ b/inspector/inspector.ml
@@ -97,10 +97,10 @@ let rec main () =
| "ip" ->
(match String.nsplit "," out with
| [] -> error (f_"invalid --mac ip option")
- | [ip] -> add_static_ip mac ip None None []
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
+ | [ip] -> add_static_ip mac ip "" "" []
+ | [ip; gw] -> add_static_ip mac ip gw "" []
| ip :: gw :: len :: nameservers ->
- add_static_ip mac ip (Some gw) (Some len) nameservers
+ add_static_ip mac ip gw len nameservers
)
| _ -> assert false
and add_static_ip if_mac_addr if_ip_address if_default_gateway
@@ -115,12 +115,14 @@ let rec main () =
is an IP address") what addr
in
error_unless_ip_addr "ipaddr" if_ip_address;
+ let if_default_gateway =
+ match if_default_gateway with "" -> None | gw -> Some gw in
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
let if_prefix_length =
match if_prefix_length_str with
- | None -> None
- | Some len ->
+ | "" -> None
+ | len ->
let len =
try int_of_string len with
| Failure _ -> error (f_"cannot parse --mac ip prefix \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 89c08fc5..6d9e3792 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -109,10 +109,10 @@ let rec main () =
| "ip" ->
(match String.nsplit "," out with
| [] -> error (f_"invalid --mac ip option")
- | [ip] -> add_static_ip mac ip None None []
- | [ip; gw] -> add_static_ip mac ip (Some gw) None []
+ | [ip] -> add_static_ip mac ip "" "" []
+ | [ip; gw] -> add_static_ip mac ip gw "" []
| ip :: gw :: len :: nameservers ->
- add_static_ip mac ip (Some gw) (Some len) nameservers
+ add_static_ip mac ip gw len nameservers
)
| _ -> assert false
and add_static_ip if_mac_addr if_ip_address if_default_gateway
@@ -127,12 +127,14 @@ let rec main () =
is an IP address") what addr
in
error_unless_ip_addr "ipaddr" if_ip_address;
+ let if_default_gateway =
+ match if_default_gateway with "" -> None | gw -> Some gw in
Option.iter (error_unless_ip_addr "gw") if_default_gateway;
List.iter (error_unless_ip_addr "nameserver") if_nameservers;
let if_prefix_length =
match if_prefix_length_str with
- | None -> None
- | Some len ->
+ | "" -> None
+ | len ->
let len =
try int_of_string len with
| Failure _ -> error (f_"cannot parse --mac ip prefix length field \

@ -7,7 +7,7 @@ set -e
# ./copy-patches.sh
project=virt-v2v
rhel_version=9.4
rhel_version=9.5
# Check we're in the right directory.
if [ ! -f $project.spec ]; then

Binary file not shown.

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmWW5kYRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKBddxAAvM08lmWH0IlpLwKX06TwnVERt8fXD++p
bjRrfj2mOoayoN/B1oE61laCdZgCzPtN6MC/aW94LITaGJWHi7YYqdgdRgL1NqeC
n0tu8t14XsCT1xTIOa1ndb018+a5ppIcOnmGAj4naM5uA50rgRwChdSOTP/H10+J
93M2rvvak8aVdeWEhnMJyqWG2mFJ0YselJ+cMu66XFBkK7wg4UwCzzJ4Blqb1Igd
W/wctLDLqPVAxI85P/2p2dt+N4vzOnT/jr+dFxXOJg99E6iwa3qPCdzGHmszjhyC
uNhq/pWMt5tSk34IwYduyk1b9mlx9dCQsyREwrVomsdZD+XrUZHhrGrlcVJDfT07
2DCkVnGAoH0DRmz3t69KJS9U1JgzkaTDNaezkLlIZ7VZOdaC5nK74efnN0yinBkJ
9GhmR0qbk4/QVKeNWSftu4Rd9OUtRSaEMH0kO/S42vl3fW59u+ZGMEz26Ar4x/q7
jLx3vKfduJbpvberc3kQ2p9jQbUjlyFOTtnTAf84ckyIkvEMwpEhlyfchctPji/K
IaJ4Yd0KnKiLg/GH9Eon79cadAV2hzvYb2FZYI1RcrbRH+nZvGLgSbvHobqESERT
hBBXrAhaazRdxbOVqwMV9d+lq4llzUJJMOVCsK/PLnigrl5OCLQNQ2IVBbPv8WFD
VMg/9mGiUj0=
=lbFv
-----END PGP SIGNATURE-----

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmapDYsRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKATow//dAt+/eD4WANTgt82gOK5VLuhlp/il6/L
IsErVntOsmAlr1Ukag6lAFmrQrxDHbRo1g9w+P3dabEbedqeAy0vlyE7feifbzfn
8dAGAYJBPqyhG5w5Y1YKU/ZfJF5OjxuD9kjn5YTBNmNNva2wqrb4vQqLfmfhpMlx
hf3xMlqJ3plXvaqPFk69BzSgA1hKP9Z/f522RQs9lRq+aSP00zatLX9DK5oXynas
6DbInkrfUjbMaENoYcuUzC1w45DUcTcq6Or36+h86G78yIkQpfwlS82G0/f4wVnv
QlD5pC6dCmowuCrr5/xMoYt5ah7L+qcEUIRJ4uB0xQgQtQV32eLIFjpcHsN973ot
ji2ievMtoM5Ncu2Hq1R02Hvx5PUvVZamEpEWf+HzqJl2VATw2F63CMALLjxR6mw4
WORi90ZLQWtbt7lJgZEI29WOabuBWGG/cn+01gWLh8swqQpAgkGsbJhCxNXLiUfy
0PE7K+zoWVZzSiuOVeIh1Gn2p75gSTRQXfY+l+IfPPfOUBOuNN+w1J5HRUaT7ZAk
zBbPGFA2Y6x2zR9TD5n87QftXF6LPhf715qh5URI4Wl0pE+C9gxhQk+nf1aMKJ5J
/fOAtU8N+PtZPUm95NTaQxpkraspwHmhLRygWzA7wUGANmVUiX0fE3qgxW9NE2bI
paYjGigt040=
=FGlR
-----END PGP SIGNATURE-----

@ -2,21 +2,13 @@
# If we should verify tarball signature with GPGv2.
%global verify_tarball_signature 1
# If there are patches which touch autotools files, set this to 1.
%if !0%{?rhel}
%global patches_touch_autotools %{nil}
%else
# On RHEL the downstream patches always touch autotools files.
%global patches_touch_autotools 1
%endif
# The source directory.
%global source_directory 2.4-stable
%global source_directory 2.5-development
Name: virt-v2v
Epoch: 1
Version: 2.4.0
Release: 4%{?dist}
Version: 2.5.6
Release: 7%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -33,48 +25,34 @@ Source2: libguestfs.keyring
Source3: copy-patches.sh
# Patches are maintained in the following repository:
# https://github.com/libguestfs/virt-v2v/commits/rhel-9.4
# https://github.com/libguestfs/virt-v2v/commits/rhel-9.5
# Patches.
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-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0016: 0016-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0017: 0017-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0018: 0018-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0019: 0019-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0020: 0020-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0021: 0021-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0022: 0022-RHEL-Disable-o-glance.patch
Patch0023: 0023-RHEL-Remove-the-in-place-option.patch
Patch0024: 0024-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0025: 0025-RHEL-9-tests-Remove-btrfs-test.patch
Patch0026: 0026-RHEL-9-Remove-block-driver-option.patch
Patch0027: 0027-Update-common-submodule.patch
Patch0028: 0028-convert-windows-Install-blnsvr-from-virtio-win.patch
Patch0029: 0029-Update-common-submodule.patch
Patch0030: 0030-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch
Patch0031: 0031-docs-Note-that-mac-len-field-is-now-optional.patch
Patch0032: 0032-convert-More-robust-qemu-ga-installation-change-path.patch
Patch0033: 0033-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch
Patch0034: 0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch
Patch0035: 0035-Update-common-submodule.patch
Patch0036: 0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch
Patch0037: 0037-docs-Restate-position-on-removal-of-VMware-Tools.patch
Patch0038: 0038-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0039: 0039-convert-windows-Online-all-virtio-disks-at-first-boo.patch
Patch0001: 0001-docs-Note-that-mac-len-field-is-now-optional.patch
Patch0002: 0002-convert-More-robust-qemu-ga-installation-change-path.patch
Patch0003: 0003-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch
Patch0004: 0004-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch
Patch0005: 0005-Update-common-submodule.patch
Patch0006: 0006-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch
Patch0007: 0007-docs-Restate-position-on-removal-of-VMware-Tools.patch
Patch0008: 0008-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0009: 0009-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0010: 0010-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0011: 0011-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0012: 0012-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0013: 0013-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0014: 0014-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0015: 0015-RHEL-Disable-o-glance.patch
Patch0016: 0016-RHEL-Remove-the-in-place-option.patch
Patch0017: 0017-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0018: 0018-RHEL-9-tests-Remove-btrfs-test.patch
Patch0019: 0019-RHEL-9-Remove-block-driver-option.patch
Patch0020: 0020-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0021: 0021-convert-windows-Online-all-virtio-disks-at-first-boo.patch
# Patches were taken from:
# https://github.com/libguestfs/libguestfs-common/commit/94619ded353081255409eb3ffae51061adcbf9a4
Patch0022: 0022-convert-windows-Ignore-sriov-drivers-on-virtio-win.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -93,10 +71,7 @@ ExcludeArch: %{ix86}
ExclusiveArch: x86_64
%endif
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
BuildRequires: make
BuildRequires: /usr/bin/pod2man
BuildRequires: gcc
@ -256,9 +231,7 @@ for %{name}.
%endif
%autosetup -p1
%if 0%{patches_touch_autotools}
autoreconf -i
%endif
autoreconf -fiv
%build
@ -383,18 +356,63 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check
%changelog
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.4.0-4
* Wed Oct 16 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 1:2.5.6-7
- Add 0022-convert-windows-Ignore-sriov-drivers-on-virtio-win.patch
* Thu Aug 29 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.6-5
- convert: windows: Ignore sriov drivers on virtio-win disk
resolves: RHEL-56383
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.6-4
- convert: windows: Online all virtio disks at first boot
resolves: RHEL-55837
- Bundle virt-v2v-in-place for use by MTV
resolves: RHEL-55823
* Tue Aug 13 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.4.0-3
- Fixes to improve installation of QEMU Guest Agent and removal
of VMware Tools
resolves: RHEL-54150, RHEL-54151
- Allow --mac gw and len fields to be optional
resolves: RHEL-54152
resolves: RHEL-55763
* Thu Aug 08 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.6-3
- Further fixes for QEMU Guest Agent install & VMware Tools removal
resolves: RHEL-49761, RHEL-51169
* Mon Aug 05 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.6-2
- Document uninstallation of VMware Tools on Windows
resolves: RHEL-51169
* Thu Aug 01 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.6-1
- Further fixes for QEMU Guest Agent
resolves: RHEL-49761
- Place Windows firstboot files under C:\Program Files\Guestfs\Firstboot
- Improve debugging output
* Sun Jul 28 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-3
- Allow virt-v2v --mac gw and len fields to be optional
resolves: RHEL-50731
* Thu Jul 25 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-2
- Fix installation of QEMU Guest Agent
resolves: RHEL-49761
* Thu Jul 11 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-1
- Rebase to virt-v2v 2.5.5
- Enhance -o kubevirt output
resolves: RHEL-45992
* Tue Jul 09 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.4-2
- Package virt-v2v-in-place in libexec as unsupported tool
- Add warning about virt-v2v-in-place not being supported
resolves: RHEL-40903
- Add more fields to virt-inspector output
related: MTV-1079
- Revert "docs: Remove paragraph about -ip passwords and ssh/scp"
resolves: RHEL-45527
* Thu May 16 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.4-1
- Rebase to virt-v2v 2.5.4
- Add missing firmware types and enhance -o kubevirt
resolves: RHEL-28197
- Fix RHV JSON transfer bug
resolves: RHEL-32105
- docs: Add VDDK prereq that server must not be in maintenance mode
resolves: RHEL-33699
- convert: windows: Install blnsvr from virtio-win
resolves: RHEL-36591
* Mon Jan 22 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.4.0-2
- Rebase to virt-v2v 2.4.0

Loading…
Cancel
Save