From 07bc9a99c59af6467a58663e7f48de8826436c4e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 12 Jun 2025 08:46:30 +0100 Subject: [PATCH 1/2] Rebase to libguestfs 1.56.0 resolves: RHEL-81733 --- ...-Enable-ACPI-for-the-libvirt-backend.patch | 42 ++++++ ...a-output-when-external-command-fails.patch | 56 ------- ...-ACPI-feature-flag-conditional-on-x8.patch | 35 +++++ ....c-Capture-and-raise-qemu-img-stderr.patch | 67 --------- ...upported-remote-drive-protocols-RHBZ.patch | 4 +- ...-string-passed-to-printf-like-functi.patch | 31 ---- ...of-libguestfs-winsupport-features-ex.patch | 2 +- ...-Add-more-debugging-to-list_filesyst.patch | 138 ------------------ ...nit-Run-depmod-a-to-rebuild-kernel-m.patch | 2 +- ...l-Pipeline-style-when-mapping-and-fi.patch | 129 ---------------- 0006-daemon-inspect.ml-Fix-comment.patch | 33 ----- ...tion-Ignore-btrfs-snapshots-of-roots.patch | 98 ------------- libguestfs.spec | 26 ++-- sources | 4 +- 14 files changed, 93 insertions(+), 574 deletions(-) create mode 100644 0001-lib-Enable-ACPI-for-the-libvirt-backend.patch delete mode 100644 0001-lib-flatten-extra-output-when-external-command-fails.patch create mode 100644 0002-lib-Make-libvirt-ACPI-feature-flag-conditional-on-x8.patch delete mode 100644 0002-lib-create.c-Capture-and-raise-qemu-img-stderr.patch rename 0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch => 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch (99%) delete mode 100644 0003-lib-create.c-Fix-string-passed-to-printf-like-functi.patch rename 0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch => 0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch (97%) delete mode 100644 0004-daemon-listfs.ml-Add-more-debugging-to-list_filesyst.patch rename 0010-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch => 0005-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch (90%) delete mode 100644 0005-daemon-inspect.ml-Pipeline-style-when-mapping-and-fi.patch delete mode 100644 0006-daemon-inspect.ml-Fix-comment.patch delete mode 100644 0007-inspection-Ignore-btrfs-snapshots-of-roots.patch diff --git a/0001-lib-Enable-ACPI-for-the-libvirt-backend.patch b/0001-lib-Enable-ACPI-for-the-libvirt-backend.patch new file mode 100644 index 0000000..0260a6f --- /dev/null +++ b/0001-lib-Enable-ACPI-for-the-libvirt-backend.patch @@ -0,0 +1,42 @@ +From 7cf0ed750ef7119503fc72cb19c29a269a893e8e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 11 Jun 2025 22:45:51 +0100 +Subject: [PATCH] lib: Enable ACPI for the libvirt backend + +Many years ago we used to pass acpi=off on the Linux kernel command +line. In commit db1f811b2 we stopped doing that (around 2016). +However unless you also use: + + + + + +then it turns out that libvirt disables ACPI generation at the qemu +level. None of this mattered until SeaBIOS 1.17 changed its +behaviour, causing ACPI to be required for virtio devices to work. + +Updates: commit db1f811b29b055625ae1b03cf0daa9fed0d443ac +Related: https://bugzilla.redhat.com/show_bug.cgi?id=2372329 +Thanks: Gerd Hoffmann +--- + lib/launch-libvirt.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index aa9534c68..40b57f7ca 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1175,6 +1175,10 @@ construct_libvirt_xml_cpu (guestfs_h *g, + + single_element_format ("vcpu", "%d", g->smp); + ++ start_element ("features") { ++ empty_element ("acpi"); ++ } end_element (); ++ + start_element ("clock") { + attribute ("offset", "utc"); + +-- +2.47.1 + diff --git a/0001-lib-flatten-extra-output-when-external-command-fails.patch b/0001-lib-flatten-extra-output-when-external-command-fails.patch deleted file mode 100644 index fcdda8a..0000000 --- a/0001-lib-flatten-extra-output-when-external-command-fails.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 406588d4a00a42b49278669e34643a9ecfa7ecd3 Mon Sep 17 00:00:00 2001 -From: Cole Robinson -Date: Tue, 20 May 2025 13:33:26 -0400 -Subject: [PATCH] lib: flatten `extra` output when external command fails - -Otherwise string output looks quite awkward - -Signed-off-by: Cole Robinson ---- - lib/errors.c | 15 +++++++++++---- - 1 file changed, 11 insertions(+), 4 deletions(-) - -diff --git a/lib/errors.c b/lib/errors.c -index 148d8da27..c391a6d84 100644 ---- a/lib/errors.c -+++ b/lib/errors.c -@@ -536,18 +536,25 @@ guestfs_int_external_command_failed (guestfs_h *g, int status, - { - const size_t len = 80 + strlen (cmd_name); - CLEANUP_FREE char *status_string = safe_malloc (g, len); -+ CLEANUP_FREE char *extra_clean = NULL; - - guestfs_int_exit_status_to_string (status, cmd_name, status_string, len); - -+ if (extra) { -+ extra_clean = guestfs_int_replace_string(extra, "\n", " "); -+ if (!extra_clean) -+ g->abort_cb (); -+ } -+ - if (g->verbose) { -- if (!extra) -+ if (!extra_clean) - error (g, _("%s, see debug messages above"), status_string); - else - error (g, _("%s: %s: %s, see debug messages above"), -- cmd_name, extra, status_string); -+ cmd_name, extra_clean, status_string); - } - else { -- if (!extra) -+ if (!extra_clean) - error (g, _("%s.\n" - "To see full error messages you may need to enable debugging.\n" - DEBUG_ADVICE), -@@ -556,6 +563,6 @@ guestfs_int_external_command_failed (guestfs_h *g, int status, - error (g, _("%s: %s: %s.\n" - "To see full error messages you may need to enable debugging.\n" - DEBUG_ADVICE), -- cmd_name, extra, status_string); -+ cmd_name, extra_clean, status_string); - } - } --- -2.47.1 - diff --git a/0002-lib-Make-libvirt-ACPI-feature-flag-conditional-on-x8.patch b/0002-lib-Make-libvirt-ACPI-feature-flag-conditional-on-x8.patch new file mode 100644 index 0000000..7941d1f --- /dev/null +++ b/0002-lib-Make-libvirt-ACPI-feature-flag-conditional-on-x8.patch @@ -0,0 +1,35 @@ +From f6fe0611a8980694b8e4e33b9c824805d353679f Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 12 Jun 2025 08:11:56 +0100 +Subject: [PATCH] lib: Make libvirt ACPI feature flag conditional on x86 or Arm + +On ppc64 and s390x it failed with an error like: + + unsupported configuration: machine type 'pseries-10.0' does not support ACPI + +Updates: commit 7cf0ed750ef7119503fc72cb19c29a269a893e8e +Related: https://bugzilla.redhat.com/show_bug.cgi?id=2372329 +--- + lib/launch-libvirt.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c +index 40b57f7ca..55a4ad41c 100644 +--- a/lib/launch-libvirt.c ++++ b/lib/launch-libvirt.c +@@ -1175,9 +1175,12 @@ construct_libvirt_xml_cpu (guestfs_h *g, + + single_element_format ("vcpu", "%d", g->smp); + ++#if defined(__i386__) || defined(__x86_64__) || \ ++ defined(__arm__) || defined(__aarch64__) + start_element ("features") { + empty_element ("acpi"); + } end_element (); ++#endif + + start_element ("clock") { + attribute ("offset", "utc"); +-- +2.47.1 + diff --git a/0002-lib-create.c-Capture-and-raise-qemu-img-stderr.patch b/0002-lib-create.c-Capture-and-raise-qemu-img-stderr.patch deleted file mode 100644 index 320a3be..0000000 --- a/0002-lib-create.c-Capture-and-raise-qemu-img-stderr.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 606aa1d1822260905a5dd8a47f29a66652168f22 Mon Sep 17 00:00:00 2001 -From: Cole Robinson -Date: Mon, 19 May 2025 13:42:12 -0400 -Subject: [PATCH] lib/create.c: Capture and raise qemu-img stderr - -https://issues.redhat.com/browse/RHEL-92239 - -After this, output looks like - - $ ./run guestfish --ro --format=qcow2 -a test.img - libguestfs: error: qemu-img: qemu-img: /home/crobinso/src/libguestfs/tmp/libguestfsFlxnb0/overlay1.qcow2: Image is not in qcow2 format Could not open backing image. : qemu-img exited with error status 1. - To see full error messages you may need to enable debugging. - ... - -Signed-off-by: Cole Robinson ---- - lib/create.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/lib/create.c b/lib/create.c -index b660d11e5..72b4632c8 100644 ---- a/lib/create.c -+++ b/lib/create.c -@@ -241,6 +241,14 @@ is_power_of_2 (unsigned v) - return v && ((v & (v - 1)) == 0); - } - -+static void -+read_all (guestfs_h *g, void *retv, const char *buf, size_t len) -+{ -+ char **ret = retv; -+ -+ *ret = safe_strndup (g, buf, len); -+} -+ - /** - * Check for valid backing format. Allow any C<^[[:alnum]]+$> - * (in C locale), but limit the length to something reasonable. -@@ -256,6 +264,7 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size, - { - const char *backingformat = NULL; - CLEANUP_FREE char *backingformat_free = NULL; -+ CLEANUP_FREE char *cmd_stdout = NULL; - const char *preallocation = NULL; - const char *compat = NULL; - int clustersize = -1; -@@ -351,10 +360,16 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size, - if (size >= 0) - guestfs_int_cmd_add_arg_format (cmd, "%" PRIi64, size); - -+ guestfs_int_cmd_clear_capture_errors (cmd); -+ guestfs_int_cmd_set_stderr_to_stdout (cmd); -+ guestfs_int_cmd_set_stdout_callback (cmd, read_all, &cmd_stdout, -+ CMD_STDOUT_FLAG_WHOLE_BUFFER); - r = guestfs_int_cmd_run (cmd); - if (!WIFEXITED (r) || WEXITSTATUS (r) != 0) { -- guestfs_int_external_command_failed (g, r, "qemu-img", filename); -+ guestfs_int_external_command_failed (g, r, "qemu-img", cmd_stdout); - return -1; -+ } else { -+ debug (g, cmd_stdout); - } - - return 0; --- -2.47.1 - diff --git a/0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch b/0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch similarity index 99% rename from 0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch rename to 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch index 7a9e54c..eedb54f 100644 --- a/0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +++ b/0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch @@ -1,4 +1,4 @@ -From 891abf8771e740a55c73bd6a8c33560ae33424ba Mon Sep 17 00:00:00 2001 +From 3adbeb6b3fce8edd2af43e77a876c58a3ea1a424 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 29 Jul 2013 14:47:56 +0100 Subject: [PATCH] RHEL: Disable unsupported remote drive protocols @@ -394,7 +394,7 @@ index c068b8ecb..6e4453ce5 100644 error (g, _("unknown protocol ā€˜%s’"), protocol); drv = NULL; /*FALLTHROUGH*/ diff --git a/lib/guestfs.pod b/lib/guestfs.pod -index d2c90418e..85d765aa8 100644 +index f69d5a070..e54d98d35 100644 --- a/lib/guestfs.pod +++ b/lib/guestfs.pod @@ -723,51 +723,6 @@ a qcow2 backing file specification, libvirt does not construct an diff --git a/0003-lib-create.c-Fix-string-passed-to-printf-like-functi.patch b/0003-lib-create.c-Fix-string-passed-to-printf-like-functi.patch deleted file mode 100644 index e4493d1..0000000 --- a/0003-lib-create.c-Fix-string-passed-to-printf-like-functi.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 833e5e63b3d03c9500727e167f5d7287dfeafbd2 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 May 2025 09:48:14 +0100 -Subject: [PATCH] lib/create.c: Fix string passed to printf-like function - - create.c: In function 'disk_create_qcow2': - create.c:372:5: error: format not a string literal and no format arguments [-Werror=format-security] - 372 | debug (g, cmd_stdout); - | ^~~~~ - -Fixes: commit 606aa1d1822260905a5dd8a47f29a66652168f22 ---- - lib/create.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/lib/create.c b/lib/create.c -index 72b4632c8..67631132f 100644 ---- a/lib/create.c -+++ b/lib/create.c -@@ -369,7 +369,7 @@ disk_create_qcow2 (guestfs_h *g, const char *filename, int64_t size, - guestfs_int_external_command_failed (g, r, "qemu-img", cmd_stdout); - return -1; - } else { -- debug (g, cmd_stdout); -+ debug (g, "%s", cmd_stdout); - } - - return 0; --- -2.47.1 - diff --git a/0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch b/0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch similarity index 97% rename from 0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch rename to 0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch index 3d7158a..2bbbdba 100644 --- a/0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +++ b/0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch @@ -1,4 +1,4 @@ -From 0e8418540d94edada4356e9a7e8ec8d0508211ae Mon Sep 17 00:00:00 2001 +From 61a520e98fc12fd642230a276e9478c8d75f8bec Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 7 Jul 2015 09:28:03 -0400 Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for diff --git a/0004-daemon-listfs.ml-Add-more-debugging-to-list_filesyst.patch b/0004-daemon-listfs.ml-Add-more-debugging-to-list_filesyst.patch deleted file mode 100644 index 0b0b796..0000000 --- a/0004-daemon-listfs.ml-Add-more-debugging-to-list_filesyst.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 7ac190ed20e7a2f8e664a4994e5508f050ed12e8 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 May 2025 10:03:32 +0100 -Subject: [PATCH] daemon/listfs.ml: Add more debugging to list_filesystems - -This function is used from other parts of the daemon, especially for -example with inspection. However it was difficult to follow exactly -what filesystems it was returning because of insufficient debugging -information. ---- - daemon/listfs.ml | 49 ++++++++++++++++++++++++++++++++++++++++-------- - 1 file changed, 41 insertions(+), 8 deletions(-) - -diff --git a/daemon/listfs.ml b/daemon/listfs.ml -index 0139e927d..4c90796ef 100644 ---- a/daemon/listfs.ml -+++ b/daemon/listfs.ml -@@ -25,12 +25,17 @@ open Std_utils - * contain filesystems, so we filter them out. - *) - let rec list_filesystems () = -+ if verbose () then -+ eprintf "list_filesystems: start\n"; -+ - let has_lvm2 = Optgroups.lvm2_available () in - let has_ldm = Optgroups.ldm_available () in - -- let ret = ref [] in -+ let ret : (Mountable.t * string) list ref = ref [] in - - (* Devices. *) -+ if verbose () then -+ eprintf "list_filesystems: checking for whole devices\n"; - let devices = Devsparts.list_devices () in - let devices = List.filter is_not_partitioned_device devices in - List.iter (check_with_vfs_type ret) devices; -@@ -39,32 +44,44 @@ let rec list_filesystems () = - * We include these in case any encrypted devices contain - * direct filesystems. - *) -+ if verbose () then -+ eprintf "list_filesystems: checking for device-mapper devices\n"; - let devices = Lvm_dm.list_dm_devices () in - let devices = List.filter is_not_partitioned_device devices in - List.iter (check_with_vfs_type ret) devices; - - (* Partitions. *) -+ if verbose () then -+ eprintf "list_filesystems: checking for partitions\n"; - let partitions = Devsparts.list_partitions () in - let partitions = List.filter is_partition_can_hold_filesystem partitions in - List.iter (check_with_vfs_type ret) partitions; - - (* MD. *) -+ if verbose () then -+ eprintf "list_filesystems: checking for MD devices\n"; - let mds = Md.list_md_devices () in - let mds = List.filter is_not_partitioned_device mds in - List.iter (check_with_vfs_type ret) mds; - - (* LVM. *) - if has_lvm2 then ( -+ if verbose () then -+ eprintf "list_filesystems: checking for logical volumes\n"; - let lvs = Lvm.lvs () in - List.iter (check_with_vfs_type ret) lvs - ); - - (* LDM. *) - if has_ldm then ( -+ if verbose () then -+ eprintf "list_filesystems: checking for LDM volumes\n"; - let ldmvols = Ldm.list_ldm_volumes () in - List.iter (check_with_vfs_type ret) ldmvols - ); - -+ if verbose () then -+ eprintf "list_filesystems: finished\n%!"; - !ret - - (* Look to see if device can directly contain filesystem (RHBZ#590167). -@@ -146,12 +163,15 @@ and check_with_vfs_type ret device = - try Blkid.vfs_type mountable - with exn -> - if verbose () then -- eprintf "check_with_vfs_type: %s: %s\n" -+ eprintf "list_filesystems: check_with_vfs_type: %s: %s\n" - device (Printexc.to_string exn); - "" in - -- if vfs_type = "" then -- List.push_back ret (mountable, "unknown") -+ if vfs_type = "" then ( -+ let fs = mountable, "unknown" in -+ debug_one_fs fs; -+ List.push_back ret fs -+ ) - - (* Ignore all "*_member" strings. In libblkid these are returned - * for things which are members of some RAID or LVM set, most -@@ -179,17 +199,30 @@ and check_with_vfs_type ret device = - ) vols in - - (* whole device = default volume *) -- List.push_back ret (mountable, vfs_type); -+ let fs = mountable, vfs_type in -+ debug_one_fs fs; -+ List.push_back ret fs; - - (* subvolumes *) - List.push_back_list ret ( - List.map ( - fun { Structs.btrfssubvolume_path = path } -> - let mountable = Mountable.of_btrfsvol device path in -- (mountable, "btrfs") -+ let fs = mountable, "btrfs" in -+ debug_one_fs fs; -+ fs - ) vols - ) - ) - -- else -- List.push_back ret (mountable, vfs_type) -+ (* Otherwise it's some other VFS type. *) -+ else ( -+ let fs = mountable, vfs_type in -+ debug_one_fs fs; -+ List.push_back ret fs -+ ) -+ -+and debug_one_fs (mountable, vfs_type) = -+ if verbose () then -+ eprintf "list_filesystems: adding %S, %S\n" -+ (Mountable.to_string mountable) vfs_type --- -2.47.1 - diff --git a/0010-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch b/0005-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch similarity index 90% rename from 0010-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch rename to 0005-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch index a692d46..1185e0a 100644 --- a/0010-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch +++ b/0005-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch @@ -1,4 +1,4 @@ -From 0bdd0f7b652560f7ff82feb730324adf0c4cccfd Mon Sep 17 00:00:00 2001 +From eab15d4fba9c82d1910d70bd58b080ccbd398923 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 13 May 2025 17:28:25 +0100 Subject: [PATCH] RHEL: appliance/init: Run depmod -a to rebuild kernel module diff --git a/0005-daemon-inspect.ml-Pipeline-style-when-mapping-and-fi.patch b/0005-daemon-inspect.ml-Pipeline-style-when-mapping-and-fi.patch deleted file mode 100644 index c9864ca..0000000 --- a/0005-daemon-inspect.ml-Pipeline-style-when-mapping-and-fi.patch +++ /dev/null @@ -1,129 +0,0 @@ -From b2ec671abd026fbe9fff94d48f51282df555b71d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sun, 25 May 2025 09:29:18 +0100 -Subject: [PATCH] daemon/inspect.ml: Pipeline style when mapping and filtering - filesystems - -No actual change in the functionality, just make it clear that this is -a pipeline of transformations on the list of filesystems. ---- - daemon/inspect.ml | 69 +++++++++++++++++++++++++++++------------------ - 1 file changed, 43 insertions(+), 26 deletions(-) - -diff --git a/daemon/inspect.ml b/daemon/inspect.ml -index 2c027b7c5..03174ef23 100644 ---- a/daemon/inspect.ml -+++ b/daemon/inspect.ml -@@ -29,40 +29,43 @@ let re_primary_partition = PCRE.compile "^/dev/(?:h|s|v)d.[1234]$" - let rec inspect_os () = - Mount_utils.umount_all (); - -- (* Iterate over all detected filesystems. Inspect each one in turn. *) -- let fses = Listfs.list_filesystems () in -+ (* Start with the full list of filesystems, and inspect each one -+ * in turn to determine its possible role (root, /usr, homedir, etc.) -+ * Then we filter out duplicates and merge some filesystems into -+ * others. -+ *) - - let fses = -+ Listfs.list_filesystems () |> -+ -+ (* Filter out those filesystems which are mountable, and inspect -+ * each one to find its possible role. Converts the list to -+ * type: {!Inspect_types.fs} list. -+ *) - List.filter_map ( - fun (mountable, vfs_type) -> - Inspect_fs.check_for_filesystem_on mountable vfs_type -- ) fses in -- if verbose () then ( -- eprintf "inspect_os: fses:\n"; -- List.iter (fun fs -> eprintf "%s" (string_of_fs fs)) fses; -- flush stderr -- ); -+ ) |> - -- (* The OS inspection information for CoreOS are gathered by inspecting -- * multiple filesystems. Gather all the inspected information in the -- * inspect_fs struct of the root filesystem. -- *) -- eprintf "inspect_os: collect_coreos_inspection_info\n%!"; -- let fses = collect_coreos_inspection_info fses in -+ debug_list_of_filesystems |> - -- (* Check if the same filesystem was listed twice as root in fses. -- * This may happen for the *BSD root partition where an MBR partition -- * is a shadow of the real root partition probably /dev/sda5 -- *) -- eprintf "inspect_os: check_for_duplicated_bsd_root\n%!"; -- let fses = check_for_duplicated_bsd_root fses in -+ (* The OS inspection information for CoreOS are gathered by inspecting -+ * multiple filesystems. Gather all the inspected information in the -+ * inspect_fs struct of the root filesystem. -+ *) -+ collect_coreos_inspection_info |> - -- (* For Linux guests with a separate /usr filesystem, merge some of the -- * inspected information in that partition to the inspect_fs struct -- * of the root filesystem. -- *) -- eprintf "inspect_os: collect_linux_inspection_info\n%!"; -- let fses = collect_linux_inspection_info fses in -+ (* Check if the same filesystem was listed twice as root in fses. -+ * This may happen for the *BSD root partition where an MBR partition -+ * is a shadow of the real root partition probably /dev/sda5 -+ *) -+ check_for_duplicated_bsd_root |> -+ -+ (* For Linux guests with a separate /usr filesystem, merge some of the -+ * inspected information in that partition to the inspect_fs struct -+ * of the root filesystem. -+ *) -+ collect_linux_inspection_info in - - (* Save what we found in a global variable. *) - Inspect_types.inspect_fses := fses; -@@ -75,11 +78,21 @@ let rec inspect_os () = - *) - inspect_get_roots () - -+and debug_list_of_filesystems fses = -+ if verbose () then ( -+ eprintf "inspect_os: fses:\n"; -+ List.iter (fun fs -> eprintf "%s" (string_of_fs fs)) fses; -+ flush stderr -+ ); -+ fses -+ - (* Traverse through the filesystem list and find out if it contains - * the [/] and [/usr] filesystems of a CoreOS image. If this is the - * case, sum up all the collected information on the root fs. - *) - and collect_coreos_inspection_info fses = -+ eprintf "inspect_os: collect_coreos_inspection_info\n%!"; -+ - (* Split the list into CoreOS root(s), CoreOS usr(s), and - * everything else. - *) -@@ -137,6 +150,8 @@ and collect_coreos_inspection_info fses = - * [http://www.freebsd.org/doc/handbook/disk-organization.html]) - *) - and check_for_duplicated_bsd_root fses = -+ eprintf "inspect_os: check_for_duplicated_bsd_root\n%!"; -+ - try - let is_primary_partition = function - | { m_type = (MountablePath | MountableBtrfsVol _) } -> false -@@ -183,6 +198,8 @@ and check_for_duplicated_bsd_root fses = - * root fs from the respective [/usr] filesystems. - *) - and collect_linux_inspection_info fses = -+ eprintf "inspect_os: collect_linux_inspection_info\n%!"; -+ - List.map ( - function - | { role = RoleRoot { distro = Some DISTRO_COREOS } } as root -> root --- -2.47.1 - diff --git a/0006-daemon-inspect.ml-Fix-comment.patch b/0006-daemon-inspect.ml-Fix-comment.patch deleted file mode 100644 index bd6d777..0000000 --- a/0006-daemon-inspect.ml-Fix-comment.patch +++ /dev/null @@ -1,33 +0,0 @@ -From ebaba4322191ae65e5cd49f274291e63f8f46bef Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sun, 25 May 2025 09:43:43 +0100 -Subject: [PATCH] daemon/inspect.ml: Fix comment - -Back in commit 8289aa1ad6 ("New APIs for guest inspection.", 2010) -when inspection was first added, we did inspection in the library, so -it was accurate to say that inspection information was stored "in the -handle". Much later, in commit 394d11be49 and commit 3a00c4d179 -(2017) we moved inspection to the daemon, but left the comment the -same. - -Fixes: commit 3a00c4d179554f8c1299368a02b43370b6aa7af3 ---- - daemon/inspect.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/daemon/inspect.ml b/daemon/inspect.ml -index 03174ef23..5c6be3193 100644 ---- a/daemon/inspect.ml -+++ b/daemon/inspect.ml -@@ -70,7 +70,7 @@ let rec inspect_os () = - (* Save what we found in a global variable. *) - Inspect_types.inspect_fses := fses; - -- (* At this point we have, in the handle, a list of all filesystems -+ (* At this point we have (in a global variable) a list of all filesystems - * found and data about each one. Now we assemble the list of - * filesystems which are root devices. - * --- -2.47.1 - diff --git a/0007-inspection-Ignore-btrfs-snapshots-of-roots.patch b/0007-inspection-Ignore-btrfs-snapshots-of-roots.patch deleted file mode 100644 index 7399be1..0000000 --- a/0007-inspection-Ignore-btrfs-snapshots-of-roots.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 8f5e4f07ba92d42506072520260d96ce77d58e21 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 22 May 2025 11:32:11 +0100 -Subject: [PATCH] inspection: Ignore btrfs snapshots of roots - -In SLES guests in particular, btrfs snapshots seem to be used to allow -rollback of changes made to the filesystem. Dozens of snapshots may -be present. Technically therefore these are multi-boot guests. The -libguestfs concept of "root" of an operating system does not map well -to this, causing problems in virt-inspector and virt-v2v. - -In this commit we ignore these duplicates. The test is quite narrow -to avoid false positives: We only remove a duplicate if it is a member -of a parent device, both are btrfs, both the snapshot and parent have -a root role, and the roles are otherwise very similar. - -There may be a case for reporting this information separately in -future, although it's also easy to find this out now. For example, -when you see a btrfs root device returned by inspect_os, you could -call btrfs_subvolume_list on the root device to list the snapshots. - -Fixes: https://issues.redhat.com/browse/RHEL-93109 ---- - daemon/inspect.ml | 51 +++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 51 insertions(+) - -diff --git a/daemon/inspect.ml b/daemon/inspect.ml -index 5c6be3193..84571f582 100644 ---- a/daemon/inspect.ml -+++ b/daemon/inspect.ml -@@ -61,6 +61,11 @@ let rec inspect_os () = - *) - check_for_duplicated_bsd_root |> - -+ (* Check if the root filesystems are duplicated by btrfs snapshots. -+ * This happens especially for SLES guests. -+ *) -+ check_for_duplicated_btrfs_snapshots_of_root |> -+ - (* For Linux guests with a separate /usr filesystem, merge some of the - * inspected information in that partition to the inspect_fs struct - * of the root filesystem. -@@ -190,6 +195,52 @@ and check_for_duplicated_bsd_root fses = - with - Not_found -> fses - -+(* Check for the case where the root filesystem gets duplicated by -+ * btrfs snapshots. Ignore the snapshots in this case (RHEL-93109). -+ *) -+and check_for_duplicated_btrfs_snapshots_of_root fses = -+ eprintf "inspect_os: check_for_duplicated_btrfs_snapshots_of_root\n%!"; -+ -+ let fs_is_btrfs_snapshot_of_root = function -+ (* Is this filesystem a btrfs snapshot of root? *) -+ | { fs_location = -+ { mountable = { m_type = MountableBtrfsVol _; m_device = dev1 }; -+ vfs_type = "btrfs" }; -+ role = RoleRoot inspection_data1 } as fs1 -> -+ (* Return true if it duplicates the parent device which has -+ * a root role. -+ *) -+ List.exists (function -+ | { fs_location = -+ { mountable = { m_type = MountableDevice; m_device = dev2 }; -+ vfs_type = "btrfs" }; -+ role = RoleRoot inspection_data2 } -+ when dev1 = dev2 -> -+ (* Check the roles are similar enough. In my test I saw -+ * that /etc/fstab was slightly different in the parent -+ * and snapshot. It's possible this is because the snapshot -+ * was created during installation, but it's not clear. -+ *) -+ let similar = -+ inspection_data1.os_type = inspection_data2.os_type && -+ inspection_data1.distro = inspection_data2.distro && -+ inspection_data1.product_name = inspection_data2.product_name && -+ inspection_data1.version = inspection_data2.version in -+ if verbose () && similar then -+ eprintf "check_for_duplicated_btrfs_snapshots_of_root: \ -+ dropping duplicate btrfs snapshot:\n%s\n" -+ (string_of_fs fs1); -+ similar -+ | _ -> false -+ ) fses -+ -+ (* Anything else is not a snapshot. *) -+ | _ -> false -+ in -+ -+ (* Filter out the duplicates. *) -+ List.filter (Fun.negate fs_is_btrfs_snapshot_of_root) fses -+ - (* Traverse through the filesystem list and find out if it contains - * the [/] and [/usr] filesystems of a Linux image (but not CoreOS, - * for which there is a separate [collect_coreos_inspection_info]). --- -2.47.1 - diff --git a/libguestfs.spec b/libguestfs.spec index 883b2e3..a92319c 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -30,7 +30,7 @@ ExcludeArch: %{ix86} %global verify_tarball_signature 1 # The source directory. -%global source_directory 1.55-development +%global source_directory 1.56-stable # Filter perl provides. %{?perl_default_filter} @@ -41,8 +41,8 @@ ExcludeArch: %{ix86} Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 -Version: 1.55.13 -Release: 2%{?dist} +Version: 1.56.0 +Release: 1%{?dist} License: LGPL-2.1-or-later # Build only for architectures that have a kernel @@ -80,16 +80,11 @@ Source8: copy-patches.sh # https://github.com/libguestfs/libguestfs/commits/rhel-10.1 # Patches. -Patch0001: 0001-lib-flatten-extra-output-when-external-command-fails.patch -Patch0002: 0002-lib-create.c-Capture-and-raise-qemu-img-stderr.patch -Patch0003: 0003-lib-create.c-Fix-string-passed-to-printf-like-functi.patch -Patch0004: 0004-daemon-listfs.ml-Add-more-debugging-to-list_filesyst.patch -Patch0005: 0005-daemon-inspect.ml-Pipeline-style-when-mapping-and-fi.patch -Patch0006: 0006-daemon-inspect.ml-Fix-comment.patch -Patch0007: 0007-inspection-Ignore-btrfs-snapshots-of-roots.patch -Patch0008: 0008-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch -Patch0009: 0009-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch -Patch0010: 0010-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch +Patch0001: 0001-lib-Enable-ACPI-for-the-libvirt-backend.patch +Patch0002: 0002-lib-Make-libvirt-ACPI-feature-flag-conditional-on-x8.patch +Patch0003: 0003-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch +Patch0004: 0004-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch +Patch0005: 0005-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch BuildRequires: autoconf, automake, libtool, gettext-devel @@ -121,7 +116,6 @@ BuildRequires: gperf BuildRequires: rpm-devel BuildRequires: cpio BuildRequires: libconfig-devel -BuildRequires: xz-devel %if !0%{?rhel} BuildRequires: zip BuildRequires: unzip @@ -1077,8 +1071,8 @@ rm ocaml/html/.gitignore %changelog -* Tue May 27 2025 Richard W.M. Jones - 1:1.55.13-2 -- Rebase to libguestfs 1.55.12 +* Thu Jun 12 2025 Richard W.M. Jones - 1:1.56.0-1 +- Rebase to libguestfs 1.56.0 resolves: RHEL-81733 - Include host kernel information in libguestfs debugging output resolves: RHEL-83026 diff --git a/sources b/sources index e17c099..283bfab 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (libguestfs-1.55.13.tar.gz) = 7f66969e3217426ecf9155777f1b07512db289e0661c2736837c6ea25c9fb6db26854d9e0e1d1306007b8a70b6ccd96de55869db370c356106760437457eb422 -SHA512 (libguestfs-1.55.13.tar.gz.sig) = 8b7dd0daf6ca026d1d0796a2c4102248298e54ea841f2a6ca3b6f1eb314b7160732261e9d25f6c3be08090878a3c76ec24c9954be0517b477a98fac2a7fc3daf +SHA512 (libguestfs-1.56.0.tar.gz) = 2aae2a4222680000ff06954adf074825e2f6ef182694d84b3e0f39ba4b2e942b3a214f438f937341fd5c72be67620d97330639739720cde6312502fc81d868ae +SHA512 (libguestfs-1.56.0.tar.gz.sig) = 481ec244a787ea19343ee4b7e6820d5273b483a0c1e29b934a7608e9efefae9562db5fd6d33d6bf76997de4eeeff966e6d33a3873ecaee8432150b5a9d86d8f3 From 9bfa66360295dd5a42d20816f333b0ee09335f06 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 12 Jun 2025 11:29:19 +0100 Subject: [PATCH 2/2] Bump release for no real reason resolves: RHEL-81733 --- libguestfs.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libguestfs.spec b/libguestfs.spec index a92319c..67a95fe 100644 --- a/libguestfs.spec +++ b/libguestfs.spec @@ -42,7 +42,7 @@ Summary: Access and modify virtual machine disk images Name: libguestfs Epoch: 1 Version: 1.56.0 -Release: 1%{?dist} +Release: 1%{?dist}.1 License: LGPL-2.1-or-later # Build only for architectures that have a kernel @@ -1071,7 +1071,7 @@ rm ocaml/html/.gitignore %changelog -* Thu Jun 12 2025 Richard W.M. Jones - 1:1.56.0-1 +* Thu Jun 12 2025 Richard W.M. Jones - 1:1.56.0-1.el10.1 - Rebase to libguestfs 1.56.0 resolves: RHEL-81733 - Include host kernel information in libguestfs debugging output