On Fri, Jan 28, 2022 at 05:12:16PM +0100, Laszlo Ersek wrote:
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(a)redhat.com>
---
convert/libosinfo_utils.mli | 6 +++---
convert/libosinfo_utils.ml | 21 +++++++++++----------
convert/windows_virtio.ml | 2 +-
3 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
index ab77ec97df30..67be16c491a4 100644
--- a/convert/libosinfo_utils.mli
+++ b/convert/libosinfo_utils.mli
@@ -22,18 +22,18 @@ val get_os_by_short_id : string -> Libosinfo.osinfo_os
(** [get_os_by_short_id short-id] get the [Libosinfo.osinfo_os]
that has the specified [short-id].
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;
}
(** Tell whether the operating system supports the Q35 board type and/or
non-transitional (virtio-1.0-only) virtio devices. (Internally, the
diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml
index 77f22272f979..f0d70ffd4997 100644
--- a/convert/libosinfo_utils.ml
+++ b/convert/libosinfo_utils.ml
@@ -30,22 +30,12 @@ let get_db () =
let get_os_by_short_id os =
let os = (get_db ())#find_os_by_short_id os in
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. *)
let listify { Libosinfo.id; vendor; vendor_id; product; product_id; name;
class_; bus_type; subsystem } =
[ id; vendor; vendor_id; product; product_id; name;
@@ -75,12 +65,23 @@ let string_of_osinfo_device_list dev_list =
* per line, and (b) right-padding each field of each "osinfo_device"
record
* to the maximum width of that field.
*)
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;
}
let os_support_of_osinfo_device_list =
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index 1faba8a874c0..610a56857c7e 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -408,13 +408,13 @@ and virtio_iso_path_matches_qemu_ga path inspect =
* Returns list of copied files.
*)
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
(* The architecture that "inspect.i_arch" from libguestfs
* ("daemon/filearch.ml") calls "i386", the osinfo-db schema
* ("data/schema/osinfo.rng.in") calls "i686".
Yup, as you have no doubt seen, more debugging is better in v2v.
ACK
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top