[Libguestfs] [PATCH] v2v: -o libvirt: fix <video> element (RHBZ#1225789)

Pino Toscano ptoscano at redhat.com
Thu Oct 22 12:24:46 UTC 2015


Create the correct tags for <video> in the libvirtxml, so all the
attributes are in a <model> child of <video> instead of <video> itself.

Adapt the XML of test-v2v-i-ova to the different expected XML.
---
 v2v/output_libvirt.ml  | 9 +++++----
 v2v/test-v2v-i-ova.xml | 4 +++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index 0255e15..abdd410 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -223,16 +223,17 @@ let create_libvirt_xml ?pool source target_buses guestcaps
    * missing from the old metadata.
    *)
   let video, graphics =
-    let video, graphics =
+    let video_model, graphics =
       match guestcaps.gcaps_video with
       | QXL ->
-        e "video" [ "type", "qxl"; "ram", "65536" ] [],
+        e "model" [ "type", "qxl"; "ram", "65536" ] [],
         e "graphics" [ "type", "vnc" ] []
       | Cirrus ->
-        e "video" [ "type", "cirrus"; "vram", "9216" ] [],
+        e "model" [ "type", "cirrus"; "vram", "9216" ] [],
         e "graphics" [ "type", "spice" ] [] in
 
-    append_attr ("heads", "1") video;
+    append_attr ("heads", "1") video_model;
+    let video = e "video" [] [ video_model ] in
 
     (match source.s_display with
     | Some { s_keymap = Some km } -> append_attr ("keymap", km) graphics
diff --git a/v2v/test-v2v-i-ova.xml b/v2v/test-v2v-i-ova.xml
index 2eeff83..bb765e3 100644
--- a/v2v/test-v2v-i-ova.xml
+++ b/v2v/test-v2v-i-ova.xml
@@ -33,7 +33,9 @@
       <source network='Ethernet 1'/>
       <model type='virtio'/>
     </interface>
-    <video type='qxl' ram='65536' heads='1'/>
+    <video>
+      <model type='qxl' ram='65536' heads='1'/>
+    </video>
     <graphics type='vnc' autoport='yes' port='-1'/>
     <input type='tablet' bus='usb'/>
     <input type='mouse' bus='ps2'/>
-- 
2.1.0




More information about the Libguestfs mailing list