Pino Toscano
2019-Apr-08 16:27 UTC
[Libguestfs] [PATCH] v2v: start reading the new libvirt firmware autoselect
Starting with 5.2.0, libvirt has a way to select automatically the
firmware for a guest using an attribute of the <os> tag. Hence, use
this information (when available, of course) to flag the firmware used
by the guest.
---
v2v/parse_libvirt_xml.ml | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml
index d5d78d367..9cf4c496b 100644
--- a/v2v/parse_libvirt_xml.ml
+++ b/v2v/parse_libvirt_xml.ml
@@ -476,6 +476,13 @@ let parse_libvirt_xml ?conn xml done;
List.rev !nics in
+ (* Firmware. *)
+ let firmware + match xpath_string "/domain/os/@firmware" with
+ | Some "bios" -> BIOS
+ | Some "efi" -> UEFI
+ | None | Some _ -> UnknownFirmware in
+
(* Check for hostdev devices. (RHBZ#1472719) *)
let () let obj = Xml.xpath_eval_expression xpathctx
"/domain/devices/hostdev" in
@@ -502,7 +509,7 @@ let parse_libvirt_xml ?conn xml s_cpu_model =
cpu_model;
s_cpu_topology = cpu_topology;
s_features = features;
- s_firmware = UnknownFirmware; (* XXX until RHBZ#1217444 is fixed *)
+ s_firmware = firmware;
s_display = display;
s_video = video;
s_sound = sound;
--
2.20.1
Richard W.M. Jones
2019-Apr-10 13:23 UTC
Re: [Libguestfs] [PATCH] v2v: start reading the new libvirt firmware autoselect
On Mon, Apr 08, 2019 at 06:27:39PM +0200, Pino Toscano wrote:> Starting with 5.2.0, libvirt has a way to select automatically the > firmware for a guest using an attribute of the <os> tag. Hence, use > this information (when available, of course) to flag the firmware used > by the guest. > --- > v2v/parse_libvirt_xml.ml | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml > index d5d78d367..9cf4c496b 100644 > --- a/v2v/parse_libvirt_xml.ml > +++ b/v2v/parse_libvirt_xml.ml > @@ -476,6 +476,13 @@ let parse_libvirt_xml ?conn xml > done; > List.rev !nics in > > + (* Firmware. *) > + let firmware > + match xpath_string "/domain/os/@firmware" with > + | Some "bios" -> BIOS > + | Some "efi" -> UEFI > + | None | Some _ -> UnknownFirmware in > + > (* Check for hostdev devices. (RHBZ#1472719) *) > let () > let obj = Xml.xpath_eval_expression xpathctx "/domain/devices/hostdev" in > @@ -502,7 +509,7 @@ let parse_libvirt_xml ?conn xml > s_cpu_model = cpu_model; > s_cpu_topology = cpu_topology; > s_features = features; > - s_firmware = UnknownFirmware; (* XXX until RHBZ#1217444 is fixed *) > + s_firmware = firmware;Looks good, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW
Reasonably Related Threads
- [PATCH] v2v: rework handling of CPU topology
- [PATCH 4/4] v2v: Pass CPU vendor, model and topology from source to target.
- [PATCH v3 06/13] v2v: factor out determining the guest firmware
- [PATCH 1/4] v2v: collect source network and video adapter types
- [PATCH v4 1/5] v2v: collect source network and video adapter types