[Libguestfs] [v2v PATCH 3/9] lib/types: introduce the "gcaps_virtio_1_0" guest capability

Laszlo Ersek lersek at redhat.com
Thu Jan 6 14:09:04 UTC 2022


Add a new field to the "guestcaps" record to track whether the guest
supports the virtio devices that it does at the virtio-1.0 protocol level.

Virt-v2v's current assumption is that virtio-1.0 is supported by any
guest, namely for those virtio devices specifically that the guest
supports -- which in fact may be the empty set. Make this assumption
explicit by setting the new field to "true" in "convert/convert_linux.ml"
and "convert/convert_windows.ml".

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
 lib/types.mli              | 4 ++++
 convert/convert_linux.ml   | 1 +
 convert/convert_windows.ml | 1 +
 lib/types.ml               | 3 +++
 4 files changed, 9 insertions(+)

diff --git a/lib/types.mli b/lib/types.mli
index 02913c0cb4a1..0b9b6e251585 100644
--- a/lib/types.mli
+++ b/lib/types.mli
@@ -270,6 +270,10 @@ type guestcaps = {
   gcaps_machine : guestcaps_machine; (** Machine model. *)
   gcaps_arch : string;          (** Architecture that KVM must emulate. *)
   gcaps_acpi : bool;            (** True if guest supports acpi. *)
+
+  gcaps_virtio_1_0 : bool;
+  (** The guest supports the virtio devices that it does at the virtio-1.0
+      protocol level. *)
 }
 (** Guest capabilities after conversion.  eg. Was virtio found or installed? *)
 
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index d49ecec03aeb..3f1114ad155d 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -155,6 +155,7 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
       gcaps_machine = machine;
       gcaps_arch = Utils.kvm_arch inspect.i_arch;
       gcaps_acpi = acpi;
+      gcaps_virtio_1_0 = true;
     } in
 
     guestcaps
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 0ebffb156633..30e494ea02cb 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -259,6 +259,7 @@ let convert (g : G.guestfs) _ inspect _ static_ips =
       gcaps_machine = machine;
       gcaps_arch = Utils.kvm_arch inspect.i_arch;
       gcaps_acpi = true;
+      gcaps_virtio_1_0 = true;
     } in
 
     guestcaps
diff --git a/lib/types.ml b/lib/types.ml
index 52db1f9e05d0..50c41918b686 100644
--- a/lib/types.ml
+++ b/lib/types.ml
@@ -404,6 +404,7 @@ type guestcaps = {
   gcaps_machine : guestcaps_machine;
   gcaps_arch : string;
   gcaps_acpi : bool;
+  gcaps_virtio_1_0 : bool;
 }
 and guestcaps_block_type = Virtio_blk | IDE
 and guestcaps_net_type = Virtio_net | E1000 | RTL8139
@@ -432,6 +433,7 @@ let string_of_guestcaps gcaps =
            gcaps_machine = %s\n\
            gcaps_arch = %s\n\
            gcaps_acpi = %b\n\
+           gcaps_virtio_1_0 = %b\n\
           "
   (string_of_block_type gcaps.gcaps_block_bus)
   (string_of_net_type gcaps.gcaps_net_bus)
@@ -442,6 +444,7 @@ let string_of_guestcaps gcaps =
   (string_of_machine gcaps.gcaps_machine)
   gcaps.gcaps_arch
   gcaps.gcaps_acpi
+  gcaps.gcaps_virtio_1_0
 
 type target_buses = {
   target_virtio_blk_bus : target_bus_slot array;
-- 
2.19.1.3.g30247aa5d201




More information about the Libguestfs mailing list