Further fixes for nbdkit vddk export wildcard

resolves: RHEL-122753
related: RHEL-121728
This commit is contained in:
Richard W.M. Jones 2025-10-21 10:03:22 +01:00
parent 47bca215cd
commit a061604cbe
11 changed files with 194 additions and 19 deletions

View File

@ -0,0 +1,49 @@
From 75201855045c1ae45a06de5ccb4e7f079d294c5d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 20 Oct 2025 09:32:54 +0100
Subject: [PATCH] convert: windows: Warn about Trend Micro anti-virus
Seen in the wild and suspected of causing conversion problems:
{app2_name: ApexOneNT,
app2_display_name: Trend Micro Apex One Security Agent,
app2_epoch: 0,
app2_version: 14.0.12980,
app2_release: ,
app2_arch: ,
app2_install_path: ,
app2_trans_path: ,
app2_publisher: Trend Micro Inc.,
app2_url: http://www.trendmicro.com/,
app2_source_package: ,
app2_summary: ,
app2_description: ,
app2_spare1: ,
app2_spare2: ,
app2_spare3: ,
app2_spare4: ,
}
---
convert/windows.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/convert/windows.ml b/convert/windows.ml
index 2dde6b30..f28c7e09 100644
--- a/convert/windows.ml
+++ b/convert/windows.ml
@@ -29,6 +29,7 @@ let rex_kaspersky = PCRE.compile ~caseless:true "kaspersky"
let rex_mcafee = PCRE.compile ~caseless:true "mcafee"
let rex_norton = PCRE.compile ~caseless:true "norton"
let rex_sophos = PCRE.compile ~caseless:true "sophos"
+let rex_trend = PCRE.compile ~caseless:true "ApexOneNT"
let rex_avg_tech = PCRE.compile ~caseless:true "avg technologies" (* RHBZ#1261436 *)
let rec detect_antivirus { Types.i_type = t; i_apps = apps } =
@@ -42,6 +43,7 @@ and check_app { Guestfs.app2_name = name;
name =~ rex_mcafee ||
name =~ rex_norton ||
name =~ rex_sophos ||
+ name =~ rex_trend ||
publisher =~ rex_avg_tech
and (=~) str rex = PCRE.matches rex str

View File

@ -0,0 +1,120 @@
From dda93d7fd3ef5b2cdf25cfefa0b2d41207fa54f6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 20 Oct 2025 14:50:07 +0100
Subject: [PATCH] input/input_vddk.ml: Pass only longest prefix to vddk export
parameter
See discussion on https://gitlab.com/nbdkit/nbdkit/-/merge_requests/113
nbdkit commit 01b429c412 ("vddk: Don't use FNM_PATHNAME when matching
export parameter") removes the FNM_PATHNAME restriction, so we can
just use the longest common prefix again.
This change requires nbdkit >= 1.45.11. I think it's time to raise
the minimum version of nbdkit anyway, so starting with virt-v2v 2.10,
nbdkit 1.46 will be required. If you use too old nbdkit you will see
the error:
virt-v2v: error: nbdkit must be >= 1.45.11 for input from VDDK
This partially reverts commit ba86b22c75 ("input/input_vddk.ml: Handle
subdirectories in nbdkit vddk export wildcard") but I didn't actually
revert that commit because I wanted to keep the explantory comments in
the code.
Reverts: commit ba86b22c75
Related: https://gitlab.com/nbdkit/nbdkit/-/merge_requests/113
Related: https://gitlab.com/nbdkit/nbdkit/-/commit/01b429c412504a491a4b5cc009a9c2e906f993ef
Related: https://issues.redhat.com/browse/RHEL-121728
---
README | 2 +-
input/input_vddk.ml | 43 +++++++++++++------------------------------
2 files changed, 14 insertions(+), 31 deletions(-)
diff --git a/README b/README
index 407869b4..b21cb87d 100644
--- a/README
+++ b/README
@@ -56,7 +56,7 @@ REQUIREMENTS
* OCaml bindings for libnbd
-* nbdkit >= 1.28 (https://gitlab.com/nbdkit/nbdkit)
+* nbdkit >= 1.45.11 (https://gitlab.com/nbdkit/nbdkit)
* These nbdkit plugins and filters:
diff --git a/input/input_vddk.ml b/input/input_vddk.ml
index 92214677..ad0e300f 100644
--- a/input/input_vddk.ml
+++ b/input/input_vddk.ml
@@ -36,11 +36,15 @@ open Input
let libNN = sprintf "lib%d" Sys.word_size
(* Calculate the nbdkit vddk plugin 'export' parameter. This is a
- * wildcard that must match all filenames given. nbdkit uses
- * 'fnmatch (export, filename, FNM_PATHNAME)' when checking this,
- * which means:
- * - We have to escape any fnmatch-special chars such as '[' and '*'
- * - '*' does not match '/' characters in the filename
+ * wildcard that must match all filenames given.
+ *
+ * nbdkit 1.44 used 'fnmatch (export, filename, FNM_PATHNAME)'
+ * which means '*' does not match '/' characters in the filename.
+ * Unfortunately this made it impossible to match certain paths,
+ * in particular if the guest has some files in a subdirectory.
+ *
+ * nbdkit 1.46 relaxes this to 'fnmatch (export, filename, 0)',
+ * so a simple longest prefix works.
*)
let get_vddk_export_wildcard = function
| [] -> assert false (* can't happen, checked by the caller *)
@@ -50,37 +54,14 @@ let get_vddk_export_wildcard = function
List.iter (fun f -> assert (String.ends_with ".vmdk" f)) files;
(* Calculate the longest common prefix of all the filenames.
- * Remove the prefix from each filename, leaving the remainder strings.
- * eg.
- * "foobar", "foobazs" => prefix = "fooba", remainders = ["r", "zs"]
+ * eg. "foobar", "foobazs" => prefix = "fooba"
*)
let prefix = String.longest_common_prefix files in
- let prefix_len = String.length prefix in
- let remainders = List.map (
- fun f ->
- let n = String.length f in
- assert (prefix_len <= n);
- String.sub f prefix_len (n - prefix_len)
- ) files in
-
- (* The number of '/' (slash) characters in the remainders must be
- * the same, otherwise there's something weird with subdirectories
- * going on that we can't handle yet. (XXX If this happens, then
- * we'd need to change nbdkit because it cannot possibly handle
- * a wildcard that matches different directory depths).
- *)
- let count_slashes = List.map (String.count_chars '/') remainders in
- let nr_slashes = List.hd count_slashes in
- List.iter (fun nr -> assert (nr_slashes = nr)) count_slashes;
-
- (* Now we need to generate "*/*/*" for this number of slashes. *)
- let stars = List.make (nr_slashes+1) "*" in
- let stars_n_slashes = String.concat "/" stars in
(* Construct the final wildcard. Note we only need to
* escape the prefix (the only part which is user content).
*)
- fnmatch_escape prefix ^ stars_n_slashes ^ ".vmdk"
+ fnmatch_escape prefix ^ "*.vmdk"
module VDDK = struct
let to_string options args =
@@ -300,6 +281,8 @@ sed 's/.*Fingerprint=\([A-F0-9:]\+\)/\1/' |}
(* Check we have nbdkit and the vddk plugin and the cow filter. *)
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
+ if not (Nbdkit.version () >= (1, 45, 11)) then
+ error (f_"nbdkit must be >= 1.45.11 for input from VDDK");
if not (Nbdkit.probe_plugin "vddk") then
error (f_"nbdkit-vddk-plugin is not installed");
if not (Nbdkit.probe_filter "cow") then

View File

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

View File

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

View File

@ -1,4 +1,4 @@
From 1240a80409677fbe2b76e4909171f05d24f46101 Mon Sep 17 00:00:00 2001
From cdab9e112c9ffd25a81879a9c32542938253cb4f 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,4 +1,4 @@
From 1312c3240a48fbfbf00d1f5b090994a6e83a9623 Mon Sep 17 00:00:00 2001
From caaf340c9664f542a3fd57642154b98625045702 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu

View File

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

View File

@ -1,4 +1,4 @@
From 34ab1bb7e4666d1eefd00452399c1c8fa3b15421 Mon Sep 17 00:00:00 2001
From 108b193dfcbc6c4d15c073697960bb11ff6ff207 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 1422e77b7872fb915e314d26eb6cfa55961626ee Mon Sep 17 00:00:00 2001
From e86f8ab93c534db030ebdc48bac2f5ca4f555047 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: tests: Remove btrfs test

View File

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

View File

@ -45,7 +45,7 @@ ExclusiveArch: x86_64
Name: virt-v2v
Epoch: 1
Version: 2.9.9
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -65,14 +65,16 @@ Source3: copy-patches.sh
# https://github.com/libguestfs/virt-v2v/commits/rhel-10.2
# Patches.
Patch0001: 0001-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0002: 0002-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0003: 0003-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0004: 0004-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0005: 0005-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0006: 0006-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0007: 0007-RHEL-tests-Remove-btrfs-test.patch
Patch0008: 0008-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0001: 0001-convert-windows-Warn-about-Trend-Micro-anti-virus.patch
Patch0002: 0002-input-input_vddk.ml-Pass-only-longest-prefix-to-vddk.patch
Patch0003: 0003-RHEL-Fixes-for-libguestfs-winsupport.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-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0008: 0008-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0009: 0009-RHEL-tests-Remove-btrfs-test.patch
Patch0010: 0010-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
BuildRequires: autoconf, automake, libtool
BuildRequires: make
@ -116,6 +118,8 @@ BuildRequires: glibc-utils
BuildRequires: %{_bindir}/qemu-nbd
BuildRequires: %{_bindir}/nbdcopy
BuildRequires: %{_bindir}/nbdinfo
# Should be this, but not yet in buildroot:
#BuildRequires: nbdkit-server >= 1.45.11
BuildRequires: nbdkit-server >= 1.44
BuildRequires: nbdkit-file-plugin
BuildRequires: nbdkit-null-plugin
@ -166,7 +170,7 @@ Requires: libnbd >= 1.22
Requires: %{_bindir}/qemu-nbd
Requires: %{_bindir}/nbdcopy
Requires: %{_bindir}/nbdinfo
Requires: nbdkit-server >= 1.44
Requires: nbdkit-server >= 1.45.11
Requires: nbdkit-curl-plugin
Requires: nbdkit-file-plugin
Requires: nbdkit-nbd-plugin
@ -380,7 +384,7 @@ done
%changelog
* Mon Sep 22 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.9.9-1
* Tue Oct 21 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.9.9-2
- Rebase to virt-v2v 2.9.9
resolves: RHEL-111241
- Tighten permissions on windows C:\Program Files\Guestfs
@ -397,6 +401,8 @@ done
resolves: RHEL-122308
- Handle subdirectories in nbdkit vddk export wildcard
resolves: RHEL-121728
- Further fixes for nbdkit vddk export wildcard
resolves: RHEL-122753
* Thu Aug 21 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.8.1-9
- Rebase to virt-v2v 2.8.1