Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
The first part of the series introduces the "gcaps_virtio_1_0" guest
capability (default value, according to the current virt-v2v assumption:
"true"), and updates the libvirt and JSON outputs to take the new
capability into account.
In the libvirt output, the virtio device models are flipped to -- or are
explicitly introduced as -- virtio-transitional if the machine type is
Q35 and the new "gcaps_virtio_1_0" capability is "false".
In the JSON output, we don't change any device models, only expose the
new capability, and allow CNV / KubeVirt to act upon it. This follows
the spirit of <
https://bugzilla.redhat.com/show_bug.cgi?id=1942325#c11>.
The second part of the series wraps the osinfo_os_get_all_devices()
libosinfo API, and introduces a dependent function to retrieve the guest
OS's support for each of the Q35 chipset and the virtio-1.0 protocol
(extrapolated from support for virtio1.0-net), from the osinfo database.
The final patch in the series couples the two previous parts. The Notes
section of this patch contains extensive test results.
Thanks,
Laszlo
Laszlo Ersek (9):
lib/types: reformat "string_of_guestcaps"
lib/types: update "string_of_guestcaps"
lib/types: introduce the "gcaps_virtio_1_0" guest capability
output/create_libvirt_xml: pick "virtio-transitional" models when
needed
output/create_json: expose "gcaps_virtio_1_0"
convert/libosinfo: wrap osinfo_os_get_all_devices()
convert/libosinfo_utils: introduce "string_of_osinfo_device_list"
convert/libosinfo_utils: introduce "os_support_of_osinfo_device_list"
convert: determine machine type and virtio-1.0 from osinfo for x86
guests
convert/convert_linux.ml | 50 +++++++++------
convert/convert_windows.ml | 31 ++++++---
convert/libosinfo-c.c | 66 ++++++++++++++++++++
convert/libosinfo.ml | 14 +++++
convert/libosinfo.mli | 14 +++++
convert/libosinfo_utils.ml | 54 ++++++++++++++++
convert/libosinfo_utils.mli | 17 +++++
lib/types.ml | 24 +++++--
lib/types.mli | 4 ++
output/create_json.ml | 1 +
output/create_libvirt_xml.ml | 28 ++++++---
tests/test-v2v-cdrom.expected | 2 +-
tests/test-v2v-floppy.expected | 2 +-
tests/test-v2v-i-ova.xml | 8 +--
14 files changed, 266 insertions(+), 49 deletions(-)
base-commit: 07b12fe99fb9cf0b75fe45d3eaa07b4bbc1bbe89
Merged as commit range f9d5448d2efe..f0cea012d018, with the following updates (as
requested by Rich), and with the test suite re-run:
1: 6ffaacdf079a ! 1: dc69bb6033bd lib/types: reformat
"string_of_guestcaps"
@@ -8,6 +8,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-2-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/lib/types.ml b/lib/types.ml
--- a/lib/types.ml
2: 47b1335ef3d6 ! 2: 08786886302c lib/types: update "string_of_guestcaps"
@@ -18,6 +18,8 @@
Fixes: 05f780c16f0135c657615520c2245b42de1efc3e
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-3-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/lib/types.ml b/lib/types.ml
--- a/lib/types.ml
3: 700768d96d72 ! 3: 789017805ad0 lib/types: introduce the
"gcaps_virtio_1_0" guest capability
@@ -13,6 +13,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-4-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/lib/types.mli b/lib/types.mli
--- a/lib/types.mli
4: cb19eff53aaa ! 4: e4cf85bd3ad4 output/create_libvirt_xml: pick
"virtio-transitional" models when needed
@@ -24,6 +24,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-5-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/output/create_libvirt_xml.ml b/output/create_libvirt_xml.ml
--- a/output/create_libvirt_xml.ml
5: f0162a5024a2 ! 5: 511910e1f7e9 output/create_json: expose
"gcaps_virtio_1_0"
@@ -9,6 +9,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-6-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/output/create_json.ml b/output/create_json.ml
--- a/output/create_json.ml
6: c9a39ebc6842 ! 6: 46f5885dba1b convert/libosinfo: wrap
osinfo_os_get_all_devices()
@@ -7,6 +7,9 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-7-lersek(a)redhat.com>
+ [lersek(a)redhat.com: call OCaml values "<something>v" (Rich)]
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/convert/libosinfo.mli b/convert/libosinfo.mli
--- a/convert/libosinfo.mli
@@ -115,12 +118,12 @@
+v2v_osinfo_os_get_all_devices (value osv)
+{
+ CAMLparam1 (osv);
-+ CAMLlocal3 (retval, link, props);
++ CAMLlocal3 (retvalv, linkv, propsv);
+ g_autoptr (OsinfoDeviceList) dev_list = NULL;
+ OsinfoList *ent_list;
+ gint ent_nr;
+
-+ retval = Val_emptylist;
++ retvalv = Val_emptylist;
+ dev_list = osinfo_os_get_all_devices (OsinfoOs_t_val (osv), NULL);
+ ent_list = OSINFO_LIST (dev_list);
+ ent_nr = osinfo_list_get_length (ent_list);
@@ -132,21 +135,21 @@
+ --ent_nr;
+ ent = osinfo_list_get_nth (ent_list, ent_nr);
+
-+ props = caml_alloc (NUM_DEVICE_PROPS, 0);
++ propsv = caml_alloc (NUM_DEVICE_PROPS, 0);
+ for (prop_nr = 0; prop_nr < NUM_DEVICE_PROPS; ++prop_nr) {
+ const gchar *prop_val;
+
+ prop_val = osinfo_entity_get_param_value (ent, device_prop[prop_nr]);
+ if (prop_val == NULL)
+ prop_val = "";
-+ Store_field (props, prop_nr, caml_copy_string (prop_val));
++ Store_field (propsv, prop_nr, caml_copy_string (prop_val));
+ }
+
-+ link = caml_alloc (2, 0);
-+ Store_field (link, 0, props);
-+ Store_field (link, 1, retval);
-+ retval = link;
++ linkv = caml_alloc (2, 0);
++ Store_field (linkv, 0, propsv);
++ Store_field (linkv, 1, retvalv);
++ retvalv = linkv;
+ }
+
-+ CAMLreturn (retval);
++ CAMLreturn (retvalv);
+}
7: beb6d02a55bf ! 7: 00473c6ac09d convert/libosinfo_utils: introduce
"string_of_osinfo_device_list"
@@ -9,6 +9,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-8-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
--- a/convert/libosinfo_utils.mli
8: 1f37f5440d66 ! 8: 2a2d7e9e1376 convert/libosinfo_utils: introduce
"os_support_of_osinfo_device_list"
@@ -13,6 +13,10 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-9-lersek(a)redhat.com>
+ [lersek(a)redhat.com: don't break "in" to a new line after a
"let" that
+ defines a non-function (Rich)]
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli
--- a/convert/libosinfo_utils.mli
@@ -57,8 +61,7 @@
+ accu
+ | { q35; vio10 }, { Libosinfo.id } :: tail ->
+ let q35 = q35 || id = "http://qemu.org/chipset/x86/q35"
-+ and vio10 = vio10 || id = "http://pcisig.com/pci/1af4/1041"
-+ in
++ and vio10 = vio10 || id = "http://pcisig.com/pci/1af4/1041" in
+ next { q35; vio10 } tail
+ in
+ next { q35 = false; vio10 = false }
9: 0ba32aed5e96 ! 9: f0cea012d018 convert: determine machine type and virtio-1.0 from
osinfo for x86 guests
@@ -16,6 +16,8 @@
Bugzilla:
https://bugzilla.redhat.com/show_bug.cgi?id=1942325
Signed-off-by: Laszlo Ersek <lersek(a)redhat.com>
+ Message-Id: <20220106140910.13695-10-lersek(a)redhat.com>
+ Acked-by: Richard W.M. Jones <rjones(a)redhat.com>
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
--- a/convert/convert_linux.ml
I'll follow up with the "explicit temporaries" patch later.
Thanks!
Laszlo