SHA256
3
0
forked from pool/libguestfs

Accepting request 1284945 from Virtualization

Update libguestfs to version 1.56.0. Fix bsc#1216986 for reproducible builds.

OBS-URL: https://build.opensuse.org/request/show/1284945
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libguestfs?expand=0&rev=123
This commit is contained in:
2025-06-12 13:53:01 +00:00
committed by Git OBS Bridge
10 changed files with 101 additions and 370 deletions

View File

@@ -1,132 +0,0 @@
Subject: daemon/listfs.ml: Add more debugging to list_filesystems
From: Richard W.M. Jones rjones@redhat.com Thu May 22 10:03:32 2025 +0100
Date: Tue May 27 17:01:09 2025 +0100:
Git: 7ac190ed20e7a2f8e664a4994e5508f050ed12e8
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.
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

View File

@@ -1,122 +0,0 @@
Subject: daemon/inspect.ml: Pipeline style when mapping and filtering filesystems
From: Richard W.M. Jones rjones@redhat.com Sun May 25 09:29:18 2025 +0100
Date: Tue May 27 17:01:09 2025 +0100:
Git: b2ec671abd026fbe9fff94d48f51282df555b71d
No actual change in the functionality, just make it clear that this is
a pipeline of transformations on the list of filesystems.
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

View File

@@ -1,92 +0,0 @@
Subject: inspection: Ignore btrfs snapshots of roots
From: Richard W.M. Jones rjones@redhat.com Thu May 22 11:32:11 2025 +0100
Date: Tue May 27 17:01:09 2025 +0100:
Git: 8f5e4f07ba92d42506072520260d96ce77d58e21
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
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]).

BIN
libguestfs-1.55.13.tar.gz (Stored with Git LFS)

Binary file not shown.

View File

@@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmgsiZ0RHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKBMow//fxYy17IcDZP5KH/WOyADQQaDc0VKydWW
kdl9GtVsAzYNbd3y27oPibizpRHGlm5P8Kjg3zxQgP4MuePCqMqfKcLZenh3PFWo
yqv1OJaC92HDZBq0sSSzrZGPwaLYlNoslfR1+7A1YC3AOlh48oMLUz7dm/yC9SDd
CMYJNLFa/K6T1omUiY0dtenuBwjO2xUtTQqCMsrscdpYDihJDQh496J//uT3BeJx
ljFqRXFnTStehdUue/rLGCdP7WudLQSZu0NpIRLMvZupN/uJyAgZuyW0GWc8sCJo
YRcXSLnHQmn62KdzQlhID+OHksvwjOPlye/fp6huxqwbo9NXrPbvwRoklbYpVwKr
kUvuIb/GvTxDW0lHRyAhGQZ/syBNA5Npn7m8hm1dK+mzOzjAfG2obJXmc9FTpN5W
QMrGMq47VtAne3Co0drEunIwITnrDnA2n7Z7pDW3bdC5DlsrBjJvgzhHDA8msXMK
wpMyRa4mDf/egEJYqcTsLapgjU4BdGtq040EF6Cut819XboBcx8PdOvOC1IS/HGL
jy/Xd1Jjm9hZXo/RkQu27zcCbtt6rZF2VbypiUEE/LPGJNGjAi5IRpJaZRZ1Z9Gt
vBfAhYG6XJmTPPROE+0wt3DYKedrOopyPWcJSVb+XlZwI1nuGYpAQy1CshcIQwTj
ZO/VPZgxICU=
=eQTQ
-----END PGP SIGNATURE-----

BIN
libguestfs-1.56.0.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmhJhEgRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKAWwQ//QkD/5ncbLmACb/OpaK+iTUHMvSRXi+/+
qXYi6xLm6PpzXh6nUokJcXjsr1X4QUU6HXNjLLQwV3mNrct0QY7x1xwAq2EzfKT/
1HSxsUEcB3sHYr7hwwUWmgRcFVHUe8p6z7EjboCtuF9m1E9vq52LXpSYN8kj0WYZ
71sN+i4/xQ63tqIY3XB2OaM/PLtiVdSxZV6dfZxT7ZUvlEFy7Yn9qPANs3lZWTu8
Iu+U3nW9I2JCdhY9sLD8xnUoImXzfcm9Gdd4QGuAZDftT8yz0qqNCcZi3pP9rlsK
kK0g+rjz8Hnp9YPcu66tBitF/BZZ3rYepJUadf00suxf6/RE8/42zv1trZfQ4fa0
ClvOqZ6IDksC+icMuoBcEyTkP0Y8f8001od02oDB0jgBSGG38B1FlMAR4BUDZnzQ
52yeXwnYCTNRJJpT2SgXDCVgbQv3WOTAUZmZqoORx9lb9mTQoepsuwIS1q3e9f5n
J9VObEKqf3Fiob9fi+dkwyIwBxmVIDZP0LWQeDtAeOUoYbRFHaMiuGuTltoKKY9O
M4eudj8uUXZhnIA2UQHCsjaO+IUe9ySYxwCdNvq7vPXv7hHfd4JL9yONfUk6ASWz
jYyRnBdoe68kH1OK8PwFXd4jHfagSj6Fm2z78auQ8WrliAmK7b6DkQ4lOlnR/+lq
NLS1wqCCnpk=
=EfkR
-----END PGP SIGNATURE-----

View File

@@ -1,3 +1,61 @@
-------------------------------------------------------------------
Wed Jun 11 13:37:01 MDT 2025 - carnold@suse.com
- Update to version 1.56.0 (jsc#PED-12706)
* Add support for Windows 2025 (thanks Ming Xie).
* Add support for TencentOS (Denise Cheng).
* Inspection of Ubuntu 22+ guests that use a split /usr
configuration now works properly (thanks Jaroslav Spanko,
Daniel Berrange).
* Inspecting guests that have duplicated root mountpoints now
works.
* Inspection of SUSE Linux guests using btrfs snapshots now
ignores snapshots that mirror content in the root filesystem
(thanks Ming Xie).
* Inspection of SUSE Linux >= 15 now returns the correct osinfo
short name (eg. "sle15") (thanks Ming Xie).
* New command_out and sh_out APIs which allow you to capture
output from guest commands that generate more output than the
protocol limit allows.
* New btrfs_scrub_full API which runs a full Btrfs scrub,
synchronously. It works more like fsck for other filesystems.
* The fstrim API has been modified to work around several issues
in upstream and RHEL 9 kernels related to XFS support (Eric
Sandeen, Dave Chinner).
* The existing e2fsck API has a new FORCENO option enabling use
of the command line -n flag.
* json-c is now required. This replaces Jansson which was
previously used for parsing JSON input files.
* OCaml ≥ 4.08 is now required.
* When using ./configure --disable-daemon we no longer require
augeas and hivex (thanks Mohamed Akram).
* zfs-fuse support has been dropped. The project is unmaintained
upstream (thanks Paul Bolle, Gwyn Ciesla, Timothée Ravier).
* Fix compatibility with GNU gettext 0.25.
* Fix dhcpcd failing on systemd-resolved stub (Thomas Wouters).
* Add support for dhcpcd and sfdisk on Debian (Daniel Gomez).
* Print the kernel utsname in debug output.
* We no longer emit a false warning about BLKDISCARD when
creating a block device.
* If qemu-img(1) commands fail during snapshot creation, make
sure we capture and print stderr from the qemu command (Cole
Robinson).
* For a complete list of changes and bug fixes see,
https://libguestfs.org/guestfs-release-notes-1.56.1.html
- bsc#1216986 - libguestfs: embeds /etc/hosts
reproducible-builds.patch
-------------------------------------------------------------------
Fri Jun 6 11:18:27 MDT 2025 - carnold@suse.com
- Update to version 1.55.14 (jsc#PED-12706)
* lib/create.c: Capture and raise qemu-img stderr
* inspection: Ignore btrfs snapshots of roots
- Drop patches contained in new tarball
004-Add-more-debugging-to-list_filesystems.patch
005-Pipeline-style-when-mapping-and-filtering-filesystems.patch
007-inspection-Ignore-btrfs-snapshots-of-roots.patch
-------------------------------------------------------------------
Wed May 28 09:50:06 MDT 2025 - carnold@suse.com

View File

@@ -18,7 +18,7 @@
Name: libguestfs
ExclusiveArch: x86_64 ppc64 ppc64le s390x aarch64 riscv64
Version: 1.55.13
Version: 1.56.0
Release: 0
Summary: Access and modify virtual machine disk images
License: GPL-2.0-or-later
@@ -33,9 +33,7 @@ Source101: README
# Patches
Patch1: use-rtc-driftfix-slew-for-x86-only.patch
Patch2: 004-Add-more-debugging-to-list_filesystems.patch
Patch3: 005-Pipeline-style-when-mapping-and-filtering-filesystems.patch
Patch4: 007-inspection-Ignore-btrfs-snapshots-of-roots.patch
Patch2: reproducible-builds.patch
Patch100: use-fuse3-for-build.patch
BuildRequires: bison
@@ -109,6 +107,8 @@ sed -i 's|RPMVSF_MASK_NOSIGNATURES|_RPMVSF_NOSIGNATURES|' daemon/rpm-c.c
sed -i 's/tar zcf/tar -zcf/' appliance/Makefile.am
%build
###echo "CEA: mv /etc/hosts /tmp/hosts"
###mv /etc/hosts /tmp/hosts
# provide a wrapper to tar that creates bit-reproducible output (boo#1218191)
# used in supermin for base.tar.gz, in %install for zz-winsupport.tar.gz zz-scripts.tar.gz and in appliance/Makefile.am for 3 more .tar.gz files
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH:-$(date -r %{SOURCE0} +%%s)}
@@ -217,6 +217,9 @@ make \
build_it %{?_smp_mflags} || build_it
###echo "CEA: cp /tmp/hosts /etc/hosts"
###cp /tmp/hosts /etc/hosts
%install
PATH=~/bin:$PATH
%make_install \

16
reproducible-builds.patch Normal file
View File

@@ -0,0 +1,16 @@
References: bsc#1216986 - libguestfs: embeds /etc/hosts (also bsc#1237212)
Removes etc/hosts from base.tar.gz which will be different for each
build environment.
Index: libguestfs-1.56.0/appliance/Makefile.am
===================================================================
--- libguestfs-1.56.0.orig/appliance/Makefile.am
+++ libguestfs-1.56.0/appliance/Makefile.am
@@ -62,6 +62,7 @@ stamp-supermin: make.sh packagelist supe
supermin.d/hostfiles \
supermin.d/init.tar.gz \
supermin.d/udev-rules.tar.gz
+ gunzip supermin.d/base.tar.gz; tar --delete ./etc/hosts -f supermin.d/base.tar 2>/dev/null; gzip supermin.d/base.tar
touch $@
clean-supermin-appliance: