import virt-v2v-2.2.0-6.el9_2

This commit is contained in:
CentOS Sources 2023-05-09 10:16:00 +00:00 committed by Stepan Oksanichenko
parent ccd5053f6a
commit 7b7bd9216c
14 changed files with 159 additions and 23 deletions

View File

@ -0,0 +1,34 @@
From e7aa456e26e59bfa5cca1299ef2cb5299592d9da Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 5 Apr 2023 17:08:28 +0200
Subject: [PATCH] detect_kernels: tighten "try" scope
We want to catch Not_found from (our own implementation of)
"List.find_map". There's no need (and it makes no sense) to push the
"prefix_len" calculation down into the "try" scope. Keep the "try" scope
as narrow as possible.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175703
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Vera Wu <vwu@redhat.com>
(ported from libguestfs-common commit 4003815a994944cab38d48cfc96f16382de62987)
Message-Id: <20230405150829.171720-2-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
---
convert/linux_kernels.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/convert/linux_kernels.ml b/convert/linux_kernels.ml
index 6e9d2bdd..75ab94c4 100644
--- a/convert/linux_kernels.ml
+++ b/convert/linux_kernels.ml
@@ -122,8 +122,8 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
*)
let modpath, version =
let prefix = "/lib/modules/" in
+ let prefix_len = String.length prefix in
try
- let prefix_len = String.length prefix in
List.find_map (
fun filename ->
let filename_len = String.length filename in

View File

@ -0,0 +1,97 @@
From 9449d21eeae81d4283e74d7cdccf776e695783f0 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 5 Apr 2023 17:08:29 +0200
Subject: [PATCH] detect_kernels: deal with RHEL's kernel-core /
kernel-modules-core split
In "kernel-5.14.0-269.el9", the "kernel-modules-core" subpackage got split
from the "kernel-core" subpackage. Therefore, a single binary RPM
containing *both* the "/boot/vmlinuz-5.14.0-269.el9.x86_64" file *and* the
"/lib/modules/5.14.0-269.el9.x86_64" directory no longer exists. The file
now belongs to "kernel-core", and the directory to "kernel-modules-core".
As a result, when we investigate the file list of "kernel-core" (based on
"kernel-core" providing "/boot/vmlinuz-5.14.0-269.el9.x86_64"), the first
match against "/lib/modules/" is not the actual module root directory
"/lib/modules/5.14.0-269.el9.x86_64", but the nonsensical
"/lib/modules/5.14.0-269.el9.x86_64/.vmlinuz.hmac" regular file. This
latter file is never a directory, therefore we rule out "kernel-core" as a
kernel package.
We also rule out "kernel-modules-core" (even earlier) because it does not
contain "/boot/vmlinuz-5.14.0-269.el9.x86_64".
Now, the code already deals with the case if the prospective kernel
package *does not provide a match* for the "/lib/modules/" prefix: in that
case, we construct the modpath manually, from said prefix, and the version
number found in "/boot/vmlinuz-<version>". This fallback is good, but it's
unreachable if *there is* a candidate, it's just wrong (i.e., not a
directory).
Perform the "is_dir" check on the candidate modpath earlier, so that we
can fall back to the manual modpath construction if the modpath candidate
exists, but is wrong.
With this, the original "is_dir" check becomes superfluous (duplicated)
*except* when the "Not_found" branch is taken. Therefore, hoist the
original "is_dir" check into that branch.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2175703
Reported-by: Vera Wu <vwu@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Vera Wu <vwu@redhat.com>
(ported from libguestfs-common commit 70c10a079a30ff3a84f38596d725a6c5d46e2470)
Message-Id: <20230405150829.171720-3-lersek@redhat.com>
Reviewed-by: Richard W.M. Jones <rjones@redhat.com>
---
convert/linux_kernels.ml | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/convert/linux_kernels.ml b/convert/linux_kernels.ml
index 75ab94c4..d0b31643 100644
--- a/convert/linux_kernels.ml
+++ b/convert/linux_kernels.ml
@@ -124,7 +124,7 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
let prefix = "/lib/modules/" in
let prefix_len = String.length prefix in
try
- List.find_map (
+ let modpath, version = List.find_map (
fun filename ->
let filename_len = String.length filename in
if filename_len > prefix_len &&
@@ -134,17 +134,29 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
Some (filename, version)
) else
None
- ) files
+ ) files in
+ (* Fall back to the version in the vmlinuz file name not only if
+ * a candidate pathname couldn't be found under /lib/modules/,
+ * but also in case the candidate pathname doesn't reference a
+ * directory. See RHBZ#2175703.
+ *
+ * Note that this "is_dir" check is deliberately kept outside of
+ * the "find_map"'s mapper function above: we want the first
+ * candidate *to be* a directory, and not the first candidate
+ * *that is* a directory.
+ *)
+ if not (g#is_dir ~followsymlinks:true modpath) then
+ raise Not_found;
+ modpath, version
with Not_found ->
let version =
String.sub vmlinuz 14 (String.length vmlinuz - 14) in
let modpath = prefix ^ version in
+ (* Check that the modpath exists. *)
+ if not (g#is_dir ~followsymlinks:true modpath) then
+ raise Not_found;
modpath, version in
- (* Check that the modpath exists. *)
- if not (g#is_dir ~followsymlinks:true modpath) then
- raise Not_found;
-
(* Find the initramfs which corresponds to the kernel.
* Since the initramfs is built at runtime, and doesn't have
* to be covered by the RPM file list, this is basically

View File

@ -1,4 +1,4 @@
From 6633c5ca0fe4d37ff4b8ffc62902074fa3b060fb Mon Sep 17 00:00:00 2001
From da3ae25bdd18db8e4330f8b9c4d1c7bbb1f0df39 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 28 Sep 2014 19:14:43 +0100
Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode

View File

@ -1,4 +1,4 @@
From cf636bf489fd5a58f451c9da045cbcb856330bd7 Mon Sep 17 00:00:00 2001
From b638c2083ee9af57d036859e8a807ad56e9e9361 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 30 Sep 2014 10:50:27 +0100
Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option

View File

@ -1,4 +1,4 @@
From a4ed97d92b38d2359475187c7ea3a42596cc4616 Mon Sep 17 00:00:00 2001
From d8a6a0577f0a85387a6acf394f3523674c1b704f Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 24 Apr 2015 09:45:41 -0400
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu

View File

@ -1,4 +1,4 @@
From ef9a020874b82945e07c61198149e3b566612a85 Mon Sep 17 00:00:00 2001
From 94f4aaeea12ac37a5b7515251040ce3e6fd86171 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.

View File

@ -1,4 +1,4 @@
From 5703bf73a706dfc6a65075ff2ed5f544efa2a180 Mon Sep 17 00:00:00 2001
From ffcd5358b8f6e39962edc91aa036089adc4fcdb0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Mar 2017 14:21:37 +0100
Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)

View File

@ -1,4 +1,4 @@
From 4cc16f9bdf58f1036bd6ad67d6af2c0925e32a13 Mon Sep 17 00:00:00 2001
From 907b8c0f9f0aaf3cf5ec71c8371ea252c4acf357 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 8 Mar 2017 11:03:40 +0100
Subject: [PATCH] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)

View File

@ -1,4 +1,4 @@
From f00e06aecd8e2040de6447e05fb721cb1f14720e Mon Sep 17 00:00:00 2001
From ee2bf7286e96419df09d86ddf0eeb31ad869ff92 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 26 Mar 2019 09:42:25 +0100
Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests

View File

@ -1,4 +1,4 @@
From 5ef909eb4d65adb02f6f9170755813e3bd0ebb34 Mon Sep 17 00:00:00 2001
From 2d85522fe7b03207573952a7d95b0f621e3ff52e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH] RHEL: Disable -o glance

View File

@ -1,4 +1,4 @@
From ade0fd71c59b362ae7fd6cc07dd91eda9341eafe Mon Sep 17 00:00:00 2001
From 8fbfb57de81e9962eacc493338aee6162fefb510 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Dec 2021 11:56:05 +0000
Subject: [PATCH] RHEL: Remove the --in-place option

View File

@ -1,4 +1,4 @@
From d6fc11c3f99f2f25b06d36d582d63702be802132 Mon Sep 17 00:00:00 2001
From b04577d80b8933a04b1863727cabefc48d6ae0da Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:56:54 +0100
Subject: [PATCH] RHEL 9: -oo compressed: Remove nbdcopy version check and test

View File

@ -1,4 +1,4 @@
From 86517b17be985cb234846c75680c144bf9ea2dd8 Mon Sep 17 00:00:00 2001
From 462f9b9eb810a5ac26f610d03b601906c9bc674e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 5 Jul 2022 11:58:09 +0100
Subject: [PATCH] RHEL 9: tests: Remove btrfs test

View File

@ -16,7 +16,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.2.0
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -54,17 +54,19 @@ Patch0015: 0015-v2v-Remove-use-of-anchored.patch
Patch0016: 0016-o-kubevirt-Replace-PCRE-anchored-with.patch
Patch0017: 0017-o-libvirt-Add-correct-xmlns-libosinfo-for-Rocky-Linu.patch
Patch0018: 0018-convert-linux-Require-host-cpu-for-all-RHEL-alike-9.patch
Patch0019: 0019-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0020: 0020-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0021: 0021-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0022: 0022-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0023: 0023-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0024: 0024-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0025: 0025-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0026: 0026-RHEL-Disable-o-glance.patch
Patch0027: 0027-RHEL-Remove-the-in-place-option.patch
Patch0028: 0028-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0029: 0029-RHEL-9-tests-Remove-btrfs-test.patch
Patch0019: 0019-detect_kernels-tighten-try-scope.patch
Patch0020: 0020-detect_kernels-deal-with-RHEL-s-kernel-core-kernel-m.patch
Patch0021: 0021-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0022: 0022-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0023: 0023-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0024: 0024-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0025: 0025-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0026: 0026-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0027: 0027-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0028: 0028-RHEL-Disable-o-glance.patch
Patch0029: 0029-RHEL-Remove-the-in-place-option.patch
Patch0030: 0030-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch
Patch0031: 0031-RHEL-9-tests-Remove-btrfs-test.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -353,6 +355,9 @@ done
%changelog
* Sun Apr 09 2023 Laszlo Ersek <lersek@redhat.com> - 1:2.2.0-6
- cope with kernel-core / kernel-modules-core subpackage split in RHEL-9.2 guests
resolves: rhbz#2184970
* Mon Feb 06 2023 Richard W.M. Jones <rjones@redhat.com> - 1:2.2.0-5
- Rebase to virt-v2v 2.2.0
resolves: rhbz#2135762