Remove LVM2 "devices file" during conversion

resolves: rhbz#2112801
Add support for Zstandard compressed kernel modules
resolves: rhbz#2116811
This commit is contained in:
Richard W.M. Jones 2022-08-10 08:54:35 +01:00
parent ef5fbb5721
commit 2dca36ed01
4 changed files with 108 additions and 4 deletions

View File

@ -138,10 +138,10 @@ index 9bcf104f..66a85542 100644
Similar to [Stdlib.at_exit] but also runs if the program is
- killed with a signal that we can catch. *)
+ killed with a signal that we can catch.
+
+ [?prio] is the priority, default 5000. See the description above. *)
-val unlink : string -> unit
+ [?prio] is the priority, default 5000. See the description above. *)
+
+val unlink : ?prio:int -> string -> unit
(** Unlink a single temporary file on exit. *)

View File

@ -0,0 +1,46 @@
From 83fc438139c49ffae330d5caeece1e52bcb1d18e Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Fri, 5 Aug 2022 10:44:26 +0200
Subject: [PATCH] convert_linux: remove LVM2 "devices file"
A recent feature of LVM2 is the "devices file"
<https://man7.org/linux/man-pages/man8/lvmdevices.8.html>. It speeds up
LVM2 PV discovery on a normal system, but an old devices file in a
converted domain (with different hardware) can prevent the assembly of
volume groups.
In particular, when converting a physical system to a guest with virt-p2v,
the original system will have used "sys_wwid"-type identifiers in the LVM2
devices file, and those are guaranteed not to match any virtio-blk disks
in the output domain.
We've seen a similar issue in the past under RHBZ#1164853, so just extend
the same scrubbing with the new pathname.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2112801
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220805084426.9200-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit 8e4b732e8b4343c169c658338da53fb0ede7e512)
---
convert/convert_linux.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index a66ff1e4..2aaa438e 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -1402,11 +1402,11 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
* device names. blkid will rebuild these on demand.
*
* Delete the LVM cache since it will contain references to the
- * old devices (RHBZ#1164853).
+ * old devices (RHBZ#1164853, RHBZ#2112801).
*)
List.iter g#rm_f [
"/etc/blkid/blkid.tab"; "/etc/blkid.tab";
- "/etc/lvm/cache/.cache"
+ "/etc/lvm/cache/.cache"; "/etc/lvm/devices/system.devices"
];
in

View File

@ -0,0 +1,48 @@
From 380fa6663e9b373d87e446fc03601e9e44f985f6 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 9 Aug 2022 19:09:08 +0100
Subject: [PATCH] convert: linux: Add support for Zstandard compressed kernel
modules
OpenSUSE uses *.ko.zst for kernel modules. This commit adds support
in the same way as the existing support for *.ko.xz. Note this
requires a corresponding change to libguestfs to support Zstandard
compression in the guestfs_file_architecture API:
https://github.com/libguestfs/libguestfs/commit/0e784824e82a88e522873fec5db1a11943d637ed
Reported-by: Xiaodai Wang
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2116811
(cherry picked from commit 315c016dbea899587649a4bbf1865390cb4e1d3c)
---
convert/linux_kernels.ml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/convert/linux_kernels.ml b/convert/linux_kernels.ml
index 307de572..6e9d2bdd 100644
--- a/convert/linux_kernels.ml
+++ b/convert/linux_kernels.ml
@@ -65,8 +65,8 @@ let print_kernel_info chan prefix ki =
ki.ki_supports_isa_pvpanic ki.ki_supports_virtio_socket
ki.ki_is_xen_pv_only_kernel ki.ki_is_debug
-let rex_ko = PCRE.compile "\\.k?o(?:\\.xz)?$"
-let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.xz)?$"
+let rex_ko = PCRE.compile "\\.k?o(?:\\.(?:xz|zst))?$"
+let rex_ko_extract = PCRE.compile "/([^/]+)\\.k?o(?:\\.(?:xz|zst))?$"
let detect_kernels (g : G.guestfs) inspect family bootloader =
(* What kernel/kernel-like packages are installed on the current guest? *)
@@ -203,7 +203,11 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
let all_candidates = List.flatten (
List.map (
fun f ->
- [ "/" ^ f ^ ".o"; "/" ^ f ^ ".ko"; "/" ^ f ^ ".ko.xz" ]
+ [ "/" ^ f ^ ".o";
+ "/" ^ f ^ ".ko";
+ "/" ^ f ^ ".ko.xz";
+ "/" ^ f ^ ".ko.zst";
+ ]
) candidates
) in
let candidate =

View File

@ -16,7 +16,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.0.7
Release: 4%{?dist}
Release: 5%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -64,6 +64,8 @@ Patch0028: 0028-output-Permit-output-modes-to-wait-on-the-local-NBD-.patch
Patch0029: 0029-o-rhv-Wait-for-the-NBD-server-to-exit-to-avoid-a-rac.patch
Patch0030: 0030-output-create_libvirt_xml-relax-VCPU-feature-checkin.patch
Patch0031: 0031-input-xen-cover-RHEL9-OpenSSL-crypto-settings.patch
Patch0032: 0032-convert_linux-remove-LVM2-devices-file.patch
Patch0033: 0033-convert-linux-Add-support-for-Zstandard-compressed-k.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -124,7 +126,7 @@ BuildRequires: nbdkit-python-plugin
BuildRequires: gnupg2
%endif
Requires: libguestfs%{?_isa} >= 1:1.42
Requires: libguestfs%{?_isa} >= 1:1.48.4-2.el9
Requires: guestfs-tools >= 1.42
# XFS is the default filesystem in Fedora and RHEL.
@ -342,12 +344,20 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-in-place.1*
%changelog
* Wed Aug 10 2022 Richard W.M. Jones <rjones@redhat.com> - 1:2.0.7-5
- Remove LVM2 "devices file" during conversion
resolves: rhbz#2112801
- Add support for Zstandard compressed kernel modules
resolves: rhbz#2116811
* Fri Jul 29 2022 Laszlo Ersek <lersek@redhat.com> - 1:2.0.7-4
- Remove legacy crypto advice and replace with targeted mechanism
resolves: rhbz#2062360
* Mon Jul 25 2022 Laszlo Ersek <lersek@redhat.com> - 1:2.0.7-3
- relax qemu64 VCPU feature checking in the libvirt output
resolves rhbz#2107503
* Fri Jul 15 2022 Richard W.M. Jones <rjones@redhat.com> - 1:2.0.7-2
- Rebase to stable branch version 2.0.7
resolves: rhbz#2059287, rhbz#1658126, rhbz#1788823, rhbz#1854275