Compare commits

...

2 Commits

Author SHA1 Message Date
AlmaLinux RelEng Bot
d100d303f6 import CS guestfs-tools-1.54.0-9.el10 2026-04-14 05:59:58 -04:00
2f9e07c361 import RHEL 10 Beta guestfs-tools-1.52.1-1.el10 2024-11-20 13:18:40 +00:00
46 changed files with 3624 additions and 1221 deletions

4
.gitignore vendored
View File

@ -1,2 +1,2 @@
SOURCES/guestfs-tools-1.51.6.tar.gz
SOURCES/libguestfs.keyring
guestfs-tools-1.54.0.tar.gz
libguestfs.keyring

View File

@ -1,2 +0,0 @@
7a64ba52bca3a3591d2e639a6bc9002d61e7d374 SOURCES/guestfs-tools-1.51.6.tar.gz
1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring

View File

@ -0,0 +1,34 @@
From 3a99e87bdee6c20a6286aa3e10bb2c2d896fb2ed Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 21 May 2025 15:02:44 +0100
Subject: [PATCH] docs: Move release note about GNU gettext to build section
Fixes: commit 9b7410c220f1111e6acef88efbbaee3fea4019b8
Updates: commit 80ce443e5eb7323e9b7b5cef30b8f7673ca51d67
(cherry picked from commit bf4fef4f2b45a2016c42094f8e4fe18abc8d90e2)
---
docs/guestfs-tools-release-notes-1.54.pod | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/guestfs-tools-release-notes-1.54.pod b/docs/guestfs-tools-release-notes-1.54.pod
index b44eb19a2..ab9062303 100644
--- a/docs/guestfs-tools-release-notes-1.54.pod
+++ b/docs/guestfs-tools-release-notes-1.54.pod
@@ -78,6 +78,8 @@ Some deprecated autoconf macros are no longer used.
Fix some issues when building on macOS (Mohamed Akram).
+Fix compatibility with GNU gettext 0.25.
+
=head2 Internals
The tests were modified to use a set of common functions and remove
@@ -87,8 +89,6 @@ nbdkit.
Some internal OCaml List and String functions that we used have been
replaced by ones from the OCaml stdlib, reducing code maintenance.
-Fix compatibility with GNU gettext 0.25.
-
=head2 Bugs fixed
=begin comment

View File

@ -0,0 +1,23 @@
From 2eae3778a32b18944a6a561e10a35eae74fa11f0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 3 Jun 2025 08:29:57 +0100
Subject: [PATCH] builder: Update link to templates to use https
Fixes: https://issues.redhat.com/browse/RHEL-94873
Reported-by: Xiang Hua Chen
(cherry picked from commit 5a2458f38d40e5c6f3eceb8e7de162724ff9e374)
---
builder/libguestfs.conf.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/libguestfs.conf.in b/builder/libguestfs.conf.in
index 8d8feab75..08b6a6234 100644
--- a/builder/libguestfs.conf.in
+++ b/builder/libguestfs.conf.in
@@ -1,5 +1,5 @@
[libguestfs.org]
-uri=http://builder.libguestfs.org/index.asc
+uri=https://builder.libguestfs.org/index.asc
gpgkey=file://@SYSCONFDIR@/virt-builder/repos.d/libguestfs.gpg
[archive.libguestfs.org]

View File

@ -0,0 +1,32 @@
From b6401279c65497506eac2eaf61470bf6f49e89e7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 16 Jun 2025 21:47:41 +0100
Subject: [PATCH] builder: Replace -cpu host with -cpu max in example
When KVM isn't present, some versions of qemu may print:
qemu-system-x86_64: Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize kvm: No such file or directory
qemu-system-x86_64: falling back to tcg
qemu-system-x86_64: CPU model 'host' requires KVM or HVF
Use -cpu max instead which should work in both cases.
(cherry picked from commit 2e93abca5acaa69cd6fd08b70079e8f432539076)
---
builder/virt-builder.pod | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index 05bef1e05..ff0ec250c 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -1043,7 +1043,7 @@ following could be used to boot the virtual machine:
qemu-system-x86_64 \
-machine accel=kvm:tcg \
- -cpu host \
+ -cpu max \
-m 2048 \
-drive file=disk.img,format=raw,if=virtio

View File

@ -0,0 +1,143 @@
From 6a1e751d4b10ae1833ee18c0796306711e842e76 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 13 Aug 2025 16:51:39 +0100
Subject: [PATCH] customize: Fixes for selinux relabelling and Windows
firstboot
This updates the common submodule to add the fixes below. These
changes allow SELinux relabelling to work correctly on Linux split-
/usr configurations, and allow Windows firstboot scripts to be
deferred until after a reboot.
The SELinux relabelling change requires libguestfs >= 1.57.1 (for the
new guestfs_setfiles API).
Richard W.M. Jones (4):
mlstdutils: Add List.combine4 function
mlcustomize/SELinux_relabel.ml: Add comment
mlcustomize/SELinux_relabel.ml: Use new guestfs_setfiles API
mlcustomize/SELinux_relabel.ml: Relabel every mountpoint
Vadim Rozenfeld (1):
Modify the firstboot script to check the scripts execution return status
Fixes: https://issues.redhat.com/browse/RHEL-108174
Related: https://issues.redhat.com/browse/RHEL-100682
(cherry picked from commit ea0f9cf0743c3e50a996a9d7ec488d58a9312b11)
---
common | 2 +-
m4/guestfs-libraries.m4 | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Submodule common d4a81e9dd..89f1eb2d3:
diff --git a/common/mlcustomize/SELinux_relabel.ml b/common/mlcustomize/SELinux_relabel.ml
index 2f3a09bf7..f1729e3f4 100644
--- a/common/mlcustomize/SELinux_relabel.ml
+++ b/common/mlcustomize/SELinux_relabel.ml
@@ -1,5 +1,5 @@
(* virt-customize
- * Copyright (C) 2016 Red Hat Inc.
+ * Copyright (C) 2016-2025 Red Hat Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -24,6 +24,10 @@ open Printf
module G = Guestfs
+(* XXX A lot of this code could usefully be moved into
+ * [libguestfs.git/daemon/selinux.ml].
+ *)
+
let rec relabel (g : G.guestfs) =
(* Is the guest using SELinux? (Otherwise this is a no-op). *)
if is_selinux_guest g then (
@@ -109,5 +113,13 @@ and use_setfiles g =
g#copy_attributes ~all:true old_specfile specfile
);
+ (* Get the list of mountpoints, since setfiles does not cross
+ * filesystems (RHEL-108174).
+ *)
+ let mps = g#mountpoints () |>
+ List.map snd |> (* the list of directories *)
+ List.sort compare |> (* sort them for consistency *)
+ Array.of_list in
+
(* Relabel everything. *)
- g#selinux_relabel ~force:true specfile "/"
+ g#setfiles ~force:true specfile mps
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 6aca4c34a..5f2642b06 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -305,13 +305,19 @@ if not exist \"%%scripts_done%%\" (
:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
- move \"%%%%f\" \"%%scripts_done%%\"
- pushd \"%%scripts_done%%\"
+ pushd \"%%scripts%%\"
call \"%%%%~nf\"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+ if !elvl! NEQ 249 (
+ echo Script succeeded, moving to scripts-done
+ move \"%%%%f\" \"%%scripts_done%%\"
+ ) else (
+ echo Script failed, will retry on next boot
+ )
+
:: Reboot the computer. This is necessary to free any locked
:: files which may prevent later scripts from running.
shutdown /r /t 0 /y
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 4850a5598..16032d992 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -80,6 +80,12 @@ module List = struct
| x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs
| _ -> invalid_arg "combine3"
+ let rec combine4 ws xs ys zs =
+ match ws, xs, ys, zs with
+ | [], [], [], [] -> []
+ | w::ws, x::xs, y::ys, z::zs -> (w, x, y, z) :: combine4 ws xs ys zs
+ | _ -> invalid_arg "combine4"
+
let rec assoc_lbl ?(cmp = Stdlib.compare) ~default x = function
| [] -> default
| (y, y') :: _ when cmp x y = 0 -> y'
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index fe6bf1a7c..a20e720c2 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -106,6 +106,11 @@ module List : sig
(** Like {!List.combine} but for triples.
All lists must be the same length. *)
+ val combine4 : 'a list -> 'b list -> 'c list -> 'd list ->
+ ('a * 'b * 'c * 'd) list
+ (** Like {!List.combine} but for 4-tuples.
+ All lists must be the same length. *)
+
val assoc_lbl : ?cmp:('a -> 'a -> int) -> default:'b -> 'a -> ('a * 'b) list -> 'b
(** Like {!assoc} but with a user-defined comparison function, and
instead of raising [Not_found], it returns the [~default] value. *)
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index c9fbf58b2..82e62d54f 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -19,8 +19,8 @@ dnl Any C libraries required by the libguestfs C library (not the daemon).
dnl Of course we need libguestfs.
dnl
-dnl We need libguestfs 1.55.6 for guestfs_sh_out.
-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.55.6])
+dnl We need libguestfs 1.57.1 for guestfs_setfiles.
+PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.1])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs
dnl Test if it's GNU or XSI strerror_r.

View File

@ -0,0 +1,122 @@
From a01095308d22a5ab4d5858dfe0ee46f0b1bec28c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 20 Aug 2025 10:34:24 +0100
Subject: [PATCH] Update common submodule
Pulls in this fix which should have no effect:
Richard W.M. Jones (1):
mlcustomize/firstboot.ml: Use quoted string literals for firstboot
(cherry picked from virt-v2v commit b7aadeac02ef326d542cd83e441b5a9d99ced793)
(cherry picked from commit 038b30fb08107487cdba4bc0dbabb33dbf75f4c3)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 89f1eb2d3..7ecf3992b:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 5f2642b06..360c33d67 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -35,8 +35,7 @@ let sanitize_name =
module Linux = struct
let firstboot_dir = "/usr/lib/virt-sysprep"
- let firstboot_sh = sprintf "\
-#!/bin/sh -
+ let firstboot_sh = sprintf {|#!/bin/sh -
### BEGIN INIT INFO
# Provides: virt-sysprep
@@ -57,14 +56,14 @@ d=%s/scripts
d_done=%s/scripts-done
logfile=~root/virt-sysprep-firstboot.log
-echo \"$0\" \"$@\" 2>&1 | tee -a $logfile
-echo \"Scripts dir: $d\" 2>&1 | tee -a $logfile
+echo "$0" "$@" 2>&1 | tee -a $logfile
+echo "Scripts dir: $d" 2>&1 | tee -a $logfile
-if test \"$1\" = \"start\"
+if test "$1" = "start"
then
mkdir -p $d_done
for f in $d/* ; do
- if test -x \"$f\"
+ if test -x "$f"
then
# move the script to the 'scripts-done' directory, so it is not
# executed again at the next boot
@@ -75,7 +74,7 @@ then
done
rm -f $d_done/*
fi
-" firstboot_dir firstboot_dir
+|} firstboot_dir firstboot_dir
let systemd_target = "multi-user.target"
@@ -282,38 +281,37 @@ module Windows = struct
* XXX It would be better to use powershell here. For some ideas see
* https://github.com/HCK-CI/HLK-Setup-Scripts/
*)
- let firstboot_script = sprintf "\
-@echo off
+ let firstboot_script = sprintf {|@echo off
setlocal EnableDelayedExpansion
set firstboot=%s
-set log=%%firstboot%%\\log.txt
+set log=%%firstboot%%\log.txt
-set scripts=%%firstboot%%\\scripts
-set scripts_done=%%firstboot%%\\scripts-done
+set scripts=%%firstboot%%\scripts
+set scripts_done=%%firstboot%%\scripts-done
-call :main >> \"%%log%%\" 2>&1
+call :main >> "%%log%%" 2>&1
exit /b
:main
echo starting firstboot service
-if not exist \"%%scripts_done%%\" (
- mkdir \"%%scripts_done%%\"
+if not exist "%%scripts_done%%" (
+ mkdir "%%scripts_done%%"
)
:: Pick the next script to run.
-for %%%%f in (\"%%scripts%%\"\\*.bat) do (
- echo running \"%%%%f\"
- pushd \"%%scripts%%\"
- call \"%%%%~nf\"
+for %%%%f in ("%%scripts%%"\*.bat) do (
+ echo running "%%%%f"
+ pushd "%%scripts%%"
+ call "%%%%~nf"
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
if !elvl! NEQ 249 (
echo Script succeeded, moving to scripts-done
- move \"%%%%f\" \"%%scripts_done%%\"
+ move "%%%%f" "%%scripts_done%%"
) else (
echo Script failed, will retry on next boot
)
@@ -329,8 +327,8 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do (
:: Fallthrough here if there are no scripts.
echo uninstalling firstboot service
-\"%%firstboot%%\\%s\" -s firstboot uninstall
-" firstboot_dir_win srvany in
+"%%firstboot%%\%s" -s firstboot uninstall
+|} firstboot_dir_win srvany in
g#write (firstboot_dir // "firstboot.bat")
(String.unix2dos firstboot_script);

View File

@ -0,0 +1,22 @@
From 9ee5fdf8146231087a461f4cddc0280db762c2f4 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 1 Sep 2025 17:33:07 +0100
Subject: [PATCH] .gitignore: Ignore *.bak files
(cherry picked from commit cd5ea5cd63a11bc85077e6296021bd25b3c84662)
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index 9c2e200e6..94f77ac74 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
*.1
*.a
*.annot
+*.bak
*.cmi
*.cmo
*.cmx

View File

@ -0,0 +1,206 @@
From 0074de5f6eccb75dad814527813eba3524bb22e0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 1 Sep 2025 18:41:24 +0100
Subject: [PATCH] builder, sysprep: Use quoted string literals in a few places
This change was automated using the script in:
https://github.com/libguestfs/libguestfs/commit/02b64d5cec1ac0a6f7627d5489996de4474a67f6
However I manually only picked a few of the changes suggested
by the script.
(cherry picked from commit 624df48b3d14d2e5420d758a425bcae509cfe318)
---
builder/templates/make-template.ml | 62 ++++++++++++++---------------
sysprep/sysprep_operation_script.ml | 5 ++-
2 files changed, 33 insertions(+), 34 deletions(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index 73a55bd45..515c3da8b 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -535,8 +535,7 @@ and make_kickstart_common ks_filename os arch =
| _ -> bpf "install\n";
);
- bpf "\
-text
+ bpf {|text
reboot
lang en_US.UTF-8
keyboard us
@@ -544,7 +543,7 @@ network --bootproto dhcp
rootpw builder
firewall --enabled --ssh
timezone --utc America/New_York
-";
+|};
(match os with
| RHEL (ver, _) when ver <= 4 ->
@@ -586,19 +585,19 @@ mouse generic
| CentOS ((3|4|5|6) as major, _) | RHEL ((3|4|5|6) as major, _) ->
let bootfs = if major <= 5 then "ext2" else "ext4" in
let rootfs = if major <= 4 then "ext3" else "ext4" in
- bpf "\
+ bpf {|
zerombr
clearpart --all --initlabel
part /boot --fstype=%s --size=512 --asprimary
part swap --size=1024 --asprimary
part / --fstype=%s --size=1024 --grow --asprimary
-" bootfs rootfs;
+|} bootfs rootfs;
| Alma _ | CentOS _ | CentOSStream _ | RHEL _ | Fedora _ ->
- bpf "\
+ bpf {|
zerombr
clearpart --all --initlabel --disklabel=gpt
autopart --type=plain
-";
+|};
| _ -> assert false (* cannot happen, see caller *)
);
bpf "\n";
@@ -753,16 +752,16 @@ and make_unattend_iso os arch =
* file called \Windows\Panther\Setupact.log (NB:
* not \Windows\Setupact.log)
*)
- fprintf chan "
-<unattend xmlns=\"urn:schemas-microsoft-com:unattend\"
- xmlns:ms=\"urn:schemas-microsoft-com:asm.v3\"
- xmlns:wcm=\"http://schemas.microsoft.com/WMIConfig/2002/State\">
- <settings pass=\"windowsPE\">
- <component name=\"Microsoft-Windows-Setup\"
- publicKeyToken=\"31bf3856ad364e35\"
- language=\"neutral\"
- versionScope=\"nonSxS\"
- processorArchitecture=\"%s\">
+ fprintf chan {|
+<unattend xmlns="urn:schemas-microsoft-com:unattend"
+ xmlns:ms="urn:schemas-microsoft-com:asm.v3"
+ xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
+ <settings pass="windowsPE">
+ <component name="Microsoft-Windows-Setup"
+ publicKeyToken="31bf3856ad364e35"
+ language="neutral"
+ versionScope="nonSxS"
+ processorArchitecture="%s">
<UserData>
<AcceptEula>true</AcceptEula>
<ProductKey>
@@ -772,18 +771,18 @@ and make_unattend_iso os arch =
</UserData>
<DiskConfiguration>
- <Disk wcm:action=\"add\">
+ <Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- System partition -->
- <CreatePartition wcm:action=\"add\">
+ <CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>300</Size>
</CreatePartition>
<!-- Windows partition -->
- <CreatePartition wcm:action=\"add\">
+ <CreatePartition wcm:action="add">
<Order>2</Order>
<Type>Primary</Type>
<Extend>true</Extend>
@@ -791,7 +790,7 @@ and make_unattend_iso os arch =
</CreatePartitions>
<ModifyPartitions>
<!-- System partition -->
- <ModifyPartition wcm:action=\"add\">
+ <ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>System</Label>
@@ -799,7 +798,7 @@ and make_unattend_iso os arch =
<Active>true</Active>
</ModifyPartition>
<!-- Windows partition -->
- <ModifyPartition wcm:action=\"add\">
+ <ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>Windows</Label>
@@ -828,11 +827,11 @@ and make_unattend_iso os arch =
</ImageInstall>
</component>
- <component name=\"Microsoft-Windows-International-Core-WinPE\"
- publicKeyToken=\"31bf3856ad364e35\"
- language=\"neutral\"
- versionScope=\"nonSxS\"
- processorArchitecture=\"%s\">
+ <component name="Microsoft-Windows-International-Core-WinPE"
+ publicKeyToken="31bf3856ad364e35"
+ language="neutral"
+ versionScope="nonSxS"
+ processorArchitecture="%s">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
@@ -841,7 +840,7 @@ and make_unattend_iso os arch =
<UserLocale>en-US</UserLocale>
</component>
</settings>
-</unattend>"
+</unattend>|}
arch product_key arch;
close_out chan;
@@ -1411,14 +1410,13 @@ baseurl=%s
enabled=0
gpgcheck=0
keepcache=0
-" major major baseurl major major srpms;
+|} major major baseurl major major srpms;
(match optional with
| None -> ()
| Some (name, optionalbaseurl, optionalsrpms) ->
let lc_name = String.lowercase_ascii name in
- bpf "\
-
+ bpf {|
[rhel%d-%s]
name=RHEL %d Server %s
baseurl=%s
@@ -1432,7 +1430,7 @@ baseurl=%s
enabled=0
gpgcheck=0
keepcache=0
-" major lc_name major lc_name optionalbaseurl
+|} major lc_name major lc_name optionalbaseurl
major lc_name major lc_name optionalsrpms
)
) else (
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index fff5e4d51..a91cea26b 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -81,7 +81,7 @@ let rec script_perform (g : Guestfs.guestfs) root side_effects =
and run_scripts mp scripts =
let sh = "/bin/bash" in
let cmd =
- sprintf "\
+ sprintf {|
set -e
#set -x
cleanup ()
@@ -91,7 +91,8 @@ cleanup ()
guestunmount %s ||:
exit $status
}
-trap cleanup INT TERM QUIT EXIT ERR\n"
+trap cleanup INT TERM QUIT EXIT ERR
+|}
(Filename.quote mp) ^
String.concat "\n" scripts in
let args = [| sh; "-c"; cmd |] in

View File

@ -0,0 +1,26 @@
From cde27ebd4775cfa9a23a53a48b47303557bcb537 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:05:27 +0100
Subject: [PATCH] builder/templates/make-template.ml: Fix quoting
Fix mistake introduced by manual editing of the previous commit.
Fixes: commit 624df48b3d14d2e5420d758a425bcae509cfe318
(cherry picked from commit 7e63b2142682582ec87bdd8c0d98bb22fcc0dabf)
---
builder/templates/make-template.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index 515c3da8b..a69d3ad3f 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -1394,7 +1394,7 @@ and make_rhel_yum_conf major minor arch =
sprintf "%s/AppStream/source/tree" topurl)
| _ -> assert false in
- bpf "\
+ bpf {|
# Yum configuration pointing to Red Hat servers.
[rhel%d]

View File

@ -0,0 +1,33 @@
From 1fca99c9bed60cd9a9c62826d4e6995052d0c5dd Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:06:33 +0100
Subject: [PATCH] builder/templates/make-template.ml: Use quoted string
literals for regexps
(cherry picked from commit aafb271e8ffd961c529f90ef65df75a70102f0fc)
---
builder/templates/make-template.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index a69d3ad3f..f8b41209e 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -374,7 +374,7 @@ and os_of_string os ver =
eprintf "%s: unknown or unsupported OS (%s, %s)\n" prog os ver; exit 1
and parse_major_minor ver =
- let rex = Str.regexp "^\\([0-9]+\\)\\.\\([0-9]+\\)$" in
+ let rex = Str.regexp {|^\([0-9]+\)\.\([0-9]+\)$|} in
if Str.string_match rex ver 0 then (
int_of_string (Str.matched_group 1 ver),
int_of_string (Str.matched_group 2 ver)
@@ -1631,7 +1631,7 @@ and read_revision filename =
| None -> `No_file
| Some chan ->
let r = ref `No_revision in
- let rex = Str.regexp "^revision=\\([0-9]+\\)$" in
+ let rex = Str.regexp {|^revision=\([0-9]+\)$|} in
(try
let rec loop () =
let line = input_line chan in

View File

@ -0,0 +1,43 @@
From 7b2125b42535e6768d8f162d19463af4c4e8df1b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 2 Sep 2025 09:07:34 +0100
Subject: [PATCH] builder/templates/make-template.ml: Add +str and +unix for
OCaml 5
Removes these warnings:
File "_none_", line 1:
Alert ocaml_deprecated_auto_include:
OCaml's lib directory layout changed in 5.0. The str subdirectory has been
automatically added to the search path, but you should add -I +str to the
command-line to silence this alert (e.g. by adding str to the list of
libraries in your dune file, or adding use_str to your _tags file for
ocamlbuild, or using -package str for ocamlfind).
File "_none_", line 1:
Alert ocaml_deprecated_auto_include:
OCaml's lib directory layout changed in 5.0. The unix subdirectory has been
automatically added to the search path, but you should add -I +unix to the
command-line to silence this alert (e.g. by adding unix to the list of
libraries in your dune file, or adding use_unix to your _tags file for
ocamlbuild, or using -package unix for ocamlfind).
(cherry picked from commit 046309b31c22da5ac64feac12bcf4501377a8b3f)
---
builder/templates/make-template.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index f8b41209e..2ce803e2b 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -24,7 +24,9 @@
* shell scripts located in libguestfs.git/builder/website.
*)
+#directory "+str";;
#load "str.cma";;
+#directory "+unix";;
#load "unix.cma";;
#directory "+guestfs";; (* use globally installed guestfs *)
#load "mlguestfs.cma";;

View File

@ -0,0 +1,76 @@
From 68a3719888f36719cef8bcd7817ed634c4524012 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Sep 2025 08:37:58 +0100
Subject: [PATCH] daemon, generator: Use power of 2 for initial size of
Hashtbl.create
Before 2011 it was recommended to use a prime number for the initial
size. In 2011 the OCaml hash table was reimplemented using a hash
function based on Murmur 3. Hashtbl.create now adjusts the initial
size to the next power of 2 (minimum 16). So replace obsolete
'Hashtbl.create 13' with 'Hashtbl.create 16'.
(cherry picked from commit 51f7dfa8612e8e273e3ef15eddd7a5714122cc57)
---
builder/builder.ml | 2 +-
builder/index_parser.ml | 4 ++--
resize/resize.ml | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index bbe2808f5..2df2fa5c7 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -46,7 +46,7 @@ let remove_duplicates index =
* (name, arch) tuples, so it possible to ignore duplicates,
* and versions with a lower revision.
*)
- let nseen = Hashtbl.create 13 in
+ let nseen = Hashtbl.create 16 in
List.iter (
fun (name, { Index.arch; revision }) ->
let id = name, arch in
diff --git a/builder/index_parser.ml b/builder/index_parser.ml
index 3e19e489e..2cb89488f 100644
--- a/builder/index_parser.ml
+++ b/builder/index_parser.ml
@@ -55,7 +55,7 @@ let get_index ~downloader ~sigchecker ?(template = false)
in
n, (find_arch fields)
) sections in
- let nseen = Hashtbl.create 13 in
+ let nseen = Hashtbl.create 16 in
List.iter (
fun (n, arch) ->
let id = n, arch in
@@ -71,7 +71,7 @@ let get_index ~downloader ~sigchecker ?(template = false)
(* Check for repeated fields. *)
List.iter (
fun (n, fields) ->
- let fseen = Hashtbl.create 13 in
+ let fseen = Hashtbl.create 16 in
List.iter (
fun (field, subkey, _) ->
let hashkey = (field, subkey) in
diff --git a/resize/resize.ml b/resize/resize.ml
index fffe2de77..707def8e9 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -630,7 +630,7 @@ read the man page virt-resize(1).
* that the user has asked to be ignored or deleted.
*)
let find_partition =
- let hash = Hashtbl.create 13 in
+ let hash = Hashtbl.create 16 in
List.iter (fun ({ p_name = name } as p) -> Hashtbl.add hash name p)
partitions;
fun ~option name ->
@@ -881,7 +881,7 @@ read the man page virt-resize(1).
surplus in
(* Mark the --lv-expand LVs. *)
- let hash = Hashtbl.create 13 in
+ let hash = Hashtbl.create 16 in
List.iter (fun ({ lv_name = name } as lv) -> Hashtbl.add hash name lv) lvs;
List.iter (

View File

@ -0,0 +1,123 @@
From abb56223e0a35c3e5d1158f32789c44c28bacf40 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 24 May 2025 13:27:00 +0100
Subject: [PATCH] builder: Build fedora-42 template
Thanks: Jeff Layton
---
builder/templates/fedora-42.index-fragment | 22 +++++++++
builder/templates/fedora-42.ks | 48 ++++++++++++++++++++
builder/templates/fedora-42.virt-install-cmd | 20 ++++++++
3 files changed, 90 insertions(+)
create mode 100644 builder/templates/fedora-42.index-fragment
create mode 100644 builder/templates/fedora-42.ks
create mode 100644 builder/templates/fedora-42.virt-install-cmd
diff --git a/builder/templates/fedora-42.index-fragment b/builder/templates/fedora-42.index-fragment
new file mode 100644
index 000000000..6d21b742c
--- /dev/null
+++ b/builder/templates/fedora-42.index-fragment
@@ -0,0 +1,22 @@
+[fedora-42]
+name=Fedora® 42 Server
+osinfo=fedora42
+arch=x86_64
+file=fedora-42.xz
+checksum[sha512]=dda921f3c522da8d8a67e31948260f52a9aa5bdeca4382a5c557635d77ad91d11b9aded70a225f59503b268ec73815ceac2eac5b70c1d47f22056febdd9da6bb
+format=raw
+size=6442450944
+compressed_size=927728896
+expand=/dev/sda3
+notes=Fedora® 42 Server
+
+ This Fedora image contains only unmodified @Core group packages.
+
+ Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
+ Source and further information is available from http://fedoraproject.org/
+
+ This template was generated by a script in the libguestfs source tree:
+ builder/templates/make-template.ml
+ Associated files used to prepare this template can be found in the
+ same directory.
+
diff --git a/builder/templates/fedora-42.ks b/builder/templates/fedora-42.ks
new file mode 100644
index 000000000..17e2e3f15
--- /dev/null
+++ b/builder/templates/fedora-42.ks
@@ -0,0 +1,48 @@
+# Kickstart file for fedora-42
+# Generated by libguestfs.git/builder/templates/make-template.ml
+
+text
+reboot
+lang en_US.UTF-8
+keyboard us
+network --bootproto dhcp
+rootpw builder
+firewall --enabled --ssh
+timezone --utc America/New_York
+selinux --enforcing
+
+bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH"
+
+
+zerombr
+clearpart --all --initlabel --disklabel=gpt
+autopart --type=plain
+
+# Halt the system once configuration has finished.
+poweroff
+
+%packages
+@core
+%end
+
+%post
+# Ensure the installation is up-to-date.
+dnf -y --best upgrade
+# This required otherwise the kernel will not be bootable, see
+# https://bugzilla.redhat.com/show_bug.cgi?id=1911177
+# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24
+grub2-mkconfig -o '/etc/grub2.cfg'
+# Enable Xen domU support.
+pushd /etc/dracut.conf.d
+echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf
+popd
+# To make dracut config changes permanent, we need to rerun dracut.
+# Rerun dracut for the installed kernel (not the running kernel).
+# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and
+# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045
+KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' |
+ sort -V | tail -1)"
+dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION
+%end
+
+# EOF
diff --git a/builder/templates/fedora-42.virt-install-cmd b/builder/templates/fedora-42.virt-install-cmd
new file mode 100644
index 000000000..2a3256bbd
--- /dev/null
+++ b/builder/templates/fedora-42.virt-install-cmd
@@ -0,0 +1,20 @@
+# This is the virt-install command which was used to create
+# the virt-builder template 'fedora-42'
+# NB: This file is generated for documentation purposes ONLY!
+# This script was never run, and is not intended to be run.
+
+'virt-install' \
+ '--transient' \
+ '--name=tmp-oeg15xnl' \
+ '--ram=4096' \
+ '--arch=x86_64' \
+ '--cpu=host' \
+ '--vcpus=4' \
+ '--os-variant=fedora34' \
+ '--initrd-inject=fedora-42.ks' \
+ '--extra-args=inst.ks=file:/fedora-42.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \
+ '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-oeg15xnl.img,size=6,format=raw' \
+ '--location=https://lon.mirror.rackspace.com/fedora/releases/42/Server/x86_64/os/' \
+ '--serial=pty' \
+ '--nographics'
+

View File

@ -0,0 +1,61 @@
From 2d808c89eee6369df62b3afe16681a41ca42e0b9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 20 Sep 2025 17:20:25 +0100
Subject: [PATCH] Update common submodule
Richard W.M. Jones (3):
mlstdutils: Export List.find_opt
daemon, generator: Use power of 2 for initial size of Hashtbl.create
mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor
See-also: https://github.com/libguestfs/libguestfs-common/pull/17
(cherry picked from commit 13bcff3c2ca3e7ad355527a13b3aa2941ec1ff5b)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 7ecf3992b..da55dc4d7:
diff --git a/common/mlcustomize/customize_run.ml b/common/mlcustomize/customize_run.ml
index ff719f4ec..64afd3ab5 100644
--- a/common/mlcustomize/customize_run.ml
+++ b/common/mlcustomize/customize_run.ml
@@ -97,7 +97,7 @@ let run (g : G.guestfs) root (ops : ops) =
) in
(* Store the passwords and set them all at the end. *)
- let passwords = Hashtbl.create 13 in
+ let passwords = Hashtbl.create 16 in
let set_password user pw =
if Hashtbl.mem passwords user then
error (f_"multiple --root-password/--password options set the \
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index b26b14d34..114df0641 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -310,8 +310,13 @@ and ddb_regedits inspect drv_name drv_pciid =
* one must add keys into the DriverDatabase.
*)
+ let winarch =
+ match inspect.i_arch with
+ | "i386" -> "x86" | "x86_64" -> "amd64"
+ | _ -> assert false in
+
let drv_inf = "guestor.inf" in
- let drv_inf_label = drv_inf ^ "_tmp" in
+ let drv_inf_label = sprintf "%s_%s_0000000000000000" drv_inf winarch in
let drv_config = "guestor_conf" in
[
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index a20e720c2..6c1911da8 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -46,6 +46,7 @@ module List : sig
val mem : 'a -> 'a list -> bool
val memq : 'a -> 'a list -> bool
val find : ('a -> bool) -> 'a list -> 'a
+ val find_opt : ('a -> bool) -> 'a list -> 'a option
val filter : ('a -> bool) -> 'a list -> 'a list
val find_all : ('a -> bool) -> 'a list -> 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

View File

@ -0,0 +1,427 @@
From 5ed99959b689fc6fa287d9c6100e92a18bc1c9be Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 14 Oct 2025 14:07:40 -0400
Subject: [PATCH] common: update submodule
Cole Robinson (1):
mlcustomize: deprecate and remove --sm-* options
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 57b225d8d324d15d79fab2ccc6944868c1168a42)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common da55dc4d7..90399dd18:
diff --git a/common/mlcustomize/Makefile.am b/common/mlcustomize/Makefile.am
index 6e03bfea3..351524c80 100644
--- a/common/mlcustomize/Makefile.am
+++ b/common/mlcustomize/Makefile.am
@@ -47,7 +47,6 @@ SOURCES_MLI = \
random_seed.mli \
SELinux_relabel.mli \
ssh_key.mli \
- subscription_manager.mli \
timezone.mli
# This list must be in dependency order.
@@ -58,7 +57,6 @@ SOURCES_ML = \
perl_edit.ml \
random_seed.ml \
ssh_key.ml \
- subscription_manager.ml \
timezone.ml \
crypt.ml \
password.ml \
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index 157145ebc..c8de3953c 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -392,35 +392,6 @@ It cannot delete directories, only regular files.
This is a compatibility option that does nothing.
-=item B<--sm-attach> SELECTOR
-
-Attach to a pool using C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-credentials> SELECTOR
-
-Set the credentials for C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-register>
-
-Register the guest using C<subscription-manager>.
-
-This requires credentials being set using I<--sm-credentials>.
-
-=item B<--sm-remove>
-
-Remove all the subscriptions from the guest using
-C<subscription-manager>.
-
-=item B<--sm-unregister>
-
-Unregister the guest using C<subscription-manager>.
-
=item B<--ssh-inject> USER[:SELECTOR]
Inject an ssh key so the given C<USER> will be able to log in over
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index 957de8cf2..f5eeb69dd 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -8,11 +8,10 @@
[--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR]
[--move SOURCE:DEST] [--password USER:SELECTOR]
[--root-password SELECTOR] [--run SCRIPT]
- [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR]
- [--sm-register] [--sm-remove] [--sm-unregister]
+ [--run-command 'CMD+ARGS'] [--scrub FILE]
[--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR]
[--timezone TIMEZONE] [--touch FILE] [--truncate FILE]
[--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update]
[--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
- [--selinux-relabel] [--sm-credentials SELECTOR]
+ [--selinux-relabel]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 7451f1325..786f4ee49 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -85,14 +85,6 @@ and op = [
(* --run-command 'CMD+ARGS' *)
| `Scrub of string
(* --scrub FILE *)
- | `SMAttach of Subscription_manager.sm_pool
- (* --sm-attach SELECTOR *)
- | `SMRegister
- (* --sm-register *)
- | `SMRemove
- (* --sm-remove *)
- | `SMUnregister
- (* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
| `TarIn of string * string
@@ -123,8 +115,6 @@ and flags = {
(* --no-selinux-relabel *)
selinux_relabel_ignored : bool;
(* --selinux-relabel *)
- sm_credentials : Subscription_manager.sm_credentials option;
- (* --sm-credentials SELECTOR *)
}
type argspec = Getopt.keys * Getopt.spec * Getopt.doc
@@ -135,7 +125,6 @@ let rec argspec ?(v2v = false) () =
let password_crypto = ref None in
let no_selinux_relabel = ref false in
let selinux_relabel_ignored = ref false in
- let sm_credentials = ref None in
let rec get_ops () = {
ops = List.rev !ops;
@@ -146,7 +135,6 @@ let rec argspec ?(v2v = false) () =
password_crypto = !password_crypto;
no_selinux_relabel = !no_selinux_relabel;
selinux_relabel_ignored = !selinux_relabel_ignored;
- sm_credentials = !sm_credentials;
}
in
@@ -386,35 +374,6 @@ let rec argspec ?(v2v = false) () =
s_"Scrub a file"
),
Some "FILE", "Scrub a file from the guest. This is like I<--delete> except that:\n\n=over 4\n\n=item *\n\nIt scrubs the data so a guest could not recover it.\n\n=item *\n\nIt cannot delete directories, only regular files.\n\n=back", false;
- (
- [ L"sm-attach" ],
- Getopt.String (
- s_"SELECTOR",
- fun s ->
- let sel = Subscription_manager.parse_pool_selector s in
- List.push_front (`SMAttach sel) ops
- ),
- s_"Attach to a subscription-manager pool"
- ),
- Some "SELECTOR", "Attach to a pool using C<subscription-manager>.\n\nSee L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of\nthe C<SELECTOR> field.", false;
- (
- [ L"sm-register" ],
- Getopt.Unit (fun () -> List.push_front `SMRegister ops),
- s_"Register using subscription-manager"
- ),
- None, "Register the guest using C<subscription-manager>.\n\nThis requires credentials being set using I<--sm-credentials>.", false;
- (
- [ L"sm-remove" ],
- Getopt.Unit (fun () -> List.push_front `SMRemove ops),
- s_"Remove all the subscriptions"
- ),
- None, "Remove all the subscriptions from the guest using\nC<subscription-manager>.", false;
- (
- [ L"sm-unregister" ],
- Getopt.Unit (fun () -> List.push_front `SMUnregister ops),
- s_"Unregister using subscription-manager"
- ),
- None, "Unregister the guest using C<subscription-manager>.", false;
(
[ L"ssh-inject" ],
Getopt.String (
@@ -529,16 +488,6 @@ let rec argspec ?(v2v = false) () =
s_"Compatibility option doing nothing"
),
None, "This is a compatibility option that does nothing.", false;
- (
- [ L"sm-credentials" ],
- Getopt.String (
- s_"SELECTOR",
- fun s ->
- sm_credentials := Some (Subscription_manager.parse_credentials_selector s)
- ),
- s_"Credentials for subscription-manager"
- ),
- Some "SELECTOR", "Set the credentials for C<subscription-manager>.\n\nSee L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of\nthe C<SELECTOR> field.", false;
]
and customize_read_from_file filename =
let forbidden_commands = [
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index cc32f3af4..baacda9d3 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -77,14 +77,6 @@ and op = [
(* --run-command 'CMD+ARGS' *)
| `Scrub of string
(* --scrub FILE *)
- | `SMAttach of Subscription_manager.sm_pool
- (* --sm-attach SELECTOR *)
- | `SMRegister
- (* --sm-register *)
- | `SMRemove
- (* --sm-remove *)
- | `SMUnregister
- (* --sm-unregister *)
| `SSHInject of string * Ssh_key.ssh_key_selector
(* --ssh-inject USER[:SELECTOR] *)
| `TarIn of string * string
@@ -115,8 +107,6 @@ and flags = {
(* --no-selinux-relabel *)
selinux_relabel_ignored : bool;
(* --selinux-relabel *)
- sm_credentials : Subscription_manager.sm_credentials option;
- (* --sm-credentials SELECTOR *)
}
type argspec = Getopt.keys * Getopt.spec * Getopt.doc
diff --git a/common/mlcustomize/customize_run.ml b/common/mlcustomize/customize_run.ml
index 64afd3ab5..1baf0f3cf 100644
--- a/common/mlcustomize/customize_run.ml
+++ b/common/mlcustomize/customize_run.ml
@@ -279,43 +279,6 @@ let run (g : G.guestfs) root (ops : ops) =
message (f_"Scrubbing: %s") path;
g#scrub_file path
- | `SMAttach pool ->
- (match pool with
- | Subscription_manager.PoolAuto ->
- message (f_"Attaching to compatible subscriptions");
- let cmd = "subscription-manager attach --auto" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
- | Subscription_manager.PoolId id ->
- message (f_"Attaching to the pool %s") id;
- let cmd = sprintf "subscription-manager attach --pool=%s" (quote id) in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
- )
-
- | `SMRegister ->
- message (f_"Registering with subscription-manager");
- let creds =
- match ops.flags.sm_credentials with
- | None ->
- error (f_"subscription-manager credentials required for \
- --sm-register")
- | Some c -> c in
- let cmd = sprintf "subscription-manager register \
- --username=%s --password=%s"
- (quote creds.Subscription_manager.sm_username)
- (quote creds.Subscription_manager.sm_password) in
- do_run ~display:"subscription-manager register"
- ~warn_failed_no_network:true cmd
-
- | `SMRemove ->
- message (f_"Removing all the subscriptions");
- let cmd = "subscription-manager remove --all" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
-
- | `SMUnregister ->
- message (f_"Unregistering with subscription-manager");
- let cmd = "subscription-manager unregister" in
- do_run ~display:cmd ~warn_failed_no_network:true cmd
-
| `SSHInject (user, selector) ->
if unix_like (g#inspect_get_type root) then (
message (f_"SSH key inject: %s") user;
diff --git a/common/mlcustomize/subscription_manager.ml b/common/mlcustomize/subscription_manager.ml
deleted file mode 100644
index 104602462..000000000
--- a/common/mlcustomize/subscription_manager.ml
+++ /dev/null
@@ -1,54 +0,0 @@
-(* virt-customize
- * Copyright (C) 2015 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-open Std_utils
-open Tools_utils
-open Common_gettext.Gettext
-
-type sm_credentials = {
- sm_username : string;
- sm_password : string;
-}
-
-type sm_pool =
-| PoolAuto
-| PoolId of string
-
-let rec parse_credentials_selector arg =
- parse_credentials_selector_list arg (String.nsplit ":" arg)
-
-and parse_credentials_selector_list orig_arg = function
- | [ username; "password"; password ] ->
- { sm_username = username; sm_password = password }
- | [ username; "file"; filename ] ->
- { sm_username = username; sm_password = read_first_line_from_file filename }
- | _ ->
- error (f_"invalid sm-credentials selector %s; see the man page") orig_arg
-
-let rec parse_pool_selector arg =
- parse_pool_selector_list arg (String.nsplit ":" arg)
-
-and parse_pool_selector_list orig_arg = function
- | [ "auto" ] ->
- PoolAuto
- | [ "pool"; pool ] ->
- PoolId pool
- | [ "file"; filename ] ->
- PoolId (read_first_line_from_file filename)
- | _ ->
- error (f_"invalid sm-attach selector %s; see the man page") orig_arg
diff --git a/common/mlcustomize/subscription_manager.mli b/common/mlcustomize/subscription_manager.mli
deleted file mode 100644
index bb6b92014..000000000
--- a/common/mlcustomize/subscription_manager.mli
+++ /dev/null
@@ -1,34 +0,0 @@
-(* virt-customize
- * Copyright (C) 2015 Red Hat Inc.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *)
-
-type sm_credentials = {
- sm_username : string;
- sm_password : string;
-}
-
-type sm_pool =
-| PoolAuto (** Automatic entitlements. *)
-| PoolId of string (** Specific pool. *)
-
-val parse_credentials_selector : string -> sm_credentials
-(** Parse the selector field in --sm-credentials. Exits if the format
- is not valid. *)
-
-val parse_pool_selector : string -> sm_pool
-(** Parse the selector field in --sm-attach. Exits if the format
- is not valid. *)
diff --git a/common/mlcustomize/v2v-customize-options.pod b/common/mlcustomize/v2v-customize-options.pod
index 0974f4592..f02f05dac 100644
--- a/common/mlcustomize/v2v-customize-options.pod
+++ b/common/mlcustomize/v2v-customize-options.pod
@@ -338,35 +338,6 @@ It cannot delete directories, only regular files.
This is a compatibility option that does nothing.
-=item B<--sm-attach> SELECTOR
-
-Attach to a pool using C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-credentials> SELECTOR
-
-Set the credentials for C<subscription-manager>.
-
-See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of
-the C<SELECTOR> field.
-
-=item B<--sm-register>
-
-Register the guest using C<subscription-manager>.
-
-This requires credentials being set using I<--sm-credentials>.
-
-=item B<--sm-remove>
-
-Remove all the subscriptions from the guest using
-C<subscription-manager>.
-
-=item B<--sm-unregister>
-
-Unregister the guest using C<subscription-manager>.
-
=item B<--ssh-inject> USER[:SELECTOR]
Inject an ssh key so the given C<USER> will be able to log in over
diff --git a/common/mlcustomize/v2v-customize-synopsis.pod b/common/mlcustomize/v2v-customize-synopsis.pod
index 7eb0a941c..4c1a1547b 100644
--- a/common/mlcustomize/v2v-customize-synopsis.pod
+++ b/common/mlcustomize/v2v-customize-synopsis.pod
@@ -7,11 +7,9 @@
[--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST]
[--password USER:SELECTOR] [--root-password SELECTOR]
[--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE]
- [--sm-attach SELECTOR] [--sm-register] [--sm-remove]
- [--sm-unregister] [--ssh-inject USER[:SELECTOR]]
- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE]
- [--truncate FILE] [--truncate-recursive PATH]
- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
- [--write FILE:CONTENT] [--no-logfile]
+ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR]
+ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE]
+ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update]
+ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
- [--selinux-relabel] [--sm-credentials SELECTOR]
+ [--selinux-relabel]

View File

@ -0,0 +1,150 @@
From de70086dbe2eb8a6ec023ebbd0c84489a8719ba1 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 14 Oct 2025 14:16:19 -0400
Subject: [PATCH] pod: Document removal of --sm-* options
Update podcheck.pl to allow for still documenting these
in virt-builder.pod
Signed-off-by: Cole Robinson <crobinso@redhat.com>
(cherry picked from commit 7bad703d724cd976cc3b7760b09af353aab46ff0)
---
builder/virt-builder.pod | 73 +++++++++++++-----------------------
customize/virt-customize.pod | 8 ++++
podcheck.pl | 13 ++++++-
3 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/builder/virt-builder.pod b/builder/virt-builder.pod
index ff0ec250c..f043939ca 100644
--- a/builder/virt-builder.pod
+++ b/builder/virt-builder.pod
@@ -878,53 +878,6 @@ F<C:\Program Files\Guestfs\Firstboot\log.txt>.
=back
-=head2 SUBSCRIPTION-MANAGER
-
-It is possible to automate the registration and attaching of the
-system using C<subscription-manager>. This is typical on
-Red Hat Enterprise Linux guests. There are few options which ease
-this process, avoid executing commands manually and exposing
-passwords on command line.
-
-I<--sm-register> starts the registration process, and requires
-I<--sm-credentials> to be specified; the format of the C<SELECTOR>
-of I<--sm-credentials> is one of the following formats:
-
-=over 4
-
-=item B<--sm-credentials> USER:file:FILENAME
-
-Read the password for the specified C<USER> from F<FILENAME>.
-
-=item B<--sm-credentials> USER:password:PASSWORD
-
-Use the literal string C<PASSWORD> for the specified C<USER>.
-
-=back
-
-I<--sm-attach> attaches the system to subscriptions; the format
-of its C<SELECTOR> is one of the following:
-
-=over 4
-
-=item B<--sm-attach> auto
-
-C<subscription-manager> attaches to the best-fitting subscriptions
-for the system.
-
-=item B<--sm-attach> file:FILENAME
-
-Read the pool ID from F<FILENAME>.
-
-=item B<--sm-attach> pool:POOL
-
-Use the literal string C<POOL> as pool ID.
-
-=back
-
-I<--sm-remove> removes all the subscriptions from the guest, while
-I<--sm-unregister> completely unregister the system.
-
=head2 INSTALLATION PROCESS
When you invoke virt-builder, installation proceeds as follows:
@@ -1764,6 +1717,32 @@ them, which is normal and harmless.
=back
+=head2 DEPRECATED OPTIONS
+
+In version 1.56 the subscription-manager options were removed.
+
+=over 4
+
+=item B<--sm-credentials>
+
+=item B<--sm-register>
+
+Use --run='subscription-manager register --username=USER --password=PASS'
+
+=item B<--sm-unregister>
+
+Use --run='subscription-manager unregister'
+
+=item B<--sm-attach>
+
+Use --run='subscription-manager attach ...'
+
+=item B<--sm-remove>
+
+Use --run='subscription-manager remove --all'
+
+=back
+
=head1 MACHINE READABLE OUTPUT
The I<--machine-readable> option can be used to make the output more
diff --git a/customize/virt-customize.pod b/customize/virt-customize.pod
index fb3d65665..9fee64ebc 100644
--- a/customize/virt-customize.pod
+++ b/customize/virt-customize.pod
@@ -248,6 +248,14 @@ existing ones.
For further details, see L<virt-builder(1)/SELINUX>.
+=head1 DEPRECATED OPTIONS
+
+In version 1.56 the subscription-manager options were removed:
+B<--sm-credentials>, B<--sm-register>, B<--sm-unregister>,
+B<--sm-attach>, B<--sm-remove>
+
+For further details, see L<virt-builder(1)/DEPRECATED OPTIONS>.
+
=head1 EXIT STATUS
This program returns 0 on success, or 1 if there was an error.
diff --git a/podcheck.pl b/podcheck.pl
index 795fe0e9b..047bbf8da 100755
--- a/podcheck.pl
+++ b/podcheck.pl
@@ -203,7 +203,18 @@ my $pod_options_checked = 0;
my %pod_options = ();
$pod_options{$_} = 1 foreach ( $content =~ /^=item.*B<(-[-\w]+)(?:=.*)?>/gm );
-foreach (sort keys %pod_options) {
+
+my %pod_option_exists = ();
+$pod_option_exists{$_} = 1 foreach keys %pod_options;
+
+# Removed from the tool but we still document them
+delete $pod_option_exists{"--sm-credentials"};
+delete $pod_option_exists{"--sm-register"};
+delete $pod_option_exists{"--sm-unregister"};
+delete $pod_option_exists{"--sm-remove"};
+delete $pod_option_exists{"--sm-attach"};
+
+foreach (sort keys %pod_option_exists) {
unless ($ignore{$_}) {
$pod_options_checked++;
unless (exists $tool_option_exists{$_}) {

View File

@ -0,0 +1,31 @@
From 269302e1a500d3cba94194faa258f6b47fef88fb Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 4 Nov 2025 13:04:12 +0000
Subject: [PATCH] test-data/phony-guests: Increase size of Windows image
For testing I tried to upload a very large Windows registry to the
phony Windows image. However because of the 256M limit on the size of
the second partition (and NTFS overhead?) this was not possible.
There's no real penalty to increasing the size of this image since
it's just virtual space, so increase the virtual size to 2G (256M/1.7G
split).
(cherry picked from commit a39ae0b898825970549876738bd465f6a110de7c)
---
test-data/phony-guests/make-windows-img.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 0ec6b4851..e72013c3d 100755
--- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,7 +37,7 @@ fi
# Create a disk image.
guestfish <<EOF
-sparse windows.img-t 512M
+sparse windows.img-t 2G
run
# Format the disk.

View File

@ -0,0 +1,72 @@
From 63df59b34bb0a19f6b1e2821250106691d1945a9 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 3 Nov 2025 15:26:19 +0000
Subject: [PATCH] inspector: Add new <class> field to output of virt-inspector
Rebase common submodule to pick up:
Richard W.M. Jones (1):
structs/structs-print.c: Update this generated file
Fixes: https://issues.redhat.com/browse/RHEL-125955
(cherry picked from commit 53e59d0189dc71d78559478c4924f1a1a994c455)
---
common | 2 +-
inspector/inspector.c | 2 ++
inspector/virt-inspector.rng | 1 +
m4/guestfs-libraries.m4 | 3 ++-
4 files changed, 6 insertions(+), 2 deletions(-)
Submodule common 90399dd18..b54ba2031:
diff --git a/common/structs/structs-print.c b/common/structs/structs-print.c
index bfe007cde..8c376b0ee 100644
--- a/common/structs/structs-print.c
+++ b/common/structs/structs-print.c
@@ -63,7 +63,7 @@ guestfs_int_print_application2_indent (struct guestfs_application2 *application2
fprintf (dest, "%sapp2_source_package: %s%s", indent, application2->app2_source_package, linesep);
fprintf (dest, "%sapp2_summary: %s%s", indent, application2->app2_summary, linesep);
fprintf (dest, "%sapp2_description: %s%s", indent, application2->app2_description, linesep);
- fprintf (dest, "%sapp2_spare1: %s%s", indent, application2->app2_spare1, linesep);
+ fprintf (dest, "%sapp2_class: %s%s", indent, application2->app2_class, linesep);
fprintf (dest, "%sapp2_spare2: %s%s", indent, application2->app2_spare2, linesep);
fprintf (dest, "%sapp2_spare3: %s%s", indent, application2->app2_spare3, linesep);
fprintf (dest, "%sapp2_spare4: %s%s", indent, application2->app2_spare4, linesep);
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 1177f44a4..cccc209d0 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -697,6 +697,8 @@ output_applications (xmlTextWriterPtr xo, char *root)
single_element ("summary", apps->val[i].app2_summary);
if (apps->val[i].app2_description && apps->val[i].app2_description[0])
single_element ("description", apps->val[i].app2_description);
+ if (apps->val[i].app2_class && apps->val[i].app2_class[0])
+ single_element ("class", apps->val[i].app2_class);
} end_element ();
}
} end_element ();
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index 29c5798e1..e30686d4f 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -212,6 +212,7 @@
<optional><element name="source_package"><text/></element></optional>
<optional><element name="summary"><text/></element></optional>
<optional><element name="description"><text/></element></optional>
+ <optional><element name="class"><text/></element></optional>
</element>
</zeroOrMore>
</element>
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 82e62d54f..4ca86161c 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -20,7 +20,8 @@ dnl Any C libraries required by the libguestfs C library (not the daemon).
dnl Of course we need libguestfs.
dnl
dnl We need libguestfs 1.57.1 for guestfs_setfiles.
-PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.1])
+dnl We need libguestfs 1.57.6 for guestfs_inspect_get_applications2 app2_class.
+PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.6])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs
dnl Test if it's GNU or XSI strerror_r.

View File

@ -0,0 +1,52 @@
From c715ed2a3b82ce6cfcd44fbb8a29476621ebe049 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 3 Nov 2025 15:56:56 +0000
Subject: [PATCH] inspector: Add <windows_group_policy/> is Windows GPOs
detected in guest
Fixes: https://issues.redhat.com/browse/RHEL-125955
(cherry picked from commit d56129cfccedd26739ee5b813060e7547d977c53)
---
inspector/inspector.c | 3 +++
inspector/virt-inspector.rng | 1 +
m4/guestfs-libraries.m4 | 1 +
3 files changed, 5 insertions(+)
diff --git a/inspector/inspector.c b/inspector/inspector.c
index cccc209d0..6b5d50157 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -439,6 +439,9 @@ output_root (xmlTextWriterPtr xo, char *root)
if (str)
single_element ("windows_current_control_set", str);
free (str);
+ i = guestfs_inspect_get_windows_group_policy (g, root);
+ if (i > 0)
+ empty_element ("windows_group_policy");
guestfs_pop_error_handler (g);
str = guestfs_inspect_get_hostname (g, root);
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index e30686d4f..90f74cf78 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -35,6 +35,7 @@
<element name="minor_version"><text/></element>
<optional><element name="windows_systemroot"><text/></element></optional>
<optional><element name="windows_current_control_set"><text/></element></optional>
+ <optional><element name="windows_group_policy"><empty/></element></optional>
<optional><ref name="ospackageformat"/></optional>
<optional><ref name="ospackagemanagement"/></optional>
<optional><element name="hostname"><text/></element></optional>
diff --git a/m4/guestfs-libraries.m4 b/m4/guestfs-libraries.m4
index 4ca86161c..02f2281f8 100644
--- a/m4/guestfs-libraries.m4
+++ b/m4/guestfs-libraries.m4
@@ -21,6 +21,7 @@ dnl Of course we need libguestfs.
dnl
dnl We need libguestfs 1.57.1 for guestfs_setfiles.
dnl We need libguestfs 1.57.6 for guestfs_inspect_get_applications2 app2_class.
+dnl We need libguestfs 1.57.6 for guestfs_inspect_get_windows_group_policy
PKG_CHECK_MODULES([LIBGUESTFS], [libguestfs >= 1.57.6])
printf "libguestfs version is "; $PKG_CONFIG --modversion libguestfs

View File

@ -1,4 +1,4 @@
From b5fdf9eac368a1c5df4ddd93ce40884924e6092a Mon Sep 17 00:00:00 2001
From 185264d510814eb1e14c770aa826c82d6a747bb3 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2015 09:28:03 -0400
Subject: [PATCH] RHEL: Reject use of libguestfs-winsupport features except for
@ -11,7 +11,7 @@ edits.
1 file changed, 1 insertion(+)
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 16debd129..1c13ddac3 100755
index e72013c3d..ac661f180 100755
--- a/test-data/phony-guests/make-windows-img.sh
+++ b/test-data/phony-guests/make-windows-img.sh
@@ -37,6 +37,7 @@ fi
@ -19,6 +19,6 @@ index 16debd129..1c13ddac3 100755
# Create a disk image.
guestfish <<EOF
+set-program virt-testing
sparse windows.img-t 512M
sparse windows.img-t 2G
run

View File

@ -1,4 +1,4 @@
From 511de43cdca80381d52360e050bf57f7079f46d6 Mon Sep 17 00:00:00 2001
From b8b3b8b6dbcb5b9ccc382b8a4b779104a4e86b87 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 21 Nov 2022 13:03:22 +0000
Subject: [PATCH] RHEL: builder: Disable opensuse repository

View File

@ -0,0 +1,139 @@
From 6c1ea9c15b78274ea0907aa6a1214c294101aa6a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 26 Jan 2026 15:26:23 +0000
Subject: [PATCH] inspector: For xfs, try to find and print the filesystem
version
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 or libguestfs in general from accessing
those filesystems.
Therefore it's a good idea to be able to tell the XFS filesystem
version and print that in virt-inspector output.
The new output will look like:
<filesystems>
<filesystem dev="/dev/sda2">
<type version="5">xfs</type>
<uuid>35904e42-4e3d-40c7-a4ef-213786c18339</uuid>
</filesystem>
To work this requires libguestfs >= 1.59.2 (with guestfs_xfs_info2).
Older versions of libguestfs, or if we cannot tell the version, will
not have the version attribute.
* = 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-144074
(cherry picked from commit bb210ca4330bc307d972201faf713d4c3c49fc6a)
---
inspector/inspector.c | 54 ++++++++++++++++++++++++++++++++----
inspector/virt-inspector.rng | 9 +++++-
2 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 6b5d50157..fc6b9f0d0 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -569,6 +569,42 @@ output_mountpoints (xmlTextWriterPtr xo, char *root)
} end_element ();
}
+static const char *
+get_filesystem_version (const char *dev, const char *fs_type)
+{
+ const char *version = NULL;
+
+#ifdef GUESTFS_HAVE_XFS_INFO2
+ /* For type=xfs, try to guess the filesystem version. */
+ if (STREQ (fs_type, "xfs")) {
+ CLEANUP_FREE_STRING_LIST char **hash = NULL;
+ size_t i;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ hash = guestfs_xfs_info2 (g, dev);
+ if (hash) {
+ for (i = 0; hash[i] != NULL; i += 2) {
+ if (STREQ (hash[i], "meta-data.crc")) {
+ if (STREQ (hash[i+1], "0"))
+ version = "4";
+ else if (STREQ (hash[i+1], "1"))
+ version = "5";
+ break;
+ }
+ /* If new XFS versions are added in future then we can test
+ * for new fields here ...
+ */
+ }
+ }
+
+ guestfs_pop_error_handler (g);
+ }
+#endif /* GUESTFS_HAVE_XFS_INFO2 */
+
+ return version;
+}
+
static void
output_filesystems (xmlTextWriterPtr xo, char *root)
{
@@ -586,19 +622,25 @@ output_filesystems (xmlTextWriterPtr xo, char *root)
start_element ("filesystems") {
for (i = 0; filesystems[i] != NULL; ++i) {
- str = guestfs_canonical_device_name (g, filesystems[i]);
- if (!str)
+ CLEANUP_FREE char *dev =
+ guestfs_canonical_device_name (g, filesystems[i]);
+ if (!dev)
exit (EXIT_FAILURE);
start_element ("filesystem") {
- attribute ("dev", str);
- free (str);
+ attribute ("dev", dev);
guestfs_push_error_handler (g, NULL, NULL);
str = guestfs_vfs_type (g, filesystems[i]);
- if (str && str[0])
- single_element ("type", str);
+ if (str && str[0]) {
+ const char *version = get_filesystem_version (dev, str);
+ start_element ("type") {
+ if (version)
+ attribute ("version", version);
+ string (str);
+ } end_element ();
+ }
free (str);
str = guestfs_vfs_label (g, filesystems[i]);
diff --git a/inspector/virt-inspector.rng b/inspector/virt-inspector.rng
index 90f74cf78..aeec082ff 100644
--- a/inspector/virt-inspector.rng
+++ b/inspector/virt-inspector.rng
@@ -175,7 +175,14 @@
<element name="filesystem">
<attribute name="dev"><text/></attribute>
<interleave>
- <optional><element name="type"><text/></element></optional>
+ <optional>
+ <element name="type">
+ <optional>
+ <attribute name="version"><text/></attribute>
+ </optional>
+ <text/>
+ </element>
+ </optional>
<optional><element name="label"><text/></element></optional>
<optional><element name="uuid"><text/></element></optional>
</interleave>

View File

@ -0,0 +1,35 @@
From 706d6dfd2a36d1b176f2a64d897b249eeec4d80f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Feb 2026 11:57:33 +0000
Subject: [PATCH] Sort some entries in .gitignore into order
(cherry picked from commit 9d7161da76160b2e5d1f3488b3f0a652554d2077)
---
.gitignore | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index 94f77ac74..023686435 100644
--- a/.gitignore
+++ b/.gitignore
@@ -81,9 +81,9 @@ Makefile.in
/cat/virt-ls
/cat/virt-tail
/config.cache
-/config.log
/config.h
/config.h.in
+/config.log
/config.sh
/config.status
/configure
@@ -112,8 +112,8 @@ Makefile.in
/ocaml-dep.sh
/ocaml-link.sh
/po-docs/*/*.pod
-/podwrapper.pl
/po/*.gmo
+/podwrapper.pl
/resize/.depend
/resize/virt-resize
/run

View File

@ -0,0 +1,35 @@
From c9022d24dbfb5d715668fd810716753d096648f0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 22 Sep 2025 10:58:29 +0100
Subject: [PATCH] build: Add $(NULL) as a convenient list terminator
When building lists of things in Makefiles it's convenient to have a
list terminator to avoid hanging backslash problems. eg:
EXTRA_DIST = \
thing1 \
thing2 \
$(NULL)
Cherry picked from virt-v2v commit 09b86c07bf19beba9ccb8fcca0ebfae34dd56406
(cherry picked from commit dad8c0d3803dcbc91e22ca35c630d9e8a01df81b)
---
common-rules.mk | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common-rules.mk b/common-rules.mk
index 4df1e33f1..7a116c827 100644
--- a/common-rules.mk
+++ b/common-rules.mk
@@ -20,6 +20,10 @@
-include $(top_builddir)/localenv
+# Convenient way to terminate lists in Makefiles, so that we avoid
+# problems with dangling backslashes.
+NULL =
+
# Files that should universally be removed by 'make clean'. Note if
# there is any case in any subdirectory where a file should not be
# removed by 'make clean', it should not be listed here!

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,473 @@
From fb60205807bf7d8ccd7847abdfd532ed54f6614a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Feb 2026 13:17:38 +0000
Subject: [PATCH] filesystems: Optionally display filesystem version
Unlike the recent change to virt-inspector (commit bb210ca433
("inspector: For xfs, try to find and print the filesystem version"))
this does not require the ability to mount the XFS v4 filesystem so it
will work on RHEL 10.
$ virt-filesystems -a rhel-7.0.img --long --fs-version
Name Type VFS Label Size Parent FSVersion
/dev/sda1 filesystem ext4 - 510873600 - -
/dev/sda3 filesystem xfs - 4820303872 - 4
$ virt-filesystems -a rhel-7.3.img --long --fs-version
Name Type VFS Label Size Parent FSVersion
/dev/sda1 filesystem ext4 - 510873600 - -
/dev/sda3 filesystem xfs - 4820303872 - 5
Fixes: https://issues.redhat.com/browse/RHEL-144074
(cherry picked from commit fc61c9439d84fdaab71e1628eb5b95f18ff40ce1)
---
.gitignore | 1 +
filesystems/Makefile.am | 6 +++-
filesystems/filesystems.c | 46 ++++++++++++++++++------
filesystems/utils.c | 60 ++++++++++++++++++++++++++++++++
filesystems/utils.h | 30 ++++++++++++++++
filesystems/virt-filesystems.pod | 12 ++++++-
inspector/Makefile.am | 6 +++-
inspector/inspector.c | 39 ++-------------------
8 files changed, 150 insertions(+), 50 deletions(-)
create mode 100644 filesystems/utils.c
create mode 100644 filesystems/utils.h
diff --git a/.gitignore b/.gitignore
index ed850a20f..0b26da37b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@
stamp-*.pod
.deps
+.dirstamp
.libs
Makefile
Makefile.in
diff --git a/filesystems/Makefile.am b/filesystems/Makefile.am
index 17e3b9c6f..625592ff3 100644
--- a/filesystems/Makefile.am
+++ b/filesystems/Makefile.am
@@ -25,7 +25,11 @@ EXTRA_DIST = \
bin_PROGRAMS = virt-filesystems
-virt_filesystems_SOURCES = filesystems.c
+virt_filesystems_SOURCES = \
+ filesystems.c \
+ utils.c \
+ utils.h \
+ $(NULL)
virt_filesystems_CPPFLAGS = \
-DGUESTFS_NO_DEPRECATED=1 \
diff --git a/filesystems/filesystems.c b/filesystems/filesystems.c
index ecaeb0bb2..e86d92be0 100644
--- a/filesystems/filesystems.c
+++ b/filesystems/filesystems.c
@@ -39,6 +39,7 @@
#include "structs-cleanups.h"
#include "options.h"
#include "display-options.h"
+#include "utils.h"
/* These globals are shared with options.c. */
guestfs_h *g;
@@ -75,7 +76,8 @@ static int output = 0;
#define COLUMN_SIZE 32 /* bytes, or human-readable if -h */
#define COLUMN_PARENTS 64
#define COLUMN_UUID 128 /* if --uuid */
-#define NR_COLUMNS 8
+#define COLUMN_FS_VERSION 256 /* if --fs-version */
+#define NR_COLUMNS 9
static int columns;
static void do_output_title (void);
@@ -111,6 +113,8 @@ usage (int status)
" --extra Display swap and data filesystems\n"
" --filesystems Display mountable filesystems\n"
" --format[=raw|..] Force disk format for -a option\n"
+ " --fs-version|--fs-versions\n"
+ " Add filesystem version to --long output\n"
" -h|--human-readable Human-readable sizes in --long output\n"
" --help Display brief help\n"
" --keys-from-stdin Read passphrases from stdin\n"
@@ -157,6 +161,8 @@ main (int argc, char *argv[])
{ "extra", 0, 0, 0 },
{ "filesystems", 0, 0, 0 },
{ "format", 2, 0, 0 },
+ { "fs-version", 0, 0, 0 },
+ { "fs-versions", 0, 0, 0 },
{ "help", 0, 0, HELP_OPTION },
{ "human-readable", 0, 0, 'h' },
{ "keys-from-stdin", 0, 0, 0 },
@@ -191,6 +197,7 @@ main (int argc, char *argv[])
int no_title = 0; /* --no-title */
int long_mode = 0; /* --long|-l */
int uuid = 0; /* --uuid */
+ int fs_version = 0; /* --fs-version */
int title;
g = guestfs_create ();
@@ -227,6 +234,9 @@ main (int argc, char *argv[])
output |= OUTPUT_FILESYSTEMS_EXTRA;
} else if (STREQ (long_options[option_index].name, "filesystems")) {
output |= OUTPUT_FILESYSTEMS;
+ } else if (STREQ (long_options[option_index].name, "fs-version") ||
+ STREQ (long_options[option_index].name, "fs-versions")) {
+ fs_version = 1;
} else if (STREQ (long_options[option_index].name, "logical-volumes") ||
STREQ (long_options[option_index].name, "logvols") ||
STREQ (long_options[option_index].name, "lvs")) {
@@ -337,6 +347,8 @@ main (int argc, char *argv[])
columns |= COLUMN_MBR;
if (uuid)
columns |= COLUMN_UUID;
+ if (fs_version)
+ columns |= COLUMN_FS_VERSION;
}
/* Display title by default only in long mode. */
@@ -379,7 +391,7 @@ static void do_output_pvs (void);
static void do_output_partitions (void);
static void do_output_blockdevs (void);
-static void write_row (const char *name, const char *type, const char *vfs_type, const char *vfs_label, int mbr_id, int64_t size, char **parents, const char *uuid);
+static void write_row (const char *name, const char *type, const char *vfs_type, const char *vfs_label, int mbr_id, int64_t size, char **parents, const char *uuid, const char *fs_version);
static void write_row_strings (char **strings, size_t len);
static char **no_parents (void);
@@ -410,6 +422,8 @@ do_output_title (void)
headings[len++] = "Parent";
if ((columns & COLUMN_UUID))
headings[len++] = "UUID";
+ if ((columns & COLUMN_FS_VERSION))
+ headings[len++] = "FSVersion";
assert (len <= NR_COLUMNS);
write_row_strings ((char **) headings, len);
@@ -450,13 +464,15 @@ do_output_filesystems (void)
exit (EXIT_FAILURE);
for (i = 0; fses[i] != NULL; i += 2) {
+ const char *fs_type = fses[i+1];
CLEANUP_FREE char *dev = NULL, *vfs_label = NULL, *vfs_uuid = NULL;
+ CLEANUP_FREE char *fs_version = NULL;
CLEANUP_FREE_STRING_LIST char **parents = NULL;
int64_t size = -1;
/* Skip swap and unknown, unless --extra flag was given. */
if (!(output & OUTPUT_FILESYSTEMS_EXTRA) &&
- (STREQ (fses[i+1], "swap") || STREQ (fses[i+1], "unknown")))
+ (STREQ (fs_type, "swap") || STREQ (fs_type, "unknown")))
continue;
dev = guestfs_canonical_device_name (g, fses[i]);
@@ -486,6 +502,12 @@ do_output_filesystems (void)
error (EXIT_FAILURE, errno, "strdup");
}
}
+ if ((columns & COLUMN_FS_VERSION)) {
+ const char *version = get_filesystem_version (g, fses[i], fs_type);
+ fs_version = strdup (version ? version : "");
+ if (fs_version == NULL)
+ error (EXIT_FAILURE, errno, "strdup");
+ }
if ((columns & COLUMN_SIZE)) {
CLEANUP_FREE char *device = guestfs_mountable_device (g, fses[i]);
CLEANUP_FREE char *subvolume = NULL;
@@ -533,7 +555,7 @@ do_output_filesystems (void)
parents = no_parents ();
write_row (dev, "filesystem",
- fses[i+1], vfs_label, -1, size, parents, vfs_uuid);
+ fs_type, vfs_label, -1, size, parents, vfs_uuid, fs_version);
}
}
@@ -573,7 +595,7 @@ do_output_lvs (void)
}
write_row (lvs[i], "lv",
- NULL, NULL, -1, size, (char **) parents, uuid);
+ NULL, NULL, -1, size, (char **) parents, uuid, NULL);
}
}
@@ -601,7 +623,8 @@ do_output_vgs (void)
parents = parents_of_vg (vgs->val[i].vg_name);
write_row (name, "vg",
- NULL, NULL, -1, (int64_t) vgs->val[i].vg_size, parents, uuid);
+ NULL, NULL, -1, (int64_t) vgs->val[i].vg_size, parents, uuid,
+ NULL);
}
}
@@ -649,7 +672,7 @@ do_output_pvs (void)
uuid[32] = '\0';
write_row (dev, "pv",
NULL, NULL, -1, (int64_t) pvs->val[i].pv_size,
- (char **) parents, uuid);
+ (char **) parents, uuid, NULL);
}
}
@@ -715,7 +738,7 @@ do_output_partitions (void)
}
write_row (dev, "partition",
- NULL, NULL, mbr_id, size, (char **) parents, NULL);
+ NULL, NULL, mbr_id, size, (char **) parents, NULL, NULL);
}
}
@@ -749,7 +772,7 @@ do_output_blockdevs (void)
parents = no_parents ();
write_row (dev, "device",
- NULL, NULL, -1, size, parents, NULL);
+ NULL, NULL, -1, size, parents, NULL, NULL);
}
}
@@ -882,7 +905,8 @@ parents_of_vg (char *vg)
static void
write_row (const char *name, const char *type,
const char *vfs_type, const char *vfs_label, int mbr_id,
- int64_t size, char **parents, const char *uuid)
+ int64_t size, char **parents, const char *uuid,
+ const char *fs_version)
{
const char *strings[NR_COLUMNS];
CLEANUP_FREE char *parents_str = NULL;
@@ -930,6 +954,8 @@ write_row (const char *name, const char *type,
}
if ((columns & COLUMN_UUID))
strings[len++] = uuid;
+ if ((columns & COLUMN_FS_VERSION))
+ strings[len++] = fs_version;
assert (len <= NR_COLUMNS);
write_row_strings ((char **) strings, len);
diff --git a/filesystems/utils.c b/filesystems/utils.c
new file mode 100644
index 000000000..9de32f1bd
--- /dev/null
+++ b/filesystems/utils.c
@@ -0,0 +1,60 @@
+/* Utility function used by virt-filesystems and virrt-inspector
+ * Copyright (C) 2026 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include "guestfs.h"
+
+#include "guestfs-utils.h"
+#include "utils.h"
+
+const char *
+get_filesystem_version (guestfs_h *g, const char *dev, const char *fs_type)
+{
+ const char *version = NULL;
+
+#ifdef GUESTFS_HAVE_XFS_INFO2
+ /* For type=xfs, try to guess the filesystem version. */
+ if (STREQ (fs_type, "xfs")) {
+ CLEANUP_FREE_STRING_LIST char **hash = NULL;
+ size_t i;
+
+ guestfs_push_error_handler (g, NULL, NULL);
+
+ hash = guestfs_xfs_info2 (g, dev);
+ if (hash) {
+ for (i = 0; hash[i] != NULL; i += 2) {
+ if (STREQ (hash[i], "meta-data.crc")) {
+ if (STREQ (hash[i+1], "0"))
+ version = "4";
+ else if (STREQ (hash[i+1], "1"))
+ version = "5";
+ break;
+ }
+ /* If new XFS versions are added in future then we can test
+ * for new fields here ...
+ */
+ }
+ }
+
+ guestfs_pop_error_handler (g);
+ }
+#endif /* GUESTFS_HAVE_XFS_INFO2 */
+
+ return version;
+}
diff --git a/filesystems/utils.h b/filesystems/utils.h
new file mode 100644
index 000000000..284f8e1ac
--- /dev/null
+++ b/filesystems/utils.h
@@ -0,0 +1,30 @@
+/* Utility function used by virt-filesystems and virrt-inspector
+ * Copyright (C) 2026 Red Hat Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GUESTFS_FILESYSTEMS_UTILS_H
+#define GUESTFS_FILESYSTEMS_UTILS_H
+
+#include "guestfs.h"
+
+/* For XFS, return the filesystem version (eg. "4" or "5"). This may
+ * return NULL if no filesystem version is known.
+ */
+const char *get_filesystem_version (guestfs_h *g,
+ const char *dev, const char *fs_type);
+
+#endif /* GUESTFS_FILESYSTEMS_UTILS_H */
diff --git a/filesystems/virt-filesystems.pod b/filesystems/virt-filesystems.pod
index 7955d6a84..c72ae3cf7 100644
--- a/filesystems/virt-filesystems.pod
+++ b/filesystems/virt-filesystems.pod
@@ -197,6 +197,14 @@ If you have untrusted raw-format guest disk images, you should use
this option to specify the disk format. This avoids a possible
security problem with malicious guests (CVE-2010-3851).
+=item B<--fs-version>
+
+=item B<--fs-versions>
+
+In I<--long> mode, display the filesystem version. Currently this
+only has any effect for XFS, displaying either C<4> (for XFS v4) or
+C<5> (for XFS v5). XFS v4 support will be removed from Linux in 2030.
+
=item B<-h>
=item B<--human-readable>
@@ -221,7 +229,9 @@ external programs.
Use I<-h> if you want sizes to be displayed in human-readable format.
The default is to show raw numbers of I<bytes>.
-Use I<--uuid> to display UUIDs too.
+Use I<--fs-version> to display filesystem versions.
+
+Use I<--uuid> to display UUIDs.
=item B<--lvs>
diff --git a/inspector/Makefile.am b/inspector/Makefile.am
index 04c608f44..637a10415 100644
--- a/inspector/Makefile.am
+++ b/inspector/Makefile.am
@@ -48,7 +48,10 @@ dist_doc_DATA = \
bin_PROGRAMS = virt-inspector
virt_inspector_SOURCES = \
- inspector.c
+ ../filesystems/utils.c \
+ ../filesystems/utils.h \
+ inspector.c \
+ $(NULL)
virt_inspector_CPPFLAGS = \
-DGUESTFS_NO_DEPRECATED=1 \
@@ -56,6 +59,7 @@ virt_inspector_CPPFLAGS = \
-I$(top_srcdir)/common/utils -I$(top_builddir)/common/utils \
-I$(top_srcdir)/common/structs -I$(top_builddir)/common/structs \
-I$(top_srcdir)/lib -I$(top_builddir)/lib \
+ -I$(top_srcdir)/filesystems -I$(top_builddir)/filesystems \
-I$(top_srcdir)/include \
-I$(top_srcdir)/common/options -I$(top_builddir)/common/options \
-I$(top_srcdir)/fish \
diff --git a/inspector/inspector.c b/inspector/inspector.c
index fc6b9f0d0..be34e8794 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -44,6 +44,7 @@
#include "options.h"
#include "display-options.h"
#include "libxml2-writer-macros.h"
+#include "utils.h"
/* Currently open libguestfs handle. */
guestfs_h *g;
@@ -569,42 +570,6 @@ output_mountpoints (xmlTextWriterPtr xo, char *root)
} end_element ();
}
-static const char *
-get_filesystem_version (const char *dev, const char *fs_type)
-{
- const char *version = NULL;
-
-#ifdef GUESTFS_HAVE_XFS_INFO2
- /* For type=xfs, try to guess the filesystem version. */
- if (STREQ (fs_type, "xfs")) {
- CLEANUP_FREE_STRING_LIST char **hash = NULL;
- size_t i;
-
- guestfs_push_error_handler (g, NULL, NULL);
-
- hash = guestfs_xfs_info2 (g, dev);
- if (hash) {
- for (i = 0; hash[i] != NULL; i += 2) {
- if (STREQ (hash[i], "meta-data.crc")) {
- if (STREQ (hash[i+1], "0"))
- version = "4";
- else if (STREQ (hash[i+1], "1"))
- version = "5";
- break;
- }
- /* If new XFS versions are added in future then we can test
- * for new fields here ...
- */
- }
- }
-
- guestfs_pop_error_handler (g);
- }
-#endif /* GUESTFS_HAVE_XFS_INFO2 */
-
- return version;
-}
-
static void
output_filesystems (xmlTextWriterPtr xo, char *root)
{
@@ -634,7 +599,7 @@ output_filesystems (xmlTextWriterPtr xo, char *root)
str = guestfs_vfs_type (g, filesystems[i]);
if (str && str[0]) {
- const char *version = get_filesystem_version (dev, str);
+ const char *version = get_filesystem_version (g, dev, str);
start_element ("type") {
if (version)
attribute ("version", version);

View File

@ -1,26 +0,0 @@
From 28ecb8693bbded3e1c70c1baa57f3498a6b8127e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 9 Dec 2023 12:59:13 +0000
Subject: [PATCH] Update common submodule
Pick up this bug fix:
mltools/libosinfo-c.c: Fix off-by-one error
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common cd29aee91..0dba002c2:
diff --git a/common/mltools/libosinfo-c.c b/common/mltools/libosinfo-c.c
index 93357fd91..a48c8989f 100644
--- a/common/mltools/libosinfo-c.c
+++ b/common/mltools/libosinfo-c.c
@@ -296,7 +296,7 @@ v2v_osinfo_os_get_device_drivers (value osv)
driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i));
- vi = caml_alloc (6, 0);
+ vi = caml_alloc (7, 0);
str = osinfo_device_driver_get_architecture (driver);
copyv = caml_copy_string (str);
Store_field (vi, 0, copyv);

View File

@ -1,63 +0,0 @@
From 5f9beb89443f84640efc52ee6cd68f7f880fb66b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 19 Jan 2024 13:22:51 +0000
Subject: [PATCH] builder: Add a test of the --chown parameter
Also update the libguestfs common submodule, pulling in this change
from libguestfs:
generator/customize.ml: Split --chown parameter on ':' character
and this patch to common/mltools:
mltools/libosinfo-c.c: Fix off-by-one error
(cherry picked from commit 299dc5ec2a0bdd9adecef75adc6a5eca0dc685b1)
---
builder/test-virt-builder.sh | 4 ++++
common | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/builder/test-virt-builder.sh b/builder/test-virt-builder.sh
index 705788a3c..f839fd7af 100755
--- a/builder/test-virt-builder.sh
+++ b/builder/test-virt-builder.sh
@@ -69,6 +69,7 @@ virt-builder phony-fedora \
--write '/etc/append6:
' \
--append-line '/etc/append6:line2' \
+ --chown 1:1:/etc/append6 \
--firstboot Makefile --firstboot-command 'echo "hello"' \
--firstboot-install "minicom,inkscape"
@@ -112,6 +113,7 @@ echo append5:
cat /etc/append5
echo append6:
cat /etc/append6
+stat /etc/append6 | grep '^[ug]id:'
echo -----
EOF
@@ -154,6 +156,8 @@ append6:
line2
+uid: 1
+gid: 1
-----" ]; then
echo "$0: unexpected output:"
cat test-virt-builder.out
Submodule common 0dba002c2..54869c987:
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 245d9960a..48ee33445 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -157,7 +157,7 @@ let rec argspec () =
let len = String.length arg in
String.sub arg 0 i, String.sub arg (i+1) (len-(i+1))
and split_string_triplet option_name arg =
- match String.nsplit ~max:3 "," arg with
+ match String.nsplit ~max:3 ":" arg with
| [a; b; c] -> a, b, c
| _ ->
error (f_"invalid format for '--%s' parameter, see the man page")

View File

@ -1,47 +0,0 @@
From 76080541ae09c6242e0a162009c5faec3ba94b41 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 29 Feb 2024 21:27:47 +0000
Subject: [PATCH] inspector/inspector.c: Remove extra cases covered by default
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In GCC 14:
inspector.c: In function do_xpath:
inspector.c:770:3: error: case value 5 not in enumerated type xmlXPathObjectType [-Werror=switch]
770 | case XPATH_POINT:
| ^~~~
inspector.c:771:3: error: case value 6 not in enumerated type xmlXPathObjectType [-Werror=switch]
771 | case XPATH_RANGE:
| ^~~~
inspector.c:772:3: error: case value 7 not in enumerated type xmlXPathObjectType [-Werror=switch]
772 | case XPATH_LOCATIONSET:
| ^~~~
We already have a default case here, remove the other cases.
(cherry picked from commit 9d2ac9c9b48bf34f5fc3485303143302ead4cb4f)
---
inspector/inspector.c | 8 --------
1 file changed, 8 deletions(-)
diff --git a/inspector/inspector.c b/inspector/inspector.c
index 73357c7d7..01abfae0c 100644
--- a/inspector/inspector.c
+++ b/inspector/inspector.c
@@ -764,14 +764,6 @@ do_xpath (const char *query)
printf ("\n");
break;
- case XPATH_UNDEFINED: /* grrrrr ... switch-enum is a useless warning */
- case XPATH_BOOLEAN:
- case XPATH_NUMBER:
- case XPATH_POINT:
- case XPATH_RANGE:
- case XPATH_LOCATIONSET:
- case XPATH_USERS:
- case XPATH_XSLT_TREE:
default:
r = (char *) xmlXPathCastToString (xpathObj);
printf ("%s\n", r);

View File

@ -1,42 +0,0 @@
From dbc179ab026897be96651e7f9ca6026a3ebf540d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 29 Feb 2024 21:20:59 +0000
Subject: [PATCH] m4/guestfs-c.m4: Re-add ./configure --enable-werror
Somewhere during removal of gnulib and splitting guestfs-tools from
libguestfs, this option was lost. Re-add it simply by copying the
configure fragment over from libguestfs.
(cherry picked from commit 42426992a292b45611b00fcff42160854db09922)
---
m4/guestfs-c.m4 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/m4/guestfs-c.m4 b/m4/guestfs-c.m4
index bc7e3b2aa..67004d0a1 100644
--- a/m4/guestfs-c.m4
+++ b/m4/guestfs-c.m4
@@ -29,6 +29,23 @@ test "x$U" != "x" && AC_MSG_ERROR([Compiler not ANSI compliant])
AM_PROG_CC_C_O
+AC_ARG_ENABLE([werror],
+ [AS_HELP_STRING([--enable-werror],
+ [turn on lots of GCC warnings (for developers)])],
+ [case $enableval in
+ yes|no) ;;
+ *) AC_MSG_ERROR([bad value $enableval for werror option]) ;;
+ esac
+ gcc_warnings=$enableval],
+ [gcc_warnings=no]
+)
+WARN_CFLAGS="-Wall"
+AC_SUBST([WARN_CFLAGS])
+if test "x$gcc_warnings" = "xyes"; then
+ WERROR_CFLAGS="-Werror"
+fi
+AC_SUBST([WERROR_CFLAGS])
+
# Provide a global place to set CFLAGS. (Note that setting AM_CFLAGS
# is no use because it doesn't override target_CFLAGS).
#---

View File

@ -1,43 +0,0 @@
From 51b0bf74b249ac6646b7e083a678553fc40d44d7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 7 Mar 2024 12:00:45 +0000
Subject: [PATCH] make-fs: Use -S option with -z
Basically the file -z option is broken for distributions that enable
seccomp support in the 'file' command. Turn off seccomp when we know
we'll be using -z.
We hit this before in the libguestfs daemon:
https://github.com/libguestfs/libguestfs/issues/100
It was reported upstream but the fix was rejected:
https://bugs.astron.com/view.php?id=406
See also libguestfs commit 23986d3c4f4d1f9cbac44cc743d3e6af721e4237
("file: Use -S option with -z").
Note this requires file > 5.32. We could make it work for earlier
versions of file with some extra work:
https://listman.redhat.com/archives/libguestfs/2023-September/032613.html
& libguestfs commit c95d8c4cf64142bb707b42c32cf3e1ba3c4a5eb1
Reported-by: Jax Young
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2266201
(cherry picked from commit a706f6f55345b06578fd1ca4af531524dc2131fb)
---
make-fs/make-fs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/make-fs/make-fs.c b/make-fs/make-fs.c
index 7837b61be..b8aebccfb 100644
--- a/make-fs/make-fs.c
+++ b/make-fs/make-fs.c
@@ -457,7 +457,7 @@ estimate_input (const char *input, uint64_t *estimate_rtn, char **ifmt_rtn)
}
else {
argv[0] = "file";
- argv[1] = "-bsLz";
+ argv[1] = "-bsSLz";
argv[2] = input;
argv[3] = NULL;

View File

@ -1,28 +0,0 @@
From cc0ae4acabfc857f2bcee828e725a9d69dab5735 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 12 Mar 2024 09:42:30 +0000
Subject: [PATCH] sysprep: Make clearer that we do not support Windows
Thanks: Dan Kenigsberg
(cherry picked from commit 82c0fb1231c1a9250104cff278f1c67ab482fa4b)
---
sysprep/virt-sysprep.pod | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
index 0bcdc4dec..b48ac55c1 100644
--- a/sysprep/virt-sysprep.pod
+++ b/sysprep/virt-sysprep.pod
@@ -30,10 +30,8 @@ disk image to be writable as the non-root user running virt-sysprep.
"Sysprep" stands for "system preparation" tool. The name comes from
the Microsoft program F<sysprep.exe> which is used to unconfigure
-Windows machines in preparation for cloning them. Having said that,
-virt-sysprep does I<not> currently work on Microsoft Windows guests.
-We plan to support Windows sysprepping in a future version, and we
-already have code to do it.
+Windows machines in preparation for cloning them. (Virt-sysprep does
+not work on Microsoft Windows guests.)
=head1 OPTIONS

View File

@ -1,63 +0,0 @@
From a103e367c4fd6bd073c324253833289f6a8ecc3a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 12 Mar 2024 10:04:34 +0000
Subject: [PATCH] build: Use DISTCLEANFILES for a generated but few rarely
updated files
We rarely change the generated test scripts or the sysprep mli files,
so we only need to delete them in 'make distclean', not 'make clean'.
(cherry picked from commit 35e15c68ac9c4e5361e4cf8a49a60a4bc2708d89)
---
builder/Makefile.am | 4 +++-
customize/Makefile.am | 6 ++++--
sysprep/Makefile.am | 2 +-
3 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/builder/Makefile.am b/builder/Makefile.am
index 42606aaf3..b474f0c9d 100644
--- a/builder/Makefile.am
+++ b/builder/Makefile.am
@@ -412,8 +412,10 @@ test-console-%.sh:
chmod 0755 $@-t
mv $@-t $@
+DISTCLEANFILES += \
+ $(console_test_scripts)
+
CLEANFILES += \
- $(console_test_scripts) \
console-*.img \
console-*.out
diff --git a/customize/Makefile.am b/customize/Makefile.am
index 3a974590f..461629062 100644
--- a/customize/Makefile.am
+++ b/customize/Makefile.am
@@ -285,9 +285,11 @@ test-settings-%.sh:
chmod 0755 $@-t
mv $@-t $@
+DISTCLEANFILES += \
+ $(password_test_scripts) \
+ $(settings_test_scripts)
+
CLEANFILES += \
- $(password_test_scripts) \
- $(settings_test_scripts) \
password-*.img \
password-*.log \
settings-*.img
diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am
index 4b29d4e10..4b1c23ce0 100644
--- a/sysprep/Makefile.am
+++ b/sysprep/Makefile.am
@@ -179,7 +179,7 @@ virt_sysprep_LINK = \
$(OBJECTS) -o $@
# The sysprep_operation_*.mli files are all empty and autogenerated.
-CLEANFILES += \
+DISTCLEANFILES += \
$(patsubst %,sysprep_operation_%.mli,$(operations))
sysprep_operation_%.mli:

View File

@ -1,28 +0,0 @@
From 6ea88c2011b02a47058ba6d89af156983bd52a91 Mon Sep 17 00:00:00 2001
From: Jerry James <loganjerry@gmail.com>
Date: Fri, 12 Apr 2024 20:11:50 +0100
Subject: [PATCH] Fix bytecode compilation to output whole exe instead of using
-custom
These binaries are more resistant to being stripped.
Reported-by: Ilya Leoshkevich
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2274708
(cherry picked from commit c249fd5caca8f1eed439f83e2bb1af46c8a28a27)
---
subdir-rules.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/subdir-rules.mk b/subdir-rules.mk
index 6bd62b653..051dc9d5a 100644
--- a/subdir-rules.mk
+++ b/subdir-rules.mk
@@ -49,7 +49,7 @@ LOG_DRIVER = env $(SHELL) $(top_srcdir)/build-aux/guestfs-test-driver
if !HAVE_OCAMLOPT
MLARCHIVE = cma
-LINK_CUSTOM_OCAMLC_ONLY = -custom
+LINK_CUSTOM_OCAMLC_ONLY = -output-complete-exe
BEST = c
else
MLARCHIVE = cmxa

View File

@ -1,42 +0,0 @@
From 8a942cdd8e6d1aa526844c428660d0bb4ca02770 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 4 Apr 2024 09:38:28 +0100
Subject: [PATCH] po-docs: Run po4a-translate and sed commands separately
I noticed that 1-byte translated POD files were being generated in the
output directory (po-docs/ja/). This seems to have happened because
po4a-translate was generating an error, but because we were
immediately pipeing the output into sed the error was suppressed.
By running them as two separate commands this cannot happen.
Fixes: commit bd896d68c06d7f66303bd77daa666367b0de5f3a
(cherry picked from libguestfs commit d755070346c0498672517c844d7ced52e9263197)
(cherry picked from commit 8c8da80adf8a9e3c350b010b5724a5ae7d9875b6)
---
po-docs/language.mk | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/po-docs/language.mk b/po-docs/language.mk
index b4e3544ca..ba2e36998 100644
--- a/po-docs/language.mk
+++ b/po-docs/language.mk
@@ -101,13 +101,16 @@ virt-sysprep.1: virt-sysprep.pod sysprep-extra-options.pod sysprep-operations.po
# Remove both.
# XXX Fix po4a so it doesn't do this.
%.pod: $(srcdir)/../$(LINGUA).po
+ rm -f $@ $@-t
$(guestfs_am_v_po4a_translate)$(PO4A_TRANSLATE) \
-f pod \
-M utf-8 -L utf-8 \
-k 0 \
-m $(top_srcdir)/$(shell grep -E '/$(basename $@)(\.|$$)' $(top_srcdir)/po-docs/podfiles) \
-p $< \
- | $(SED) '0,/^=encoding/d' > $@
+ -l $@-t
+ $(SED) '0,/^=encoding/d' < $@-t > $@
+ rm $@-t
# XXX Can automake do this properly?
install-data-hook:

View File

@ -1,25 +0,0 @@
From 80806f5438c769b71e92a7669db029f5f243cfce Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 12 Apr 2024 22:06:55 +0100
Subject: [PATCH] po-docs: Remove virt-dib from list of translated man pages
This page no longer exists.
Fixes: commit 57423d907270526ea664ff15601cce956353820e
(cherry picked from commit 2e797d3bb4c8a13305a948e3d87e4eabfd692e17)
---
po-docs/language.mk | 1 -
1 file changed, 1 deletion(-)
diff --git a/po-docs/language.mk b/po-docs/language.mk
index ba2e36998..7328265e6 100644
--- a/po-docs/language.mk
+++ b/po-docs/language.mk
@@ -30,7 +30,6 @@ MANPAGES = \
virt-cat.1 \
virt-customize.1 \
virt-df.1 \
- virt-dib.1 \
virt-diff.1 \
virt-edit.1 \
virt-filesystems.1 \

View File

@ -1,65 +0,0 @@
From d0b1b1eaaebdff2cee004304e9d498cd2a720e23 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 24 Apr 2024 12:23:34 +0100
Subject: [PATCH] Update common submodule
In particular pick this:
commit 93a7f3af5c23ece6a8e092827ed5928a8973fd3c
Author: Richard W.M. Jones <rjones@redhat.com>
Date: Wed Apr 24 12:08:01 2024 +0100
options: Allow nbd+unix:// URIs
(cherry picked from commit 21a507d8aeb2d264863e1fbdfadc0ff44455ffb4)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 54869c987..93a7f3af5:
diff --git a/common/options/uri.c b/common/options/uri.c
index 84d393c1e..9180d6a27 100644
--- a/common/options/uri.c
+++ b/common/options/uri.c
@@ -99,7 +99,7 @@ is_uri (const char *arg)
return 0;
for (p--; p >= arg; p--) {
- if (!c_islower (*p))
+ if (! (c_islower (*p) || *p == '+'))
return 0;
}
@@ -148,7 +148,10 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
}
*/
- *protocol_ret = strdup (uri->scheme);
+ if (STREQ (uri->scheme, "nbd+unix"))
+ *protocol_ret = strdup ("nbd");
+ else
+ *protocol_ret = strdup (uri->scheme);
if (*protocol_ret == NULL) {
perror ("strdup: protocol");
return -1;
@@ -194,7 +197,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret,
if (path && path[0] == '/' &&
(STREQ (uri->scheme, "gluster") ||
STREQ (uri->scheme, "iscsi") ||
- STREQ (uri->scheme, "nbd") ||
+ STRPREFIX (uri->scheme, "nbd") ||
STREQ (uri->scheme, "rbd") ||
STREQ (uri->scheme, "sheepdog")))
path++;
diff --git a/common/progress/progress.c b/common/progress/progress.c
index e4b30663f..5848abd70 100644
--- a/common/progress/progress.c
+++ b/common/progress/progress.c
@@ -123,6 +123,7 @@ progress_bar_init (unsigned flags)
bar->machine_readable = 1;
bar->utf8_mode = 0;
bar->have_terminfo = 0;
+ bar->fp = NULL;
} else {
bar->machine_readable = 0;

View File

@ -1,222 +0,0 @@
From d326f1080aafe32d47b49064099f2e9d7759b2a0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 16 May 2024 12:49:24 +0100
Subject: [PATCH] customize: Implement --inject-blnsvr operation
Also updates the common submodule with the generated changes from
libguestfs, and the implementation of Inject_virtio_win.inject_blnsvr.
(cherry picked from commit 80d258baa49214c8e59b91d6085595c9b989fc0d)
---
common | 2 +-
customize/customize_run.ml | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
Submodule common 93a7f3af5..830cbdcf4:
diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod
index ff93630d8..b2ac57526 100644
--- a/common/mlcustomize/customize-options.pod
+++ b/common/mlcustomize/customize-options.pod
@@ -193,6 +193,18 @@ L<virt-builder(1)/INSTALLING PACKAGES>.
Set the hostname of the guest to C<HOSTNAME>. You can use a
dotted hostname.domainname (FQDN) if you want.
+=item B<--inject-blnsvr> METHOD
+
+Inject the Balloon Server (F<blnsvr.exe>) into a Windows guest.
+This operation also injects a firstboot script so that the Balloon
+Server is installed when the guest boots.
+
+The parameter is the same as used by the I<--inject-virtio-win> operation.
+
+Note that to do a full conversion of a Windows guest from a
+foreign hypervisor like VMware (which involves many other operations)
+you should use the L<virt-v2v(1)> tool instead of this.
+
=item B<--inject-qemu-ga> METHOD
Inject the QEMU Guest Agent into a Windows guest. The guest
diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod
index bb0ce1255..957de8cf2 100644
--- a/common/mlcustomize/customize-synopsis.pod
+++ b/common/mlcustomize/customize-synopsis.pod
@@ -3,16 +3,16 @@
[--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR]
[--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT]
[--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..]
- [--hostname HOSTNAME] [--inject-qemu-ga METHOD]
- [--inject-virtio-win METHOD] [--install PKG,PKG..]
- [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST]
- [--password USER:SELECTOR] [--root-password SELECTOR]
- [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE]
- [--sm-attach SELECTOR] [--sm-register] [--sm-remove]
- [--sm-unregister] [--ssh-inject USER[:SELECTOR]]
- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE]
- [--truncate FILE] [--truncate-recursive PATH]
- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST]
- [--write FILE:CONTENT] [--no-logfile]
+ [--hostname HOSTNAME] [--inject-blnsvr METHOD]
+ [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD]
+ [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR]
+ [--move SOURCE:DEST] [--password USER:SELECTOR]
+ [--root-password SELECTOR] [--run SCRIPT]
+ [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR]
+ [--sm-register] [--sm-remove] [--sm-unregister]
+ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR]
+ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE]
+ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update]
+ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile]
[--password-crypto md5|sha256|sha512] [--no-selinux-relabel]
[--selinux-relabel] [--sm-credentials SELECTOR]
diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml
index 48ee33445..c4d6a77d5 100644
--- a/common/mlcustomize/customize_cmdline.ml
+++ b/common/mlcustomize/customize_cmdline.ml
@@ -61,6 +61,8 @@ and op = [
(* --firstboot-install PKG,PKG.. *)
| `Hostname of string
(* --hostname HOSTNAME *)
+ | `InjectBalloonServer of string
+ (* --inject-blnsvr METHOD *)
| `InjectQemuGA of string
(* --inject-qemu-ga METHOD *)
| `InjectVirtioWin of string
@@ -286,6 +288,12 @@ let rec argspec () =
s_"Set the hostname"
),
Some "HOSTNAME", "Set the hostname of the guest to C<HOSTNAME>. You can use a\ndotted hostname.domainname (FQDN) if you want.";
+ (
+ [ L"inject-blnsvr" ],
+ Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectBalloonServer s) ops),
+ s_"Inject the Balloon Server into a Windows guest"
+ ),
+ Some "METHOD", "Inject the Balloon Server (F<blnsvr.exe>) into a Windows guest.\nThis operation also injects a firstboot script so that the Balloon\nServer is installed when the guest boots.\n\nThe parameter is the same as used by the I<--inject-virtio-win> operation.\n\nNote that to do a full conversion of a Windows guest from a\nforeign hypervisor like VMware (which involves many other operations)\nyou should use the L<virt-v2v(1)> tool instead of this.";
(
[ L"inject-qemu-ga" ],
Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectQemuGA s) ops),
diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli
index 51a156eae..ee62961a1 100644
--- a/common/mlcustomize/customize_cmdline.mli
+++ b/common/mlcustomize/customize_cmdline.mli
@@ -53,6 +53,8 @@ and op = [
(* --firstboot-install PKG,PKG.. *)
| `Hostname of string
(* --hostname HOSTNAME *)
+ | `InjectBalloonServer of string
+ (* --inject-blnsvr METHOD *)
| `InjectQemuGA of string
(* --inject-qemu-ga METHOD *)
| `InjectVirtioWin of string
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index 2a30b2008..4e0ed0e0e 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -24,6 +24,8 @@ open Common_gettext.Gettext
open Regedit
+let re_blnsvr = PCRE.compile ~caseless:true "\\bblnsvr\\.exe$"
+
type t = {
g : Guestfs.guestfs; (** guestfs handle *)
@@ -267,6 +269,18 @@ and inject_qemu_ga t =
configure_qemu_ga t msi_files;
msi_files <> [] (* return true if we found some qemu-ga MSI files *)
+and inject_blnsvr t =
+ let files = copy_blnsvr t in
+ match files with
+ | [] -> false (* Didn't find or install anything. *)
+
+ (* We usually find blnsvr.exe in two locations (drivers/by-os and
+ * drivers/by-driver). Pick the first.
+ *)
+ | blnsvr :: _ ->
+ configure_blnsvr t blnsvr;
+ true
+
and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid =
let ddb_node = g#hivex_node_get_child root "DriverDatabase" in
@@ -351,6 +365,11 @@ and copy_qemu_ga t =
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
+and copy_blnsvr t =
+ copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t)
+ (fun () ->
+ error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
+
(* Copy all files from virtio_win directory/ISO located in [srcdir]
* subdirectory and all its subdirectories to the [destdir]. The directory
* hierarchy is not preserved, meaning all files will be directly in [destdir].
@@ -513,6 +532,10 @@ and virtio_iso_path_matches_qemu_ga t path =
| ("x86_64", "rhev-qga64.msi") -> true
| _ -> false
+(* Find blnsvr for the current Windows version. *)
+and virtio_iso_path_matches_blnsvr t path =
+ virtio_iso_path_matches_guest_os t path && PCRE.matches re_blnsvr path
+
(* Look up in libosinfo for the OS, and copy all the locally
* available files specified as drivers for that OS to the [destdir].
*
@@ -586,3 +609,10 @@ and configure_qemu_ga t files =
Firstboot.add_firstboot_powershell t.g t.root
(sprintf "install-%s.ps1" msi_path) !psh_script;
) files
+
+and configure_blnsvr t blnsvr =
+ let cmd = sprintf "\
+ @echo off\n\
+ echo Installing %s\n\
+ c:\\%s -i\n" blnsvr blnsvr in
+ Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd
diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli
index d14f04973..d273c4dd3 100644
--- a/common/mlcustomize/inject_virtio_win.mli
+++ b/common/mlcustomize/inject_virtio_win.mli
@@ -93,3 +93,11 @@ val inject_qemu_ga : t -> bool
the MSI(s).
Returns [true] iff we were able to inject qemu-ga. *)
+
+val inject_blnsvr : t -> bool
+(** Inject the Balloon Server ([blnsvr.exe]) into a Windows guest.
+
+ A firstboot script is also injected which should install
+ the server by running [blnsvr -i].
+
+ Returns [true] iff we were able to inject the Balloon Server. *)
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index 1314d6e30..1d7c13eaf 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -113,8 +113,8 @@ let run (g : G.guestfs) root (ops : ops) =
Hashtbl.replace passwords user pw
in
- (* Helper function to convert --inject-qemu-ga/--inject-virtio-win
- * method parameter into a virtio-win handle.
+ (* Helper function to convert --inject-blnsvr/--inject-qemu-ga/
+ * --inject-virtio-win method parameter into a virtio-win handle.
*)
let get_virtio_win_handle op meth =
if g#inspect_get_type root <> "windows" then (
@@ -216,6 +216,15 @@ let run (g : G.guestfs) root (ops : ops) =
if not (Hostname.set_hostname g root hostname) then
warning (f_"hostname could not be set for this type of guest")
+ | `InjectBalloonServer meth ->
+ (match get_virtio_win_handle "--inject-blnsvr" meth with
+ | None -> ()
+ | Some t ->
+ if not (Inject_virtio_win.inject_blnsvr t) then
+ warning (f_"--inject-blnsvr: blnsvr.exe not found in \
+ virtio-win source that you specified")
+ )
+
| `InjectQemuGA meth ->
(match get_virtio_win_handle "--inject-qemu-ga" meth with
| None -> ()

View File

@ -1,344 +0,0 @@
From a2faa7d57ea997e4194e95a5ccdf2b9e41376f55 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 6 Aug 2024 08:51:29 +0100
Subject: [PATCH] Update common submodule
Considerable changes have been made in virt-v2v to how powershell
scripts are run in Windows guests, and to qemu-ga installation (also
for Windows). This pulls in the following commits:
Richard W.M. Jones (10):
mlcustomize: firstboot: Use Linux path for Powershell script path
mlcustomize: firstboot: Use powershell.exe instead of path
mlcustomize: firstboot: Use Powershell -NoProfile flag
mlcustomize: Revert delay installation of qemu-ga MSI
mldrivers/linux_kernels.ml: Prefix general information with ^info:
mlcustomize: Use Start-Process -Wait to run qemu-ga installer
mlcustomize: Add Firstboot.firstboot_dir function
mlcustomize: Place powershell scripts into <firstboot_dir>\Temp
mlcustomize: Inject qemu-ga & blnsvr into <firstboot_dir>/Temp
mlcustomize: Write qemu-ga log file name to log.txt
(cherry picked from commit b8d57760ea9c9d3ec7a21ee41d74731ab81173df)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 830cbdcf4..7b84a370e:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 5dc012340..3bbba714d 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -239,7 +239,22 @@ WantedBy=%s
end
module Windows = struct
- let rec install_service (g : Guestfs.guestfs) root =
+ (* Create and return the firstboot directory. *)
+ let create_firstboot_dir (g : Guestfs.guestfs) =
+ let rec loop firstboot_dir firstboot_dir_win = function
+ | [] -> firstboot_dir, firstboot_dir_win
+ | dir :: path ->
+ let firstboot_dir =
+ if firstboot_dir = "" then "/" ^ dir else firstboot_dir // dir in
+ let firstboot_dir_win = firstboot_dir_win ^ "\\" ^ dir in
+ let firstboot_dir = g#case_sensitive_path firstboot_dir in
+ g#mkdir_p firstboot_dir;
+ loop firstboot_dir firstboot_dir_win path
+ in
+ loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"]
+
+ let rec install_service (g : Guestfs.guestfs) root
+ firstboot_dir firstboot_dir_win =
(* Either rhsrvany.exe or pvvxsvc.exe must exist.
*
* (Check also that it's not a dangling symlink but a real file).
@@ -254,20 +269,7 @@ module Windows = struct
error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)")
(virt_tools_data_dir ()) in
- (* Create a directory for firstboot files in the guest. *)
- let firstboot_dir, firstboot_dir_win =
- let rec loop firstboot_dir firstboot_dir_win = function
- | [] -> firstboot_dir, firstboot_dir_win
- | dir :: path ->
- let firstboot_dir =
- if firstboot_dir = "" then "/" ^ dir else firstboot_dir // dir in
- let firstboot_dir_win = firstboot_dir_win ^ "\\" ^ dir in
- let firstboot_dir = g#case_sensitive_path firstboot_dir in
- g#mkdir_p firstboot_dir;
- loop firstboot_dir firstboot_dir_win path
- in
- loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"] in
-
+ (* Create a directory for firstboot scripts in the guest. *)
g#mkdir_p (firstboot_dir // "scripts");
(* Copy pvvxsvc or rhsrvany to the guest. *)
@@ -339,11 +341,25 @@ echo uninstalling firstboot service
"PWD", REG_SZ firstboot_dir_win ];
] in
reg_import reg regedits
- );
-
- firstboot_dir
+ )
end
+let firstboot_dir (g : Guestfs.guestfs) root =
+ let typ = g#inspect_get_type root in
+
+ match typ with
+ | "linux" ->
+ let dir = Linux.firstboot_dir in
+ g#mkdir_p dir;
+ dir, None
+
+ | "windows" ->
+ let dir, dir_win = Windows.create_firstboot_dir g in
+ dir, Some dir_win
+
+ | _ ->
+ error (f_"guest type %s is not supported") typ
+
let script_count = ref 0
let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = 5000) name
@@ -363,7 +379,8 @@ let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = 5000) name
g#chmod 0o755 filename
| "windows", _ ->
- let firstboot_dir = Windows.install_service g root in
+ let firstboot_dir, firstboot_dir_win = Windows.create_firstboot_dir g in
+ Windows.install_service g root firstboot_dir firstboot_dir_win;
let filename = firstboot_dir // "scripts" // filename ^ ".bat" in
g#write filename (String.unix2dos content)
@@ -382,21 +399,18 @@ let add_firstboot_powershell g root ?prio name code =
*)
assert (g#inspect_get_type root = "windows");
- let windows_systemroot = g#inspect_get_windows_systemroot root in
-
- (* Create the temporary directory to put the Powershell file. *)
- let tempdir = sprintf "%s/Temp" windows_systemroot in
+ (* Place the Powershell script into firstboot_dir/Temp *)
+ let firstboot_dir, firstboot_dir_win = Windows.create_firstboot_dir g in
+ let tempdir = sprintf "%s/Temp" firstboot_dir in
g#mkdir_p tempdir;
+
+ let ps_path = sprintf "%s/%s.ps1" tempdir name in
+ let ps_path_win = sprintf "%s\\Temp\\%s.ps1" firstboot_dir_win name in
let code = String.concat "\r\n" code ^ "\r\n" in
- g#write (sprintf "%s/%s" tempdir name) code;
+ g#write ps_path code;
- (* Powershell interpreter. Should we check this exists? XXX *)
- let ps_exe =
- windows_systemroot ^
- "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" in
-
- (* Windows path to the Powershell script. *)
- let ps_path = windows_systemroot ^ "\\Temp\\" ^ name in
-
- let fb = sprintf "%s -ExecutionPolicy ByPass -file %s" ps_exe ps_path in
+ (* Create a regular firstboot bat that just invokes powershell *)
+ let fb =
+ sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file \"%s\""
+ ps_path_win in
add_firstboot_script g root ?prio name fb
diff --git a/common/mlcustomize/firstboot.mli b/common/mlcustomize/firstboot.mli
index 8231af658..34ff06901 100644
--- a/common/mlcustomize/firstboot.mli
+++ b/common/mlcustomize/firstboot.mli
@@ -16,6 +16,23 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*)
+val firstboot_dir : Guestfs.guestfs -> string -> string * string option
+(** [firstboot_dir g root]
+ returns the path of the firstboot directory, creating it in
+ the guest if necessary.
+
+ This returns the name of the directory as a guestfs path, and
+ optionally the name as a Windows path (only for Windows guests).
+
+ For Linux this could be [/usr/lib/virt-sysprep, None]
+
+ For Windows this could be ["/Program Files/Guestfs/Firstboot",
+ Some "C:\Program Files\Guestfs\Firstboot"]
+
+ Additional files that are used during firstboot can be placed
+ in this directory, but be careful not to conflict with files
+ and scripts added by the firstboot process itself. *)
+
val add_firstboot_script : Guestfs.guestfs -> string -> ?prio:int -> string ->
string -> unit
(** [add_firstboot_script g root prio name content] adds a firstboot
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index 4e0ed0e0e..afec1e456 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -263,14 +263,28 @@ let rec inject_virtio_win_drivers ({ g } as t) reg =
}
)
-and inject_qemu_ga t =
- let msi_files = copy_qemu_ga t in
+and inject_qemu_ga ({ g; root } as t) =
+ (* Copy the qemu-ga MSI(s) to the guest. *)
+ let dir, dir_win = Firstboot.firstboot_dir g root in
+ let dir_win = Option.value dir_win ~default:dir in
+ let tempdir = sprintf "%s/Temp" dir in
+ let tempdir_win = sprintf "%s\\Temp" dir_win in
+ g#mkdir_p tempdir;
+
+ let msi_files = copy_qemu_ga t tempdir in
if msi_files <> [] then
- configure_qemu_ga t msi_files;
+ configure_qemu_ga t tempdir_win msi_files;
msi_files <> [] (* return true if we found some qemu-ga MSI files *)
-and inject_blnsvr t =
- let files = copy_blnsvr t in
+and inject_blnsvr ({ g; root } as t) =
+ (* Copy the files to the guest. *)
+ let dir, dir_win = Firstboot.firstboot_dir g root in
+ let dir_win = Option.value dir_win ~default:dir in
+ let tempdir = sprintf "%s/Temp" dir in
+ let tempdir_win = sprintf "%s\\Temp" dir_win in
+ g#mkdir_p tempdir;
+
+ let files = copy_blnsvr t tempdir in
match files with
| [] -> false (* Didn't find or install anything. *)
@@ -278,7 +292,7 @@ and inject_blnsvr t =
* drivers/by-driver). Pick the first.
*)
| blnsvr :: _ ->
- configure_blnsvr t blnsvr;
+ configure_blnsvr t tempdir_win blnsvr;
true
and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid =
@@ -360,13 +374,13 @@ and copy_drivers t driverdir =
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
-and copy_qemu_ga t =
- copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_qemu_ga t)
+and copy_qemu_ga t tempdir =
+ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_qemu_ga t)
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
-and copy_blnsvr t =
- copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t)
+and copy_blnsvr t tempdir =
+ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_blnsvr t)
(fun () ->
error (f_"root directory / is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log."))
@@ -575,44 +589,35 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir =
) driver.Libosinfo.files
with Not_found -> []
-and configure_qemu_ga t files =
+(* Install qemu-ga. [files] is the non-empty list of possible qemu-ga
+ * installers we detected.
+ *)
+and configure_qemu_ga t tempdir_win files =
+ let script = ref [] in
+ let add = List.push_back script in
+
+ add "# Virt-v2v script which installs QEMU Guest Agent";
+ add "";
+ add "# Uncomment this line for lots of debug output.";
+ add "# Set-PSDebug -Trace 2";
+ add "";
+ add "Write-Host Installing QEMU Guest Agent";
+ add "";
+ add "# Run qemu-ga installers";
List.iter (
- fun msi_path ->
- (* Windows is a trashfire.
- * https://stackoverflow.com/a/18730884
- * https://bugzilla.redhat.com/show_bug.cgi?id=1895323
- *)
- let psh_script = ref [] in
- let add = List.push_back psh_script in
+ fun msi ->
+ add (sprintf "Write-Host \"Writing log to %s\\%s.log\""
+ tempdir_win msi);
+ (* [`] is an escape char for quotes *)
+ add (sprintf "Start-Process -Wait -FilePath \"%s\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"`\"%s\\%s.log`\"\""
+ tempdir_win msi tempdir_win msi)
+ ) files;
- add "# Uncomment this line for lots of debug output.";
- add "# Set-PSDebug -Trace 2";
- add "";
- add "Write-Host Removing any previously scheduled qemu-ga installation";
- add "schtasks.exe /Delete /TN Firstboot-qemu-ga /F";
- add "";
- add (sprintf
- "Write-Host Scheduling delayed installation of qemu-ga from %s"
- msi_path);
- add "$d = (get-date).AddSeconds(120)";
- add "$dtfinfo = [System.Globalization.DateTimeFormatInfo]::CurrentInfo";
- add "$sdp = $dtfinfo.ShortDatePattern";
- add "$sdp = $sdp -replace 'y+', 'yyyy'";
- add "$sdp = $sdp -replace 'M+', 'MM'";
- add "$sdp = $sdp -replace 'd+', 'dd'";
- add "schtasks.exe /Create /SC ONCE `";
- add " /ST $d.ToString('HH:mm') /SD $d.ToString($sdp) `";
- add " /RU SYSTEM /TN Firstboot-qemu-ga `";
- add (sprintf " /TR \"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\""
- msi_path msi_path);
+ Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script
- Firstboot.add_firstboot_powershell t.g t.root
- (sprintf "install-%s.ps1" msi_path) !psh_script;
- ) files
-
-and configure_blnsvr t blnsvr =
+and configure_blnsvr t tempdir_win blnsvr =
let cmd = sprintf "\
@echo off\n\
echo Installing %s\n\
- c:\\%s -i\n" blnsvr blnsvr in
- Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd
+ \"%s\\%s\" -i\n" blnsvr tempdir_win blnsvr in
+ Firstboot.add_firstboot_script t.g t.root "install-blnsvr" cmd
diff --git a/common/mldrivers/linux_kernels.ml b/common/mldrivers/linux_kernels.ml
index 23ff76a55..e0b6b8a00 100644
--- a/common/mldrivers/linux_kernels.ml
+++ b/common/mldrivers/linux_kernels.ml
@@ -102,7 +102,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) apps in
if verbose () then (
let names = List.map (fun { G.app2_name = name } -> name) kernel_pkgs in
- eprintf "candidate kernel packages in this guest: %s%!\n"
+ eprintf "info: candidate kernel packages in this guest: %s%!\n"
(String.concat " " names)
);
List.filter_map (
@@ -306,7 +306,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) kernel_pkgs in
if verbose () then (
- eprintf "installed kernel packages in this guest:\n";
+ eprintf "info: installed kernel packages in this guest:\n";
List.iter (print_kernel_info stderr "\t") installed_kernels;
flush stderr
);
@@ -343,7 +343,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps =
) vmlinuzes in
if verbose () then (
- eprintf "kernels offered by the bootloader in this guest (first in list is default):\n";
+ eprintf "info: kernels offered by the bootloader in this guest (first in list is default):\n";
List.iter (print_kernel_info stderr "\t") bootloader_kernels;
flush stderr
);

View File

@ -1,57 +0,0 @@
From 924bf9e6b76fa6c910c1708a20e0716384fbbe07 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 10 Aug 2024 14:17:51 +0100
Subject: [PATCH] Update common submodule
Further refinements to Windows firstboot code.
Richard W.M. Jones (2):
mlcustomize: Add some comments to firstboot batch file
mlcustomize: Reboot Windows between each firstboot script
(cherry picked from commit d7719d6954f48c3a395da7486bcf55fbac66ea07)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 7b84a370e..a78839676:
diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml
index 3bbba714d..52e76401e 100644
--- a/common/mlcustomize/firstboot.ml
+++ b/common/mlcustomize/firstboot.ml
@@ -278,6 +278,9 @@ module Windows = struct
(* Write a firstboot.bat control script which just runs the other
* scripts in the directory. Note we need to use CRLF line endings
* in this script.
+ *
+ * XXX It would be better to use powershell here. For some ideas see
+ * https://github.com/HCK-CI/HLK-Setup-Scripts/
*)
let firstboot_script = sprintf "\
@echo off
@@ -299,6 +302,7 @@ if not exist \"%%scripts_done%%\" (
mkdir \"%%scripts_done%%\"
)
+:: Pick the next script to run.
for %%%%f in (\"%%scripts%%\"\\*.bat) do (
echo running \"%%%%f\"
move \"%%%%f\" \"%%scripts_done%%\"
@@ -307,8 +311,17 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do (
set elvl=!errorlevel!
echo .... exit code !elvl!
popd
+
+ :: Reboot the computer. This is necessary to free any locked
+ :: files which may prevent later scripts from running.
+ shutdown /r /t 0 /y
+
+ :: Exit the script (in case shutdown returns before rebooting).
+ :: On next boot, the whole firstboot service will be called again.
+ exit /b
)
+:: Fallthrough here if there are no scripts.
echo uninstalling firstboot service
\"%%firstboot%%\\%s\" -s firstboot uninstall
" firstboot_dir_win srvany in

View File

@ -1,17 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmV0UtkRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKArQQ/8DR2NMjDy8zyXfLSAoSPcChx+wS36RRhj
rYGSNzD2aNhMzB+WGZHomiW4ahLqj7OAuXQlmpUMjLVsAfyja8aNW7rsnfTM1l5u
p6GS3DFTk34XgVrZO01pEBLWk9blr+xhAFP+qNIwWKv76+xO0QjNa0D5gJvBojZf
J3ct9l1ibKqDh4eG9ReSSUh76WOxm97JwP80ZRBKCpcNJe+fceJGHdBhl5UJFw/N
lAKY+d7MESk9aKZCNy6BRrls6IeIlsOBB8HbG5mXqMv4IfwarB91zZTG9NJRpmSN
MzZ/GIwSCJy9U9hmG3dA/70xFu3HQkshaCisXb4FrzCnlTHZFNCvwdhY2k3qIzZr
PuvsA3ETQqYUj66AlOOD/3TqAu36kFEeeateH75cIiOYfkUUmrO7FF76hY2jNs+q
puTm14dg/MA0OROQv5ykcuN2ukvfsyEsCFao+76am5MG8CViy1tSnL/ZSBN0itLl
jalFbag3GbDCwVt+lpPQbrLDTWNVabAEeN9LlMMcsciIGWDiz99Ntmwe1yxwLLl3
kk8f9xFiWXU7C0yrPY4HzPGNjzklsaNlpzVnqgkWpR1gzpLr37HWx0E1Ct6OlJBJ
7vllv9L9bZErUwyvlSuGcY/6rHd+KnWSS0IBvEfE/eveQErzwgiuGiBUnvGB6NUT
l868E59pb84=
=cEbV
-----END PGP SIGNATURE-----

View File

@ -7,7 +7,7 @@ set -e
# ./copy-patches.sh
project=guestfs-tools
rhel_version=9.5
rhel_version=10.2
# Check we're in the right directory.
if [ ! -f $project.spec ]; then

View File

@ -0,0 +1,17 @@
-----BEGIN PGP SIGNATURE-----
iQJFBAABCgAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmgs7icRHHJpY2hAYW5u
ZXhpYS5vcmcACgkQkXOPc+G3aKAPvg/+K1KSQ7VrdxRkaUhXTVeiuSGGpdF8T+Rs
eROR6WivkbOet0E++EcOHL5fXneQUkXEI0t2tWSG9KRw236xDDsHsQAeA4eLjDJ3
Tl0QaPho8uH4zOOHpw1IWflycJjrvMhdgPxeiI++PfeADPyDfzXTlPMQpJ+WjnJn
y+vousuCZfn4c1SStphMNXCDMoh4XEOKktpICg3DeswwdVb8FVFi4gNr+iI/0QuY
jQUbpZCZnxtgAvAHe7epttxRKQDz2HosHIED0rRYqh9cNtlk34awm6LtQnhPk3Hp
QF3nUy126uISohyd48TWiqCXnzK3+eJmnvxSv0xvTFKm/bXKTidXH25Na/R9o0Df
eE0M1boCuwTaXeO5kOuheJmFcd5NTJHHDF1uSpLtKxABszePYewLwyCTQg/qT2r6
pab4VaLeSdJDJzvDXUwgZlfZflMg49eKMpa87ub0i7MuHkQgddURlkYchfmq/dvR
K1AHYZxRQn8VjYEVEBKIUJDC7q4b54CnOfpwngnGRPTycj/sYOOteFPi3dDL4Wnk
hfosTlGAPlF6g3mT4Jjpev1OzKO6gUBpBIv0e/V2Fow5n9oBRV7fYpWO96KSZXkb
sK2abDZPkvXcZf6gWrWb9ZkELBFgX7vI7DiG19/vO/J70kbjolbzgHUVEvp6i5RU
Q2j56e6XWG0=
=GfAw
-----END PGP SIGNATURE-----

View File

@ -7,19 +7,16 @@
# Verify tarball signature with GPGv2.
%global verify_tarball_signature 1
# If there are patches which touch autotools files, set this to 1.
%global patches_touch_autotools 1
# The source directory.
%global source_directory 1.51-development
%global source_directory 1.54-stable
# Filter perl provides.
%{?perl_default_filter}
Summary: Tools to access and modify virtual machine disk images
Name: guestfs-tools
Version: 1.51.6
Release: 5%{?dist}
Version: 1.54.0
Release: 9%{?dist}
License: GPL-2.0-or-later AND LGPL-2.0-or-later
# Build only for architectures that have a kernel
@ -45,34 +42,41 @@ Source2: libguestfs.keyring
Source3: copy-patches.sh
# Patches are maintained in the following repository:
# https://github.com/rwmjones/guestfs-tools/commits/rhel-9.5
# https://github.com/rwmjones/guestfs-tools/commits/rhel-10.2
# Patches.
Patch0001: 0001-Update-common-submodule.patch
Patch0002: 0002-builder-Add-a-test-of-the-chown-parameter.patch
Patch0003: 0003-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0004: 0004-RHEL-builder-Disable-opensuse-repository.patch
Patch0005: 0005-inspector-inspector.c-Remove-extra-cases-covered-by-.patch
Patch0006: 0006-m4-guestfs-c.m4-Re-add-.-configure-enable-werror.patch
Patch0007: 0007-make-fs-Use-S-option-with-z.patch
Patch0008: 0008-sysprep-Make-clearer-that-we-do-not-support-Windows.patch
Patch0009: 0009-build-Use-DISTCLEANFILES-for-a-generated-but-few-rar.patch
Patch0010: 0010-Fix-bytecode-compilation-to-output-whole-exe-instead.patch
Patch0011: 0011-po-docs-Run-po4a-translate-and-sed-commands-separate.patch
Patch0012: 0012-po-docs-Remove-virt-dib-from-list-of-translated-man-.patch
Patch0001: 0001-docs-Move-release-note-about-GNU-gettext-to-build-se.patch
Patch0002: 0002-builder-Update-link-to-templates-to-use-https.patch
Patch0003: 0003-builder-Replace-cpu-host-with-cpu-max-in-example.patch
Patch0004: 0004-customize-Fixes-for-selinux-relabelling-and-Windows-.patch
Patch0005: 0005-Update-common-submodule.patch
Patch0006: 0006-.gitignore-Ignore-.bak-files.patch
Patch0007: 0007-builder-sysprep-Use-quoted-string-literals-in-a-few-.patch
Patch0008: 0008-builder-templates-make-template.ml-Fix-quoting.patch
Patch0009: 0009-builder-templates-make-template.ml-Use-quoted-string.patch
Patch0010: 0010-builder-templates-make-template.ml-Add-str-and-unix-.patch
Patch0011: 0011-daemon-generator-Use-power-of-2-for-initial-size-of-.patch
Patch0012: 0012-builder-Build-fedora-42-template.patch
Patch0013: 0013-Update-common-submodule.patch
Patch0014: 0014-customize-Implement-inject-blnsvr-operation.patch
Patch0015: 0015-Update-common-submodule.patch
Patch0016: 0016-Update-common-submodule.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool, gettext-devel
%endif
Patch0014: 0014-common-update-submodule.patch
Patch0015: 0015-pod-Document-removal-of-sm-options.patch
Patch0016: 0016-test-data-phony-guests-Increase-size-of-Windows-imag.patch
Patch0017: 0017-inspector-Add-new-class-field-to-output-of-virt-insp.patch
Patch0018: 0018-inspector-Add-windows_group_policy-is-Windows-GPOs-d.patch
Patch0019: 0019-RHEL-Reject-use-of-libguestfs-winsupport-features-ex.patch
Patch0020: 0020-RHEL-builder-Disable-opensuse-repository.patch
Patch0021: 0021-inspector-For-xfs-try-to-find-and-print-the-filesyst.patch
Patch0022: 0022-Sort-some-entries-in-.gitignore-into-order.patch
Patch0023: 0023-build-Add-NULL-as-a-convenient-list-terminator.patch
Patch0024: 0024-Move-virt-filesystems-virt-log-virt-ls-virt-tail-to-.patch
Patch0025: 0025-filesystems-Optionally-display-filesystem-version.patch
# Basic build requirements.
BuildRequires: autoconf, automake, libtool, gettext-devel
BuildRequires: gcc, gcc-c++
BuildRequires: make
BuildRequires: libguestfs-devel >= 1:1.49.8-1
BuildRequires: glibc-utils
BuildRequires: libguestfs-devel >= 1:1.58.1-2
BuildRequires: libguestfs-xfs
BuildRequires: perl(Pod::Simple)
BuildRequires: perl(Pod::Man)
@ -82,7 +86,7 @@ BuildRequires: /usr/bin/pod2text
BuildRequires: po4a
BuildRequires: pcre2-devel
BuildRequires: libxml2-devel
BuildRequires: jansson-devel
BuildRequires: json-c-devel
BuildRequires: libvirt-devel
BuildRequires: libosinfo-devel
BuildRequires: libxcrypt-devel
@ -90,12 +94,10 @@ BuildRequires: ncurses-devel
%ifarch x86_64
BuildRequires: glibc-static
%endif
BuildRequires: ocaml >= 4.08
BuildRequires: ocaml-libguestfs-devel
BuildRequires: ocaml-findlib-devel
BuildRequires: ocaml-gettext-devel
%if !0%{?rhel}
BuildRequires: ocaml-ounit-devel
%endif
BuildRequires: flex
BuildRequires: bison
BuildRequires: xz-devel
@ -120,10 +122,8 @@ BuildRequires: perl-generators
BuildRequires: gnupg2
%endif
# Ensure a minimum version of libguestfs is installed. This contains
# a workaround for openssl bug RHBZ#2133884 and the hang where we
# called setenv between fork and exec.
Requires: libguestfs >= 1.49.6-1
# Ensure a minimum version of libguestfs is installed.
Requires: libguestfs%{?_isa} >= 1:1.58.1-2
# For virt-builder:
Requires: curl
@ -268,13 +268,12 @@ for %{name}.
%setup -q
%autopatch -p1
%if 0%{patches_touch_autotools}
autoreconf -i
%endif
%build
%{configure}
autoreconf -fiv
# Preserve timestamps when copying files. Otherwise, the time of the
# build ends up in the header added by gzip when it compresses files.
%{configure} INSTALL='/usr/bin/install -p'
# Building index-parse.c by hand works around a race condition in the
# autotools cruft, where two or more copies of yacc race with each
@ -422,80 +421,189 @@ end
%changelog
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-5
* Wed Feb 05 2026 Richard W.M. Jones <rjones@redhat.com> - 1.54.0-9
- Synchronize spec file with Fedora
- Fix pnputils after virt-customize --inject-virtio-win
resolves: RHEL-116537
- Unify spec files between Fedora and RHEL.
- Ensure a minimum version of libguestfs is installed at build and run time.
resolves: RHEL-116716
- Remove virt-customize subscription-manager options
resolves: RHEL-122307
- Add AV and GPOs to virt-inspector output
resolves: RHEL-125955
- Expose XFS version in virt-filesystems
resolves: RHEL-144074
* Wed Aug 13 2025 Richard W.M. Jones <rjones@redhat.com> - 1.54.0-3
- Rebase to guestfs-tools 1.54.0
resolves: RHEL-81734
- virt-builder, virt-v2v & other tools with -v and --install causes dnf5 error
resolves: RHEL-83201
- virt-drivers fails on opensuse guest if kernel-source is installed
resolves: RHEL-92604
- builder: Update link to templates to use https
resolves: RHEL-94873
- Fix SELinux relabelling in Linux split-/usr
resolves: RHEL-109129
* Wed Oct 30 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.2-2
- Rebase to guestfs-tools 1.52.2
resolves: RHEL-56812
- Replace Jansson with json-c
resolves: RHEL-65295
* Tue Aug 27 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.1-1
- New stable version 1.52.1
- Rebase on top of patches from RHEL 9.5
- Reboot Windows between each firstboot script to improve reliability
resolves: RHEL-55759
* Thu May 16 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-4
- Add support for nbd+unix:// URIs
resolves: RHEL-33956
resolves: RHEL-56319
- customize: Implement --inject-blnsvr operation
resolves: RHEL-36634
resolves: RHEL-56330
- Add support for nbd+unix:// URIs
resolves: RHEL-56332
* Fri Jan 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-2
- Rebase to guestfs-tools 1.51.6
- Implement --key all:...
resolves: RHEL-19030
- Fix crash because of off-by-one error
resolves: RHEL-19062
- Fix virt-customize --chown invalid format
resolves: RHEL-21899
* Tue Jun 25 2024 Troy Dawson <tdawson@redhat.com> - 1.52.0-6
- Bump release for June 2024 mass rebuild
* Thu Jun 08 2023 Laszlo Ersek <lersek@redhat.com> - 1.50.1-3
- let virt-inspector recognize "--key /dev/mapper/VG-LV:key:password"
- reenable "make check"; we now use "-cpu max" (libguestfs 30f74f38bd6e)
resolves: rhbz#2209280
* Wed Jun 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-5
- OCaml 5.2.0 ppc64le fix
* Thu Apr 06 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.1-1
- Rebase to guestfs-tools 1.50.1
resolves: rhbz#2168626
- Fix virt-drivers inspection of RHEL 9.2 guests
resolves: rhbz#2184963
* Fri May 31 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-4
- Rebuild for OCaml 5.2
* Thu Nov 24 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.2-8
- Support Rocky Linux in virt-customize
resolves: rhbz#2133443
- Disable OpenSUSE repo in virt-builder
resolves: rhbz#2145160
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.52.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 15 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.2-5
- Rebase to guestfs-tools 1.48.2
resolves: rhbz#2059286
- Default to --selinux-relabel in various tools
resolves: rhbz#2075718, rhbz#2089748
- Add lvm system.devices cleanup operation to virt-sysprep
resolves: rhbz#2072493
- Refactor virt-customize --install, --update options in common submodule
- Add support for Clevis & Tang
resolves: rhbz#1809453
- Fix CVE-2022-2211 Denial of Service in --key parameter
resolves: rhbz#2102721
- Fix virt-sysprep and LUKS-on-LVM guests
resolves: rhbz#2106286
* Fri Jan 19 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-2
- Fix virt-customize --chown invalid format error
- New upstream github repository.
* Sat Dec 04 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-6
- Clean up NetworkManager connection files
- Add the copy-patches.sh script from virt-v2v
resolves: rhbz#1980922
* Thu Jan 4 2024 Richard W.M. Jones <rjones@redhat.com> - 1.52.0-1
- New stable version 1.52.0
* Tue Nov 23 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-5
- Fix detection of Kylin Desktop
resolves: rhbz#2025950
* Tue Dec 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.7-1
- New development version 1.51.7
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.46.1-4.1
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Mon Dec 18 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-5
- OCaml 5.1.1 + s390x code gen fix for Fedora 40
* Wed Jun 2 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3.el9.1
* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-4
- Bump release and rebuild
* Tue Dec 12 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-3
- OCaml 5.1.1 rebuild for Fedora 40
* Sat Dec 9 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.6-2
- New development version 1.51.6
* Mon Nov 27 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.5-2
- Fix build for libxml2 2.12.1
* Thu Nov 02 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.5-1
- New development version 1.51.5
* Thu Oct 05 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.4-2
- OCaml 5.1 rebuild for Fedora 40
* Thu Jul 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.4-1
- New development version 1.51.4
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.51.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Jul 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.3-1
- New development version 1.51.3
* Mon Jun 05 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.2-2
- Migrated to SPDX license
* Thu Apr 06 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.2-1
- New development version 1.51.2
* Tue Feb 21 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.1-2
- Fix BR hwdata-devel for PCI IDs data
* Mon Feb 20 2023 Richard W.M. Jones <rjones@redhat.com> - 1.51.1-1
- New development version 1.51.1
- virt-drivers: Add BuildRequires and runtime Recommends on hwdata.
* Tue Feb 14 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.0-2
- Remove virt-dib (RHBZ#2169550)
* Tue Feb 07 2023 Richard W.M. Jones <rjones@redhat.com> - 1.50.0-1
- New upstream stable version 1.50.0
* Thu Jan 26 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.10-1
- New upstream development version 1.49.10
* Thu Jan 19 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.9-1
- New upstream development version 1.49.9
- New tool: virt-drivers
- Add BR glibc-static for tests on x86_64.
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.49.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Tue Jan 17 2023 Richard W.M. Jones <rjones@redhat.com> - 1.49.8-2
- New upstream development version 1.49.8
- +BR libosinfo-devel
* Sat Dec 10 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.7-2
- New upstream development version 1.49.7
* Fri Nov 25 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.6-1
- New upstream development version 1.49.6
- Enable opensuse repository again
* Mon Nov 21 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.5-2
- Disable opensuse repository
* Wed Oct 12 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.5-1
- New upstream development version 1.49.5
* Mon Aug 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.4-1
- New upstream development version 1.49.4
* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.49.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.3-1
- New upstream development version 1.49.3
* Thu May 26 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.2-1
- New upstream development version 1.49.2
* Thu May 12 2022 Richard W.M. Jones <rjones@redhat.com> - 1.49.1-1
- New upstream development version 1.49.1
* Mon Mar 14 2022 Richard W.M. Jones <rjones@redhat.com> - 1.48.0-1
- New upstream stable branch version 1.48.0
* Tue Mar 08 2022 Richard W.M. Jones <rjones@redhat.com> - 1.47.5-1
- New upstream development version 1.47.8
- Add new guestfs-tools-release-notes-1.48(1) man page.
* Tue Mar 01 2022 Richard W.M. Jones <rjones@redhat.com> - 1.47.4-1
- New upstream development version 1.47.4
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.47.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Sat Dec 04 2021 Richard W.M. Jones <rjones@redhat.com> - 1.47.3-1
- New upstream development version 1.47.3
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.47.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed Jun 16 2021 Richard W.M. Jones <rjones@redhat.com> - 1.47.2-1
- New upstream development version 1.47.2
* Wed Jun 2 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3
- Add gating tests (for RHEL 9)
* Mon May 17 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-3
- Fix virt-win-reg --version
resolves: rhbz#1961160
* Thu May 13 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-2
- BR perl-generators so deps of virt-win-reg subpackage are correct.
resolves: rhbz#1960191
* Sat May 08 2021 Richard W.M. Jones <rjones@redhat.com> - 1.46.1-1
- New stable branch version 1.46.1.

2
sources Normal file
View File

@ -0,0 +1,2 @@
SHA512 (guestfs-tools-1.54.0.tar.gz) = db76a1cbfaa8b53b5c4609030f545b9d043161cebf54379da6418800086855f11cb3a0e5d135184c2a885094a6a7120155774377a6641a2d7fbd45206ff9ec87
SHA512 (libguestfs.keyring) = 297a15edc7c220222b9f650e0a9361ae132d3f0fed04aeb2237a1d9c3f6dac6f336846434f66480faed72635a33f659e849b052e74b88d1508aeff03f8c9a2ac