Enable building for ppc64le

This commit is contained in:
Eduard Abdullin 2026-05-06 07:51:30 +00:00 committed by root
commit dbe3130b9c
3 changed files with 209 additions and 2 deletions

View File

@ -0,0 +1,87 @@
From 8613ec938e6670bf2043eed7634a502e59e261a7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 Apr 2026 08:06:50 +0100
Subject: [PATCH] daemon/listfs.ml: Refactor is_partition_can_hold_filesystem
Refactor and simplify the function.
This is just code motion, there is no functional change.
(cherry picked from commit 88bd07f350407619d4f5fe406c5594b50cf541dd)
---
daemon/listfs.ml | 53 ++++++++++++++++++++----------------------------
1 file changed, 22 insertions(+), 31 deletions(-)
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
index 4c90796ef..067314c47 100644
--- a/daemon/listfs.ml
+++ b/daemon/listfs.ml
@@ -115,43 +115,34 @@ and is_not_partitioned_device device =
* Windows Snapshot Partition as well as MBR extended partitions.
*)
and is_partition_can_hold_filesystem partition =
- let device = Devsparts.part_to_dev partition in
- let partnum = Devsparts.part_to_partnum partition in
- let parttype = Parted.part_get_parttype device in
+ let device = Devsparts.part_to_dev partition
+ and partnum = Devsparts.part_to_partnum partition in
- let is_gpt = parttype = "gpt" in
- let is_mbr = parttype = "msdos" in
- let is_gpt_or_mbr = is_gpt || is_mbr in
+ match Parted.part_get_parttype device with
+ | "msdos" ->
+ if Parted.part_get_mbr_part_type device partnum = "extended" then
+ false
+ else if partnum = 1 && Utils.has_bogus_mbr device then
+ true
+ else
+ true
- if is_gpt_or_mbr then (
- if is_mbr_extended parttype device partnum then
- false
- else if is_mbr_bogus parttype device partnum then
- true
- else if is_mbr then
- true
- else (
- let gpt_type = Sfdisk.part_get_gpt_type device partnum in
- match gpt_type with
+ | "gpt" ->
+ let gpt_type = Sfdisk.part_get_gpt_type device partnum in
+ (match gpt_type with
(* Windows Logical Disk Manager metadata partition. *)
| "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3"
- (* Windows Logical Disk Manager data partition. *)
- | "AF9B60A0-1431-4F62-BC68-3311714A69AD"
- (* Microsoft Reserved Partition. *)
- | "E3C9E316-0B5C-4DB8-817D-F92DF00215AE"
- (* Windows Snapshot Partition. *)
- | "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false
+ (* Windows Logical Disk Manager data partition. *)
+ | "AF9B60A0-1431-4F62-BC68-3311714A69AD"
+ (* Microsoft Reserved Partition. *)
+ | "E3C9E316-0B5C-4DB8-817D-F92DF00215AE"
+ (* Windows Snapshot Partition. *)
+ | "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false
| _ -> true
- )
- )
- else true
+ )
-and is_mbr_extended parttype device partnum =
- parttype = "msdos" &&
- Parted.part_get_mbr_part_type device partnum = "extended"
-
-and is_mbr_bogus parttype device partnum =
- parttype = "msdos" && partnum = 1 && Utils.has_bogus_mbr device
+ | _ -> (* unknown or other *)
+ true
(* Use vfs-type to check for a filesystem of some sort of [device].
* Appends (device, vfs_type) to the ret parameter (there may be
--
2.47.3

View File

@ -0,0 +1,114 @@
From 7349b7c5aa58b937394f5a44844238ff38e2f80d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 Apr 2026 08:34:38 +0100
Subject: [PATCH] daemon/listfs.ml: Ignore CHS geometry error from parted
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
parted has an annoying bug where it fails to parse Sun partition
tables (still used by Veritas). It tries to check the CHS geometry
stored in the header matches the physical CHS geometry, which is a
meaningless test.
In function is_partition_can_hold_filesystem we are only interested in
MBR and GPT partition types, so catch and ignore this specific parted
error.
I tested this by adding a Sun disk as a second disk to a Fedora
guest and doing inspection. Previously the operation would
fail:
$ guestfish --ro -a /var/tmp/fedora-41.img -a /var/tmp/dump.img -i
libguestfs: error: inspect_os: parted exited with status 1: Warning:
The disk CHS geometry (205603,255,2) reported by the operating
system does not match the geometry stored on the disk label
(64887,16,101).
After this change it succeeds:
$ guestfish --ro -a /var/tmp/fedora-41.img -a /var/tmp/dump.img -i
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.
Type: help for help on commands
man to read the manual
quit to quit the shell
Operating system: Fedora Linux 41 (Forty One)
/dev/sda3 mounted on /
/dev/sda2 mounted on /boot
Fixes: https://redhat.atlassian.net/browse/RHEL-165220
(cherry picked from commit 8d83bf2bcf31c5206b6deaa5e993009a85ff174f)
---
daemon/listfs.ml | 44 ++++++++++++++++++++++++++++----------------
1 file changed, 28 insertions(+), 16 deletions(-)
diff --git a/daemon/listfs.ml b/daemon/listfs.ml
index 067314c47..8ca5ca8a8 100644
--- a/daemon/listfs.ml
+++ b/daemon/listfs.ml
@@ -118,30 +118,42 @@ and is_partition_can_hold_filesystem partition =
let device = Devsparts.part_to_dev partition
and partnum = Devsparts.part_to_partnum partition in
- match Parted.part_get_parttype device with
- | "msdos" ->
- if Parted.part_get_mbr_part_type device partnum = "extended" then
- false
- else if partnum = 1 && Utils.has_bogus_mbr device then
- true
- else
- true
+ try
+ match Parted.part_get_parttype device with
+ | "msdos" ->
+ if Parted.part_get_mbr_part_type device partnum = "extended" then
+ false
+ else if partnum = 1 && Utils.has_bogus_mbr device then
+ true
+ else
+ true
- | "gpt" ->
- let gpt_type = Sfdisk.part_get_gpt_type device partnum in
- (match gpt_type with
- (* Windows Logical Disk Manager metadata partition. *)
- | "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3"
+ | "gpt" ->
+ let gpt_type = Sfdisk.part_get_gpt_type device partnum in
+ (match gpt_type with
+ (* Windows Logical Disk Manager metadata partition. *)
+ | "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3"
(* Windows Logical Disk Manager data partition. *)
| "AF9B60A0-1431-4F62-BC68-3311714A69AD"
(* Microsoft Reserved Partition. *)
| "E3C9E316-0B5C-4DB8-817D-F92DF00215AE"
(* Windows Snapshot Partition. *)
| "CADDEBF1-4400-4DE8-B103-12117DCF3CCF" -> false
- | _ -> true
- )
+ | _ -> true
+ )
- | _ -> (* unknown or other *)
+ | _ -> (* unknown or other *)
+ true
+
+ with
+ | Failure msg when String.find msg "CHS geometry" >= 0 ->
+ (* Parted has poor handling of "sun" partition types, always
+ * issuing a warning because the CHS doesn't match the physical
+ * geometry. Ignore this as we don't care about it in this
+ * function (RHEL-165220).
+ *)
+ eprintf "is_partition_can_hold_filesystem: \
+ ignoring warning from parted: %s\n%!" msg;
true
(* Use vfs-type to check for a filesystem of some sort of [device].
--
2.47.3

View File

@ -42,7 +42,7 @@ Summary: Access and modify virtual machine disk images
Name: libguestfs
Epoch: 1
Version: 1.56.1
Release: 4%{?dist}.alma.1
Release: 6%{?dist}.alma.1
License: LGPL-2.1-or-later
# Build only for architectures that have a kernel
@ -102,6 +102,8 @@ Patch0017: 0017-RHEL-Disable-unsupported-remote-drive-protocols-RHBZ.patch
Patch0018: 0018-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0019: 0019-RHEL-appliance-init-Run-depmod-a-to-rebuild-kernel-m.patch
Patch0020: 0020-daemon-device-name-translation.c-Fix-btrfs-volume-re.patch
Patch0021: 0021-daemon-listfs.ml-Refactor-is_partition_can_hold_file.patch
Patch0022: 0022-daemon-listfs.ml-Ignore-CHS-geometry-error-from-part.patch
BuildRequires: autoconf, automake, libtool, gettext-devel
@ -1088,9 +1090,13 @@ rm ocaml/html/.gitignore
%changelog
* Wed Apr 08 2026 Eduard Abdullin <eabdullin@almalinux.org> - 1:1.56.1-4.alma.1
* Wed May 06 2026 Eduard Abdullin <eabdullin@almalinux.org> - 1:1.56.1-6.alma.1
- Enable building for ppc64le
* Fri Apr 17 2026 Richard W.M. Jones <rjones@redhat.com> - 1:1.56.1-6
- Fix CHS geometry error for Veritas/Sun partitions
resolves: RHEL-169224
* Mon Mar 09 2026 Richard W.M. Jones <rjones@redhat.com> - 1:1.56.1-4
- Fix btrfs volume reverse translation
resolves: RHEL-149119