Rebase to virt-v2v 2.5.4

- 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
This commit is contained in:
Richard W.M. Jones 2024-05-16 13:57:52 +01:00
parent 2329c02af8
commit 0fd1f21bfc
26 changed files with 342 additions and 408 deletions

View File

@ -0,0 +1,66 @@
From 6513fcbec9a10652cb8b5690936e7265e9c8851c 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
---
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++;

View File

@ -1,27 +0,0 @@
From ce67e6e66fdd4140efb1dff961734790f6158271 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 12 Mar 2024 09:56:55 +0000
Subject: [PATCH] tests: Don't rebuild real_guests_scripts after clean
Move this rule to 'make distclean' so we don't rebuild these scripts
all the time. It's not necessary as they hardly ever change.
---
tests/Makefile.am | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cc297890..723a6506 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -172,8 +172,10 @@ test-v2v-conversion-of-%.sh:
chmod 0755 $@-t
mv $@-t $@
+DISTCLEANFILES += \
+ $(real_guests_scripts)
+
CLEANFILES += \
- $(real_guests_scripts) \
real-*.img \
real-*.xml

View File

@ -0,0 +1,212 @@
From 70eec57765280032e08a1d738402926b14a851bf 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
---
common | 2 +-
convert/convert_windows.ml | 6 ++++++
2 files changed, 7 insertions(+), 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. *)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 34cf341b..2d6e2059 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -357,6 +357,12 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
may want to install the guest agent manually after \
conversion.");
+ (* Install Balloon Server unconditionally and warn if missing *)
+ if not (Inject_virtio_win.inject_blnsvr virtio_win) then
+ warning (f_"Balloon Server (blnsvr.exe) not found on tools \
+ ISO/directory. You may want to install this component \
+ manually after conversion.");
+
unconfigure_xenpv ();
unconfigure_prltools ();
unconfigure_vmwaretools ()

View File

@ -1,70 +0,0 @@
From a659b334f5b72b8a9843b1813a97114adc62a543 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 15 Mar 2024 11:34:26 +0000
Subject: [PATCH] tests/test-v2v-o-kubevirt-windows.sh: Set fake virtio-win
When converting this phony Windows guest we didn't set the VIRTIO_WIN
environment variable. As a result the test output could change (and
break) depending on if the virtio-win package was installed or not.
Point VIRTIO_WIN to the fake virtio-win directory (as we do with other
Windows tests). We also need to modify the test output since the fake
virtio-win does contain enough for virt-v2v to think that virtio
driver installation was successful.
Fixes: commit af1f7b571fb21fdbfa2974ee54a22b4fdcbc886a
---
tests/test-v2v-o-kubevirt-windows.sh | 6 +++++-
tests/test-v2v-o-kubevirt-windows.yaml.expected | 10 ++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/tests/test-v2v-o-kubevirt-windows.sh b/tests/test-v2v-o-kubevirt-windows.sh
index 93e4d5e9..d672b9ab 100755
--- a/tests/test-v2v-o-kubevirt-windows.sh
+++ b/tests/test-v2v-o-kubevirt-windows.sh
@@ -32,6 +32,7 @@ libvirt_uri="test://$abs_top_builddir/test-data/phony-guests/guests.xml"
windows=../test-data/phony-guests/windows.img
export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
+export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win"
d=test-v2v-o-kubevirt-windows.d
rm -rf $d
@@ -49,7 +50,10 @@ cat $d/test.yaml
test -f $d/test-sda
# Remove some parts of the yaml which change between runs.
-sed -i -e 's/^\(# generated by virt-v2v\).*/\1/' $d/test.yaml
+sed -i \
+ -e 's/^\(# generated by virt-v2v\).*/\1/' \
+ -e 's,\(path: \).*/\(test-sda\),\1\2,' \
+ $d/test.yaml
# Compare yaml to the expected output.
diff -u test-v2v-o-kubevirt-windows.yaml.expected $d/test.yaml
diff --git a/tests/test-v2v-o-kubevirt-windows.yaml.expected b/tests/test-v2v-o-kubevirt-windows.yaml.expected
index 88f25cf1..0b12eaa9 100644
--- a/tests/test-v2v-o-kubevirt-windows.yaml.expected
+++ b/tests/test-v2v-o-kubevirt-windows.yaml.expected
@@ -25,11 +25,21 @@ spec:
cpu:
cores: 1
devices:
+ rng: {}
+ disks:
+ - disk:
+ bus: virtio
+ name: disk-0
interfaces:
- name: net_default
masquerade: {}
macAddress: 00:11:22:33:44:55
model: virtio
+ volumes:
+ - hostDisk:
+ path: test-sda
+ type: Disk
+ name: disk-0
networks:
- networkName: default
name: net_default

View File

@ -0,0 +1,26 @@
From 9f7bb5fc33e3a828944f2d7987c84bcf17172b4c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 May 2024 13:43:29 +0100
Subject: [PATCH] docs: Add VDDK prereq that server must not be in maintenance
mode
Fixes: https://issues.redhat.com/browse/RHEL-33699
---
docs/virt-v2v-input-vmware.pod | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
index fe59222a..fc6be0e0 100644
--- a/docs/virt-v2v-input-vmware.pod
+++ b/docs/virt-v2v-input-vmware.pod
@@ -231,6 +231,10 @@ link above.
VDDK imports require a feature added in libvirt E<ge> 3.7.
+=item 5.
+
+The VMware server must not be in maintenance mode.
+
=back
=head2 VDDK: ESXi NFC service memory limits

View File

@ -1,62 +0,0 @@
From cfeebf0f121e21b8a96092330e02cc9875ee2af4 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Fri, 5 Apr 2024 22:56:40 +0300
Subject: [PATCH] -o rhv-upload: Add context if parsing params fails (#47)
If parsing params fail we get unhelpful error:
virt-v2v: error: internal error: invalid argument:
/tmp/v2v.CtVpBL/v2vtransfer.json: JSON parse error: end of file expected
near 'e'
Change the parsing code to read the entire json text and include it in
the error message. This will make it clear why the json could not be
parsed, and help to find the root cause for having invalid json.
Example error:
$ cat out.params0.json
This is not a json document
$ python output/rhv-upload-transfer.py out.params0.json
Traceback (most recent call last):
File "/home/nsoffer/src/virt-v2v/output/rhv-upload-transfer.py", line 261, in <module>
raise RuntimeError(f"Cannot parse params {data!r}: {e}").with_traceback(
File "/home/nsoffer/src/virt-v2v/output/rhv-upload-transfer.py", line 259, in <module>
params = json.loads(data)
^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
RuntimeError: Cannot parse params 'This is not a json document\n': Expecting value: line 1 column 1 (char 0)
Related to #46
---
output/rhv-upload-transfer.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/output/rhv-upload-transfer.py b/output/rhv-upload-transfer.py
index 626eff77..1504b076 100644
--- a/output/rhv-upload-transfer.py
+++ b/output/rhv-upload-transfer.py
@@ -249,7 +249,14 @@ if len(sys.argv) != 2:
# Parameters are passed in via a JSON document.
with open(sys.argv[1], 'r') as fp:
- params = json.load(fp)
+ data = fp.read()
+
+try:
+ params = json.loads(data)
+except ValueError as e:
+ raise RuntimeError(f"Cannot parse params {data!r}: {e}").with_traceback(
+ e.__traceback__
+ ) from None
# What is passed in is a password file, read the actual password.
with open(params['output_password'], 'r') as fp:

View File

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

View File

@ -1,24 +0,0 @@
From d8f09872a694836edce4685c605c09ba5ece9c31 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 5 Apr 2024 21:52:48 +0100
Subject: [PATCH] -o rhv-upload: clarify debug message
Thanks: Nir Soffer
Related: https://github.com/libguestfs/virt-v2v/issues/46
---
output/rhv-upload-transfer.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/output/rhv-upload-transfer.py b/output/rhv-upload-transfer.py
index 1504b076..7530f73e 100644
--- a/output/rhv-upload-transfer.py
+++ b/output/rhv-upload-transfer.py
@@ -45,7 +45,7 @@ def find_host(connection):
vdsm_id = f.readline().strip()
except Exception as e:
# This is most likely not an oVirt host.
- debug("cannot read /etc/vdsm/vdsm.id, using any host: %s" % e)
+ debug("cannot read /etc/vdsm/vdsm.id, not running on an ovirt host [this is not an error]: original exception: %s" % e)
return None
debug("hw_id = %r" % vdsm_id)

View File

@ -1,4 +1,4 @@
From 9a84eec09ed1ea7c6cc64475e6342cd0ba265d1a Mon Sep 17 00:00:00 2001
From 1057f48af0a7f7169ff295bfdedeb946cb2de82d 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

View File

@ -1,34 +0,0 @@
From 19ac262ceb03db2bf53a63302673d328737523de Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 5 Apr 2024 22:13:40 +0100
Subject: [PATCH] -o rhv-upload: Dump the JSON before parsing
Related: https://github.com/libguestfs/virt-v2v/issues/46
---
output/output_rhv_upload.ml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/output/output_rhv_upload.ml b/output/output_rhv_upload.ml
index 3926cfee..7a148b1e 100644
--- a/output/output_rhv_upload.ml
+++ b/output/output_rhv_upload.ml
@@ -273,6 +273,9 @@ See also the virt-v2v-output-rhv(1) manual.");
if Python_script.run_command ~stdout_fd:fd
precheck_script json_params [] <> 0 then
error (f_"failed server prechecks, see earlier errors");
+ if verbose () then
+ debug "precheck output before parsing: %s"
+ (read_whole_file precheck_json);
let json = JSON_parser.json_parser_tree_parse_file precheck_json in
debug "precheck output parsed as: %s"
(JSON.string_of_doc ~fmt:JSON.Indented ["", json]);
@@ -396,6 +399,9 @@ See also the virt-v2v-output-rhv(1) manual.");
if Python_script.run_command ~stdout_fd:fd
transfer_script json_params [] <> 0 then
error (f_"failed to start transfer, see earlier errors");
+ if verbose () then
+ debug "transfer output before parsing: %s"
+ (read_whole_file transfer_json);
let json = JSON_parser.json_parser_tree_parse_file transfer_json in
debug "transfer output parsed as: %s"
(JSON.string_of_doc ~fmt:JSON.Indented ["", json]);

View File

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

View File

@ -1,43 +0,0 @@
From 0ea92cc02949f3e829744e6e62d861dfd8ff5607 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Fri, 5 Apr 2024 23:50:27 +0300
Subject: [PATCH] -o rhv-upload: Output outside of the with block
We write the json inside a with block, so what actually happen is:
1. Computing the values
2. Dumping the json to stdout
3. Closing the connection
If some code in sdk.Connection.close() write something to stdout, it
will corrupt our json output. Avoid this by moving the output out of the
with block.
This will not prevent bad code to write something before the json. We
need to log bad json in the Ocaml code to reveal such issue.
---
output/rhv-upload-transfer.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/output/rhv-upload-transfer.py b/output/rhv-upload-transfer.py
index 7530f73e..349e0f59 100644
--- a/output/rhv-upload-transfer.py
+++ b/output/rhv-upload-transfer.py
@@ -285,10 +285,10 @@ with closing(connection):
transfer = create_transfer(connection, disk, host)
destination_url = get_transfer_url(transfer)
- # Send the destination URL, transfer ID, and host flag back to OCaml code.
- results = {
- "transfer_id": transfer.id,
- "destination_url": destination_url,
- "is_ovirt_host": host is not None,
- }
- json.dump(results, sys.stdout)
+# Send the destination URL, transfer ID, and host flag back to OCaml code.
+results = {
+ "transfer_id": transfer.id,
+ "destination_url": destination_url,
+ "is_ovirt_host": host is not None,
+}
+json.dump(results, sys.stdout)

View File

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

View File

@ -1,47 +0,0 @@
From ff341481eb397d700c346d27c8a23f9732028e03 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sat, 6 Apr 2024 00:21:19 +0300
Subject: [PATCH] -o rhv-upload: Improve host id logging
This log[1] is proved confusing for developers:
cannot read /etc/vdsm/vdsm.id, using any host: [Errno 2] No such file or directory: '/etc/vdsm/vdsm.id'
This is actually a debug message, that can help RHV developers to
understand where virt-v2v was running. To make this more clear, in the
expected case when running on non-oVirt host, we log now:
not an oVirt host, using non-oVirt host
For any other error, we can degrade to remote transfer, but we want to
warn the user about this, so we log:
warning: cannot read host id, using non-oVirt host: [Errno 2] No such file or directory: '/etc/vdsm/vdsm.id'
[1] https://github.com/libguestfs/virt-v2v/issues/46#issuecomment-2039604719
RWMJ: Changed "any host" to "non-oVirt host" to make it clearer.
---
output/rhv-upload-transfer.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/output/rhv-upload-transfer.py b/output/rhv-upload-transfer.py
index 349e0f59..ed96153b 100644
--- a/output/rhv-upload-transfer.py
+++ b/output/rhv-upload-transfer.py
@@ -43,9 +43,13 @@ def find_host(connection):
try:
with open("/etc/vdsm/vdsm.id") as f:
vdsm_id = f.readline().strip()
+ except FileNotFoundError:
+ # Expected condition when running on non-oVirt host.
+ debug("not an oVirt host, using non-oVirt host")
+ return None
except Exception as e:
- # This is most likely not an oVirt host.
- debug("cannot read /etc/vdsm/vdsm.id, not running on an ovirt host [this is not an error]: original exception: %s" % e)
+ # Unexpected but we can degrade to remote transfer.
+ debug(f"warning: cannot read host id, using non-oVirt host: {e}")
return None
debug("hw_id = %r" % vdsm_id)

View File

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

View File

@ -1,27 +0,0 @@
From 5672d89531ebe560aa4437a82009bdf6532983d1 Mon Sep 17 00:00:00 2001
From: Nir Soffer <nsoffer@redhat.com>
Date: Sat, 6 Apr 2024 17:15:45 +0300
Subject: [PATCH] -o rhv-upload: Don't share transfer.json (#49)
Use unique v2vtransferN.json for every transfer, like like
out.paramsN.json. If we keep the temporary files after the import, the
content of the file can help debugging.
Related to #46
---
output/output_rhv_upload.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/output/output_rhv_upload.ml b/output/output_rhv_upload.ml
index 7a148b1e..f8bff24f 100644
--- a/output/output_rhv_upload.ml
+++ b/output/output_rhv_upload.ml
@@ -394,7 +394,7 @@ See also the virt-v2v-output-rhv(1) manual.");
(fun chan -> output_string chan (JSON.string_of_doc json_params));
(* Start the transfer. *)
- let transfer_json = dir // "v2vtransfer.json" in
+ let transfer_json = dir // sprintf "v2vtransfer%d.json" i in
let fd = Unix.openfile transfer_json [O_WRONLY; O_CREAT] 0o600 in
if Python_script.run_command ~stdout_fd:fd
transfer_script json_params [] <> 0 then

View File

@ -1,4 +1,4 @@
From 130ffc9b7ae3e8e11c342e7c90b6286ab21b881c Mon Sep 17 00:00:00 2001
From 447d296d141e64bbf594dbe8fc69ea58fc3de46e 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)

View File

@ -1,34 +0,0 @@
From 089d9a235e0e8a959c6d85004e24f2cdb37681b4 Mon Sep 17 00:00:00 2001
From: Thorsten Bolten <t.bolten@gmx.de>
Date: Sat, 6 Apr 2024 10:41:20 -0400
Subject: [PATCH] -o rhv-upload: Add O_TRUNC to truncate JSON file if it exists
Fixes: https://github.com/libguestfs/virt-v2v/issues/46
Thanks: Nir Soffer
---
output/output_rhv_upload.ml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/output/output_rhv_upload.ml b/output/output_rhv_upload.ml
index f8bff24f..d6fde169 100644
--- a/output/output_rhv_upload.ml
+++ b/output/output_rhv_upload.ml
@@ -269,7 +269,7 @@ See also the virt-v2v-output-rhv(1) manual.");
("rhv_disk_uuids", JSON.List ids) :: json_params
in
let precheck_json = dir // "v2vprecheck.json" in
- let fd = Unix.openfile precheck_json [O_WRONLY; O_CREAT] 0o600 in
+ let fd = Unix.openfile precheck_json [O_WRONLY; O_CREAT; O_TRUNC] 0o600 in
if Python_script.run_command ~stdout_fd:fd
precheck_script json_params [] <> 0 then
error (f_"failed server prechecks, see earlier errors");
@@ -395,7 +395,8 @@ See also the virt-v2v-output-rhv(1) manual.");
(* Start the transfer. *)
let transfer_json = dir // sprintf "v2vtransfer%d.json" i in
- let fd = Unix.openfile transfer_json [O_WRONLY; O_CREAT] 0o600 in
+ let fd =
+ Unix.openfile transfer_json [O_WRONLY; O_CREAT; O_TRUNC] 0o600 in
if Python_script.run_command ~stdout_fd:fd
transfer_script json_params [] <> 0 then
error (f_"failed to start transfer, see earlier errors");

View File

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

View File

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

View File

@ -1,4 +1,4 @@
From 3fefe2b16e9e17322e5a620851f6b263e216ee98 Mon Sep 17 00:00:00 2001
From 8ec151f6376c65ef5706e14f28530514c9b9e877 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

View File

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

View File

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

View File

@ -1,4 +1,4 @@
From 6aa2c1976bebf550149e27cd4463408ec476addf Mon Sep 17 00:00:00 2001
From 79be5c20781a8e5efd7e5335a552ad69bedf5e76 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

View File

@ -1,2 +1,2 @@
SHA512 (virt-v2v-2.5.2.tar.gz) = 2b0eedb58b8e2f6f5550147b4bae0fab2b82e671b711d88cc7f0b43b0e83ed4a6db4218f35b3edbb4d94731602d5bf88045bd371748bff6ec38cca6f85e28cfc
SHA512 (virt-v2v-2.5.2.tar.gz.sig) = 89f5de8b490d01b7c19a0ee29bf2c5d538f4a1067d573e20d889394bae346ce5f0515300bdcaeae1517067dde43410e53e213f5ac413b1d9644b0538df565132
SHA512 (virt-v2v-2.5.4.tar.gz) = ea872978eefc9feacb6048bb217449804612e5cc68bfbd1f20e5aaf637ca7ca8be92798ba1cbc1d2d6ddbf6a07628e79beea7db1966150675d9fbda9d4361b7a
SHA512 (virt-v2v-2.5.4.tar.gz.sig) = 02780e8ae0bdff8c5b22b52bdd24d5f9dfa2d808b792abf7f8bcaa8c4e2c12ea52d3f2cd2c64b8a261437db69409f9ea1d12ac182dbc96e2bb5441a434ac7f84

View File

@ -3,12 +3,12 @@
%global verify_tarball_signature 1
# The source directory.
%global source_directory 2.4-stable
%global source_directory 2.5-development
Name: virt-v2v
Epoch: 1
Version: 2.5.2
Release: 2%{?dist}
Version: 2.5.4
Release: 1%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -28,27 +28,21 @@ Source3: copy-patches.sh
# https://github.com/libguestfs/virt-v2v/commits/rhel-9.5
# Patches.
Patch0001: 0001-tests-Don-t-rebuild-real_guests_scripts-after-clean.patch
Patch0002: 0002-tests-test-v2v-o-kubevirt-windows.sh-Set-fake-virtio.patch
Patch0003: 0003-o-rhv-upload-Add-context-if-parsing-params-fails-47.patch
Patch0004: 0004-o-rhv-upload-clarify-debug-message.patch
Patch0005: 0005-o-rhv-upload-Dump-the-JSON-before-parsing.patch
Patch0006: 0006-o-rhv-upload-Output-outside-of-the-with-block.patch
Patch0007: 0007-o-rhv-upload-Improve-host-id-logging.patch
Patch0008: 0008-o-rhv-upload-Don-t-share-transfer.json-49.patch
Patch0009: 0009-o-rhv-upload-Add-O_TRUNC-to-truncate-JSON-file-if-it.patch
Patch0010: 0010-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0011: 0011-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0012: 0012-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0013: 0013-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0014: 0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0015: 0015-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0016: 0016-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0017: 0017-RHEL-Disable-o-glance.patch
Patch0018: 0018-RHEL-Remove-the-in-place-option.patch
Patch0019: 0019-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0020: 0020-RHEL-9-tests-Remove-btrfs-test.patch
Patch0021: 0021-RHEL-9-Remove-block-driver-option.patch
Patch0001: 0001-Update-common-submodule.patch
Patch0002: 0002-convert-windows-Install-blnsvr-from-virtio-win.patch
Patch0003: 0003-docs-Add-VDDK-prereq-that-server-must-not-be-in-main.patch
Patch0004: 0004-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0005: 0005-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0006: 0006-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0007: 0007-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0008: 0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0009: 0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0010: 0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0011: 0011-RHEL-Disable-o-glance.patch
Patch0012: 0012-RHEL-Remove-the-in-place-option.patch
Patch0013: 0013-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0014: 0014-RHEL-9-tests-Remove-btrfs-test.patch
Patch0015: 0015-RHEL-9-Remove-block-driver-option.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -348,12 +342,16 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check
%changelog
* Mon Apr 08 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.2-2
- Rebase to virt-v2v 2.5.2
* 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