diff --git a/0013-Update-common-submodule.patch b/0013-Update-common-submodule.patch new file mode 100644 index 0000000..ca7e570 --- /dev/null +++ b/0013-Update-common-submodule.patch @@ -0,0 +1,120 @@ +From 980a7236d629d9290062f6e420421a4baf35bea2 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 26 Jan 2026 16:20:50 +0000 +Subject: [PATCH] Update common submodule + +This pulls in the following commits: + + Richard W.M. Jones (4): + mlcustomize/firstboot.ml: Print %USERNAME% and %USERDOMAIN% + mlcustomize/firstboot.ml: Fix %-encoding in previous commit + mlpcre: Add optional PCRE_ANCHORED flag when compiling expressions + mlstdutils: Export List.assoc_opt + +(cherry picked from commit e3e5cbcf45a0c9a523b8389b2fd8835d5ab684ee) +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common b54ba203..1005f4a6: +diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml +index 360c33d6..f29884c8 100644 +--- a/common/mlcustomize/firstboot.ml ++++ b/common/mlcustomize/firstboot.ml +@@ -295,6 +295,7 @@ exit /b + + :main + echo starting firstboot service ++echo effective user: %%USERNAME%% domain: %%USERDOMAIN%% + + if not exist "%%scripts_done%%" ( + mkdir "%%scripts_done%%" +diff --git a/common/mlpcre/PCRE.ml b/common/mlpcre/PCRE.ml +index 077290ef..33074af1 100644 +--- a/common/mlpcre/PCRE.ml ++++ b/common/mlpcre/PCRE.ml +@@ -22,7 +22,7 @@ exception Error of string * int + + type regexp + +-external compile : ?caseless:bool -> ?dotall:bool -> ?extended:bool -> ?multiline:bool -> string -> regexp = "guestfs_int_pcre_compile" ++external compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ?extended:bool -> ?multiline:bool -> string -> regexp = "guestfs_int_pcre_compile_byte" "guestfs_int_pcre_compile" + external matches : ?offset:int -> regexp -> string -> bool = "guestfs_int_pcre_matches" + external sub : int -> string = "guestfs_int_pcre_sub" + external subi : int -> int * int = "guestfs_int_pcre_subi" +diff --git a/common/mlpcre/PCRE.mli b/common/mlpcre/PCRE.mli +index b69a56ba..0fdc2bd5 100644 +--- a/common/mlpcre/PCRE.mli ++++ b/common/mlpcre/PCRE.mli +@@ -52,11 +52,12 @@ exception Error of string * int + type regexp + (** The type of a compiled regular expression. *) + +-val compile : ?caseless:bool -> ?dotall:bool -> ?extended:bool -> ?multiline:bool -> string -> regexp ++val compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ++ ?extended:bool -> ?multiline:bool -> string -> regexp + (** Compile a regular expression. This can raise {!Error}. + +- The flags [?caseless], [?dotall], [?extended], [?multiline] +- correspond to the [pcre_compile] flags [PCRE_CASELESS] etc. ++ The flags [?anchored], [?caseless], [?dotall], [?extended], [?multiline] ++ correspond to the [pcre_compile] flags [PCRE_ANCHORED] etc. + See pcre2api(3) for details of what they do. + All flags default to false. *) + +diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c +index 3959fd56..11be1577 100644 +--- a/common/mlpcre/pcre-c.c ++++ b/common/mlpcre/pcre-c.c +@@ -154,11 +154,12 @@ Optint_val (value intv, int defval) + } + + value +-guestfs_int_pcre_compile (value caselessv, value dotallv, +- value extendedv, value multilinev, ++guestfs_int_pcre_compile (value anchoredv, value caselessv, ++ value dotallv, value extendedv, ++ value multilinev, + value pattv) + { +- CAMLparam4 (caselessv, dotallv, extendedv, multilinev); ++ CAMLparam5 (anchoredv, caselessv, dotallv, extendedv, multilinev); + CAMLxparam1 (pattv); + const char *patt; + int options = 0; +@@ -167,6 +168,8 @@ guestfs_int_pcre_compile (value caselessv, value dotallv, + PCRE2_SIZE errnum; + + /* Flag parameters are all ‘bool option’, defaulting to false. */ ++ if (is_Some_true (anchoredv)) ++ options |= PCRE2_ANCHORED; + if (is_Some_true (caselessv)) + options |= PCRE2_CASELESS; + if (is_Some_true (dotallv)) +@@ -186,6 +189,14 @@ guestfs_int_pcre_compile (value caselessv, value dotallv, + CAMLreturn (Val_regexp (re)); + } + ++value ++guestfs_int_pcre_compile_byte (value *argv, int argn) ++{ ++ assert (argn == 6); ++ return guestfs_int_pcre_compile (argv[0], argv[1], argv[2], ++ argv[3], argv[4], argv[5]); ++} ++ + value + guestfs_int_pcre_matches (value offsetv, value rev, value strv) + { +diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli +index 6c1911da..77cf107e 100644 +--- a/common/mlstdutils/std_utils.mli ++++ b/common/mlstdutils/std_utils.mli +@@ -51,6 +51,7 @@ module List : sig + val find_all : ('a -> bool) -> 'a list -> 'a list + val partition : ('a -> bool) -> 'a list -> 'a list * 'a list + val assoc : 'a -> ('a * 'b) list -> 'b ++ val assoc_opt : 'a -> ('a * 'b) list -> 'b option + val assq : 'a -> ('a * 'b) list -> 'b + val mem_assoc : 'a -> ('a * 'b) list -> bool + val mem_assq : 'a -> ('a * 'b) list -> bool diff --git a/0014-v2v-Enhance-inspection-with-filesystems-information.patch b/0014-v2v-Enhance-inspection-with-filesystems-information.patch new file mode 100644 index 0000000..958f195 --- /dev/null +++ b/0014-v2v-Enhance-inspection-with-filesystems-information.patch @@ -0,0 +1,177 @@ +From 3078ec343c9bf2f9c6ca67a8eb9fbbbb3fb11b70 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 26 Jan 2026 16:26:27 +0000 +Subject: [PATCH] v2v: Enhance inspection with filesystems information + +Add the list of filesystems found by inspection to the internal +inspection struct. This is not actually used by virt-v2v itself (it +is used by virt-v2v-inspector), so this change should have no effect. + +(cherry picked from commit 6bd4ab3a5da9bf3bb3b22585d2226d6e338f23ba) + +For RHEL 10: Adjust minimum version of libguestfs since we will +backport the new API to libguestfs 1.58.1-2.el10. +--- + convert/mount_filesystems.ml | 49 ++++++++++++++++++++++++++++++++++++ + lib/types.ml | 9 +++++++ + lib/types.mli | 9 +++++++ + m4/guestfs-libraries.m4 | 5 ++-- + v2v/v2v_unit_tests.ml | 1 + + 5 files changed, 70 insertions(+), 3 deletions(-) + +diff --git a/convert/mount_filesystems.ml b/convert/mount_filesystems.ml +index e7974359..aa117e51 100644 +--- a/convert/mount_filesystems.ml ++++ b/convert/mount_filesystems.ml +@@ -30,6 +30,42 @@ let rec mount_filesystems g root = + reject_if_not_installed_image g root; + reject_if_unknown_fields g root; + ++ (* Get the list of filesystems. This is not actually used by ++ * virt-v2v (only used by virt-v2v-inspector) so try hard not ++ * to fail here. ++ *) ++ let fses = g#inspect_get_filesystems root in ++ let fses = Array.to_list fses in ++ let fses = List.sort compare fses in ++ let fses = ++ List.map ( ++ fun dev -> ++ let dev = g#canonical_device_name dev ++ and fs_type = ref None ++ and fs_version = ref None ++ and fs_label = ref None ++ and fs_uuid = ref None in ++ ++ (try ++ let v = g#vfs_type dev in ++ if v <> "" then ( ++ fs_type := Some v; ++ fs_version := get_filesystem_version g dev v; ++ ) ++ with G.Error msg -> debug "vfs_type: %s: %s (ignored)" dev msg); ++ (try ++ let v = g#vfs_label dev in ++ if v <> "" then fs_label := Some v ++ with G.Error msg -> debug "vfs_label: %s: %s (ignored)" dev msg); ++ (try ++ let v = g#vfs_uuid dev in ++ if v <> "" then fs_uuid := Some v ++ with G.Error msg -> debug "vfs_uuid: %s: %s (ignored)" dev msg); ++ ++ { fs_dev = dev; fs_type = !fs_type; fs_version = !fs_version; ++ fs_label = !fs_label; fs_uuid = !fs_uuid } ++ ) fses in ++ + (* Mount up the filesystems. *) + let mps = g#inspect_get_mountpoints root in + let cmp (a,_) (b,_) = compare (String.length a) (String.length b) in +@@ -121,6 +157,7 @@ let rec mount_filesystems g root = + i_product_name = g#inspect_get_product_name root; + i_product_variant = g#inspect_get_product_variant root; + i_mountpoints = mps; ++ i_filesystems = fses; + i_apps = apps; + i_apps_map = apps_map; + i_windows_systemroot = systemroot; +@@ -164,6 +201,18 @@ and error_if_unknown fieldname value = + Inspection field ‘%s’ was ‘unknown’.") + fieldname + ++(* See equivalent function in guestfs-tools.git:inspector/inspector.c *) ++and get_filesystem_version g dev = function ++ | "xfs" -> ++ let hash = g#xfs_info2 dev in ++ (match List.assoc_opt "meta-data.crc" hash with ++ | None -> None ++ | Some "0" -> (* XFS version *) Some "4" ++ | Some "1" -> (* XFS version *) Some "5" ++ | Some _ -> None ++ ) ++ | _ -> None ++ + (* Wrapper around g#inspect_list_applications2 which, for RPM + * guests, on failure tries to rebuild the RPM database before + * repeating the operation. +diff --git a/lib/types.ml b/lib/types.ml +index 9ba580e4..d727af89 100644 +--- a/lib/types.ml ++++ b/lib/types.ml +@@ -300,6 +300,7 @@ type inspect = { + i_product_name : string; + i_product_variant : string; + i_mountpoints : (string * string) list; ++ i_filesystems : filesystem list; + i_apps : Guestfs.application2 list; + i_apps_map : Guestfs.application2 list StringMap.t; + i_windows_systemroot : string; +@@ -310,6 +311,14 @@ type inspect = { + i_drive_mappings : (string * string) list; + } + ++and filesystem = { ++ fs_dev : string; ++ fs_type : string option; ++ fs_version : string option; ++ fs_label : string option; ++ fs_uuid : string option; ++} ++ + let string_of_inspect inspect = + sprintf "\ + i_root = %s +diff --git a/lib/types.mli b/lib/types.mli +index 4c705a73..64b6336f 100644 +--- a/lib/types.mli ++++ b/lib/types.mli +@@ -207,6 +207,7 @@ type inspect = { + i_product_name : string; + i_product_variant : string; + i_mountpoints : (string * string) list; ++ i_filesystems : filesystem list; + i_apps : Guestfs.application2 list; (** List of packages installed. *) + i_apps_map : Guestfs.application2 list StringMap.t; + (** This is a map from the app name to the application object. +@@ -220,6 +221,14 @@ type inspect = { + i_drive_mappings : (string * string) list; + } + ++and filesystem = { ++ fs_dev : string; ++ fs_type : string option; ++ fs_version : string option; ++ fs_label : string option; ++ fs_uuid : string option; ++} ++ + val string_of_inspect : inspect -> string + + (** {2 Disk stats} *) +diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4 +index db11cff6..c4237438 100644 +--- a/m4/guestfs-libraries.m4 ++++ b/m4/guestfs-libraries.m4 +@@ -19,9 +19,8 @@ dnl Any C libraries required by virt-v2v. + + dnl Of course we need libguestfs. + dnl +-dnl We need libguestfs 1.57.3 for guestfs_ntfs_chmod. +-dnl We need libguestfs 1.57.6 for guestfs_inspect_get_windows_group_policy. +-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.6]) ++dnl We need libguestfs >= 1.58.1-2.el10 for guestfs_xfs_info2. ++PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.58.1]) + printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs + + dnl And libnbd. +diff --git a/v2v/v2v_unit_tests.ml b/v2v/v2v_unit_tests.ml +index 892bf190..efbadc80 100644 +--- a/v2v/v2v_unit_tests.ml ++++ b/v2v/v2v_unit_tests.ml +@@ -38,6 +38,7 @@ let inspect_defaults = { + i_major_version = 0; i_minor_version = 0; + i_root = ""; i_package_format = ""; i_package_management = ""; + i_product_name = ""; i_product_variant = ""; i_mountpoints = []; ++ i_filesystems = []; + i_apps = []; i_apps_map = StringMap.empty; + i_windows_systemroot = ""; + i_windows_software_hive = ""; i_windows_system_hive = ""; diff --git a/0015-inspector-Enhance-virt-v2v-inspector-output-with-fil.patch b/0015-inspector-Enhance-virt-v2v-inspector-output-with-fil.patch new file mode 100644 index 0000000..947805e --- /dev/null +++ b/0015-inspector-Enhance-virt-v2v-inspector-output-with-fil.patch @@ -0,0 +1,131 @@ +From c31d266ede968301ea823b3797e20f6e792e68e5 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 26 Jan 2026 16:27:42 +0000 +Subject: [PATCH] inspector: Enhance virt-v2v-inspector output with filesystems + information + +RHEL 7.0, 7.1 and (possibly*) 7.2 used XFS version 4. New versions of +RHEL use XFS v5. + +Support even for opening version 4 filesystems was removed in RHEL 10 +(and will be removed altogether from the Linux kernel in 2030). This +prevents virt-v2v conversions. + +Therefore it's a good idea to be able to tell the XFS filesystem +version and print that in virt-inspector output, so that management +tools can warn about it. + +Since we didn't have the virt-inspector section at all +before, we have to add that whole section, sticking as close as +possible to the virt-inspector output. + +Example output for a RHEL 7.0 guest: + + + + + virt-v2v-inspector + ... + + linux + ... + + / + /boot + + + + ext4 + 15e8838c-136e-4a1f-ac01-97b4fa6b0fe4 + + + swap + 8e966377-86f1-45a1-bdff-28724530818d + + + xfs + 67ae8aeb-a9f4-4639-a201-c02b7dbb5d98 + + + + + +Example output for a RHEL 7.3 guest: + + + + + virt-v2v-inspector + ... + + linux + ... + + / + /boot + + + + ext4 + e0467228-8727-482d-bd7a-6741885fe7ed + + + swap + 9c2e6658-c600-4fbd-8731-864ff987553c + + + xfs + 9692610c-0025-4a8c-b806-8a78de2ec2eb + + + + + +To work this requires libguestfs >= 1.59.2 (with guestfs_xfs_info2). + +The version field may be missing, for non-XFS filesystems, but also if +we cannot tell the XFS version for some reason. + +* = The virt-builder rhel-7.2 image definitely uses XFS v4, but it may +have been built from an early (pre-)release of 7.2. Later RHEL 7.2 +seems to use XFS v5. + +Fixes: https://issues.redhat.com/browse/RHEL-144075 +(cherry picked from commit d6b2e643b174fff7d3442865da047bf3d3f9aac9) +--- + inspector/create_inspector_xml.ml | 22 ++++++++++++++++++++++ + 1 file changed, 22 insertions(+) + +diff --git a/inspector/create_inspector_xml.ml b/inspector/create_inspector_xml.ml +index fb434227..a531cecc 100644 +--- a/inspector/create_inspector_xml.ml ++++ b/inspector/create_inspector_xml.ml +@@ -126,6 +126,28 @@ let rec create_inspector_xml input_disks inspect target_meta = + ) inspect.i_mountpoints; + List.push_back os (e "mountpoints" [] !mps); + ++ let fses = ref [] in ++ List.iter ( ++ fun { fs_dev; fs_type; fs_version; fs_label; fs_uuid } -> ++ let fs = ref [] in ++ (match fs_type, fs_version with ++ | None, _ -> () ++ | Some typ, None -> List.push_back fs (e "type" [] [PCData typ]) ++ | Some typ, Some ver -> ++ List.push_back fs (e "type" [ "version", ver] [PCData typ]) ++ ); ++ (match fs_label with ++ | None -> () ++ | Some label -> List.push_back fs (e "label" [] [PCData label]) ++ ); ++ (match fs_uuid with ++ | None -> () ++ | Some uuid -> List.push_back fs (e "uuid" [] [PCData uuid]) ++ ); ++ List.push_back fses (e "filesystem" [ "dev", fs_dev] !fs) ++ ) inspect.i_filesystems; ++ List.push_back os (e "filesystems" [] !fses); ++ + List.push_back body (e "operatingsystem" [] !os); + + (* Construct the final document. *) diff --git a/virt-v2v.spec b/virt-v2v.spec index 2490a85..2ec0487 100644 --- a/virt-v2v.spec +++ b/virt-v2v.spec @@ -45,7 +45,7 @@ ExclusiveArch: x86_64 Name: virt-v2v Epoch: 1 Version: 2.10.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: Convert a virtual machine to run on KVM License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -77,6 +77,9 @@ Patch0009: 0009-RHEL-output-output.ml-Remove-cache-none.patch Patch0010: 0010-docs-virt-v2v.pod-Document-Windows-vTPM-and-BitLocke.patch Patch0011: 0011-input-ssh.ml-Add-debugging-around-remote_file_exists.patch Patch0012: 0012-input-ssh.ml-Fix-Ssh.remote_file_exists.patch +Patch0013: 0013-Update-common-submodule.patch +Patch0014: 0014-v2v-Enhance-inspection-with-filesystems-information.patch +Patch0015: 0015-inspector-Enhance-virt-v2v-inspector-output-with-fil.patch BuildRequires: autoconf, automake, libtool BuildRequires: make @@ -87,7 +90,7 @@ BuildRequires: perl(IPC::Run3) BuildRequires: gcc BuildRequires: ocaml >= 4.08 -BuildRequires: libguestfs-devel >= 1:1.58.0-1 +BuildRequires: libguestfs-devel >= 1:1.58.1-2 BuildRequires: augeas-devel BuildRequires: bash-completion %if 0%{?fedora} || 0%{?rhel} >= 11 @@ -133,7 +136,7 @@ BuildRequires: glibc-static BuildRequires: gnupg2 %endif -Requires: libguestfs%{?_isa} >= 1:1.58.0-1 +Requires: libguestfs%{?_isa} >= 1:1.58.1-2 Requires: guestfs-tools >= 1.54 # XFS is the default filesystem in Fedora and RHEL. @@ -381,7 +384,7 @@ done %changelog -* Tue Jan 13 2026 Richard W.M. Jones - 1:2.10.0-2 +* Mon Jan 26 2026 Richard W.M. Jones - 1:2.10.0-3 - Rebase to virt-v2v 2.10.0 resolves: RHEL-111241 - Synchronize spec file with Fedora. @@ -415,6 +418,8 @@ done resolves: RHEL-103915 - Fix regression when converting vmx+ssh with snapshots resolves: RHEL-102938 +- Expose XFS version in virt-v2v-inspector + resolves: RHEL-144075 * Thu Aug 21 2025 Richard W.M. Jones - 1:2.8.1-9 - Rebase to virt-v2v 2.8.1