After sorting kernels to find the best one, print the best kernel if
verbose is enabled.
---
v2v/convert_linux.ml | 10 ++++++++--
v2v/linux_kernels.mli | 4 ++++
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index a65ce99b9..aaa06584f 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -422,8 +422,14 @@ let rec convert (g : G.guestfs) inspect source output rcaps =
let kernels = List.sort compare_best_kernels kernels in
let kernels = List.rev kernels (* so best is first *) in
List.hd kernels in
- if best_kernel <> List.hd bootloader_kernels then
- bootloader#set_default_kernel best_kernel.ki_vmlinuz;
+ if verbose () then (
+ eprintf "best kernel for this guest:\n";
+ print_kernel_info stderr "\t" best_kernel
+ );
+ if best_kernel <> List.hd bootloader_kernels then (
+ debug "best kernel is not the bootloader default, setting bootloader default
...";
+ bootloader#set_default_kernel best_kernel.ki_vmlinuz
+ );
(* Update /etc/sysconfig/kernel DEFAULTKERNEL (RHBZ#1176801). *)
if g#is_file ~followsymlinks:true "/etc/sysconfig/kernel" then (
diff --git a/v2v/linux_kernels.mli b/v2v/linux_kernels.mli
index 3702063d7..394dfd89d 100644
--- a/v2v/linux_kernels.mli
+++ b/v2v/linux_kernels.mli
@@ -49,3 +49,7 @@ val detect_kernels : Guestfs.guestfs -> Types.inspect ->
installed and kernels that the bootloader knows about. The
first kernel in the returned list is the default boot option,
ie. what the guest would boot without interaction or overrides. *)
+
+val print_kernel_info : out_channel -> string -> kernel_info -> unit
+(** Print a kernel_info struct to the given output channel. The
+ second parameter is a prefix for indentation etc. *)
--
2.12.0