Blob Blame History Raw
From 789017805ad0ddfacfb16d39313ef8b2f8f478ac Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Thu, 6 Jan 2022 15:09:04 +0100
Subject: [PATCH] lib/types: introduce the "gcaps_virtio_1_0" guest capability

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@redhat.com>
Message-Id: <20220106140910.13695-4-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
---
 convert/convert_linux.ml   | 1 +
 convert/convert_windows.ml | 1 +
 lib/types.ml               | 3 +++
 lib/types.mli              | 4 ++++
 4 files changed, 9 insertions(+)

diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index d49ecec0..3f1114ad 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 0ebffb15..30e494ea 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 52db1f9e..50c41918 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;
diff --git a/lib/types.mli b/lib/types.mli
index 02913c0c..0b9b6e25 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? *)
 
-- 
2.31.1