Blame SOURCES/0020-v2v-start-reading-the-new-libvirt-firmware-autoselec.patch

da373f
From 3fe15743f316f1576115e30ebd0a512b3667e2f1 Mon Sep 17 00:00:00 2001
3efd08
From: Pino Toscano <ptoscano@redhat.com>
3efd08
Date: Mon, 8 Apr 2019 18:23:27 +0200
3efd08
Subject: [PATCH] v2v: start reading the new libvirt firmware autoselect
3efd08
3efd08
Starting with 5.2.0, libvirt has a way to select automatically the
3efd08
firmware for a guest using an attribute of the <os> tag.  Hence, use
3efd08
this information (when available, of course) to flag the firmware used
3efd08
by the guest.
3efd08
3efd08
(cherry picked from commit fb7983f999004c1f8100776819ea65b21990956d)
3efd08
---
3efd08
 v2v/parse_libvirt_xml.ml | 9 ++++++++-
3efd08
 1 file changed, 8 insertions(+), 1 deletion(-)
3efd08
3efd08
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
3efd08
index b9970cee8..14cd82afd 100644
3efd08
--- a/v2v/parse_libvirt_xml.ml
3efd08
+++ b/v2v/parse_libvirt_xml.ml
3efd08
@@ -476,6 +476,13 @@ let parse_libvirt_xml ?conn xml =
3efd08
     done;
3efd08
     List.rev !nics in
3efd08
 
3efd08
+  (* Firmware. *)
3efd08
+  let firmware =
3efd08
+    match xpath_string "/domain/os/@firmware" with
3efd08
+    | Some "bios" -> BIOS
3efd08
+    | Some "efi" -> UEFI
3efd08
+    | None | Some _ -> UnknownFirmware in
3efd08
+
3efd08
   (* Check for hostdev devices. (RHBZ#1472719) *)
3efd08
   let () =
3efd08
     let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/hostdev" in
3efd08
@@ -520,7 +527,7 @@ let parse_libvirt_xml ?conn xml =
3efd08
     s_cpu_model = cpu_model;
3efd08
     s_cpu_topology = cpu_topology;
3efd08
     s_features = features;
3efd08
-    s_firmware = UnknownFirmware; (* XXX until RHBZ#1217444 is fixed *)
3efd08
+    s_firmware = firmware;
3efd08
     s_display = display;
3efd08
     s_video = video;
3efd08
     s_sound = sound;
3efd08
-- 
da373f
2.18.4
3efd08