virt-v2v/0030-convert-libosinfo_util...

97 lines
3.7 KiB
Diff

From 61a0a01b1f6166bb03e04ef7dcb23f0559ea08fe Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Tue, 1 Feb 2022 13:32:17 +0100
Subject: [PATCH] convert/libosinfo_utils: debug-log the devices supported by a
driver
While at it, put each file of a driver "pack" on a separate line, and
print "Driver:", "Files:" and "Devices:" headers as well.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2043333
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20220201123219.9317-6-lersek@redhat.com>
(cherry picked from commit 32e3d19e9fe437e957591fa3b18ec981053e9196)
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---
convert/libosinfo_utils.ml | 21 +++++++++++----------
convert/libosinfo_utils.mli | 6 +++---
convert/windows_virtio.ml | 2 +-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml
index 77f22272..f0d70ffd 100644
--- a/convert/libosinfo_utils.ml
+++ b/convert/libosinfo_utils.ml
@@ -33,16 +33,6 @@ let get_os_by_short_id os =
debug "libosinfo: loaded OS: %s" (os#get_id ());
os
-let string_of_osinfo_device_driver { Libosinfo.architecture; location;
- pre_installable; signed; priority;
- files } =
- Printf.sprintf "%s: [%s, %s, %s, priority %Ld] %s"
- location architecture
- (if pre_installable then "pre-installable" else "not pre-installable")
- (if signed then "signed" else "unsigned")
- priority
- (String.concat " " files)
-
let string_of_osinfo_device_list dev_list =
(* Turn the fields of an "osinfo_device" record into a list. *)
@@ -78,6 +68,17 @@ let string_of_osinfo_device_list dev_list =
String.concat "\n"
(List.map (fun dev -> columnate (listify dev) max_widths) dev_list)
+let string_of_osinfo_device_driver { Libosinfo.architecture; location;
+ pre_installable; signed; priority;
+ files; devices } =
+ Printf.sprintf "%s: [%s, %s, %s, priority %Ld]\nFiles:\n%s\nDevices:\n%s"
+ location architecture
+ (if pre_installable then "pre-installable" else "not pre-installable")
+ (if signed then "signed" else "unsigned")
+ priority
+ (String.concat "\n" files)
+ (string_of_osinfo_device_list devices)
+
type os_support = {
q35 : bool;
vio10 : bool;
diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
index ab77ec97..67be16c4 100644
--- a/convert/libosinfo_utils.mli
+++ b/convert/libosinfo_utils.mli
@@ -25,12 +25,12 @@ val get_os_by_short_id : string -> Libosinfo.osinfo_os
Raise [Not_found] in case there is no matching OS.
*)
-val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string
-(** Convert a [osinfo_device_driver] to a printable string for debugging. *)
-
val string_of_osinfo_device_list : Libosinfo.osinfo_device list -> string
(** Convert an [osinfo_device] list to a printable string for debugging. *)
+val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string
+(** Convert a [osinfo_device_driver] to a printable string for debugging. *)
+
type os_support = {
q35 : bool;
vio10 : bool;
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index 1d8b0cb0..3e542631 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -412,7 +412,7 @@ and copy_from_libosinfo g inspect destdir =
let debug_drivers =
List.iter (
fun d ->
- debug "\t%s" (Libosinfo_utils.string_of_osinfo_device_driver d)
+ debug "Driver: %s" (Libosinfo_utils.string_of_osinfo_device_driver d)
)
in
let { i_osinfo = osinfo; i_arch = arch } = inspect in
--
2.19.1.3.g30247aa5d201