[Libguestfs] [PATCH 2/2] v2v: -o libvirt: Preserve source <graphics> type (RHBZ#1312254).

Richard W.M. Jones rjones at redhat.com
Fri Feb 26 10:15:46 UTC 2016


Old virt-v2v changed the <graphics> to VNC if the guest was using the
Cirrus hardware and Spice if the guest used QXL.

In commit 3d1cb74b3eee51c5d015032ad964892be914ea9c I got the logic
backwards, using Spice if the guest used Cirrus and VNC if the guest
used QXL, which obviously makes no sense.

In this commit, I preserve the original <graphics> type from the
source guest.  This has the advantage that the user can use the same
method to access the guest after conversion.  If the source guest had
no <graphics> element, then we force VNC (a safe choice), and if the
source guest is a local disk that we use SDL, but this should only be
used for testing.

Thanks: Xiaodai Wang for the original bug report here:
https://bugzilla.redhat.com/show_bug.cgi?id=1225789#c10
---
 v2v/output_libvirt.ml | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index d1cbaa1..aedde61 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -231,9 +231,14 @@ let create_libvirt_xml ?pool source target_buses guestcaps
     e "video" [] [ video_model ] in
 
   let graphics =
-    match guestcaps.gcaps_video with
-    | QXL ->    e "graphics" [ "type", "vnc" ] []
-    | Cirrus -> e "graphics" [ "type", "spice" ] [] in
+    match source.s_display with
+    | None -> e "graphics" [ "type", "vnc" ] []
+    | Some { s_display_type = Window } ->
+       e "graphics" [ "type", "sdl" ] []
+    | Some { s_display_type = VNC } ->
+       e "graphics" [ "type", "vnc" ] []
+    | Some { s_display_type = Spice } ->
+       e "graphics" [ "type", "spice" ] [] in
 
   (match source.s_display with
    | Some { s_keymap = Some km } -> append_attr ("keymap", km) graphics
-- 
2.5.0




More information about the Libguestfs mailing list