Bug 1372671

Summary: Graphics type of guest become sdl after converted by virt-v2v -i disk
Product: Red Hat Enterprise Linux 7 Reporter: tingting zheng <tzheng>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 7.3CC: juzhou, kuwei, mxie, mzhan, ptoscano, rjones, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.36.2-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 22:08:55 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
v2v log file none

Description tingting zheng 2016-09-02 10:42:52 UTC
Created attachment 1197116 [details]
v2v log file

Description:
Graphics type of guest become sdl after converted by virt-v2v -i disk

Version:
virt-v2v-1.32.7-3.el7.x86_64
libvirt-2.0.0-6.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Prepare a guest with spice graphics type,in my case the image is Auto-kvm-rhel6.7-sparseraw.img.
2.Use virt-v2v -i disk to convert the disk.
# virt-v2v -i disk Auto-kvm-rhel6.7-sparseraw.img -os test -v -x |& tee > /tmp/v2v-disk.log

3.Check the xml file of the guest,the graphics type become sdl which is not supported on rhel7.
# virsh dumpxml Auto-kvm-rhel6.7-sparseraw
    <graphics type='sdl'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

4.After conversion,try to boot the guest.
# virsh start Auto-kvm-rhel6.7-sparseraw
error: Failed to start domain Auto-kvm-rhel6.7-sparseraw
error: internal error: process exited while connecting to monitor: ac=52:54:00:74:d8:99,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0,bus=usb.0,port=1 -sdl -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,bus=pci.0,addr=0x2 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5 -msg timestamp=on
libust[26914/26914]: Warning: HOME environment variable not set. Disabling LTTng-UST per-user tracing. (in setup_local_apps() at lttng-ust-comm.c:305)
qemu-kvm: -sdl: SDL support is disabled


Actual results:
As description.

Expected results:
The graphics type become spice or vnc which is supported on rhel7.

Additional info:
Attached the log file.

Comment 1 Richard W.M. Jones 2016-09-02 11:26:16 UTC
This isn't really a bug.  Using -i disk causes virt-v2v to guess
some basic metadata about the guest.  If you have actual metadata
(eg. libvirt XML) then you should use the -i libvirtxml method instead
(or in this case -i libvirt, since the guest comes from libvirt).

https://github.com/libguestfs/libguestfs/blob/master/v2v/input_disk.ml#L95-L110

Comment 2 tingting zheng 2016-09-05 10:25:55 UTC
(In reply to Richard W.M. Jones from comment #1)
> This isn't really a bug.  Using -i disk causes virt-v2v to guess
> some basic metadata about the guest.  If you have actual metadata
> (eg. libvirt XML) then you should use the -i libvirtxml method instead
> (or in this case -i libvirt, since the guest comes from libvirt).
> 
> https://github.com/libguestfs/libguestfs/blob/master/v2v/input_disk.ml#L95-
> L110

Yes,when I use -i libvirt or -i libvirtxml,it can keep the original graphics type.

For -i disk,it causes virt-v2v to guess some basic metadata about the guest,for graphics,sdl is deprecated on both rhel6 and rhel7,so for -i libvirt,if the original guest has graphics type as sdl,v2v change it to vnc or spice which are supported on rhel6/rhel7.

Can we just deal with the same way for -i disk with -i libvirt?

Comment 3 Richard W.M. Jones 2016-09-06 08:57:24 UTC
I suppose we can change the default *downstream*.

diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml
index 3926602..9599178 100644
--- a/v2v/input_disk.ml
+++ b/v2v/input_disk.ml
@@ -100,7 +100,7 @@ class input_disk input_format disk = object
       s_features = [ "acpi"; "apic"; "pae" ];
       s_firmware = UnknownFirmware;       (* causes virt-v2v to autodetect *)
       s_display =
-        Some { s_display_type = Window; s_keymap = None; s_password = None;
+        Some { s_display_type = VNC; s_keymap = None; s_password = None;
                s_listen = LNone; s_port = None };
       s_video = None;
       s_sound = None;

Comment 4 Pino Toscano 2016-09-20 10:52:57 UTC
*** Bug 1365831 has been marked as a duplicate of this bug. ***

Comment 5 kuwei@redhat.com 2017-02-17 07:39:10 UTC
I can reproduce the bug with below builds:
virt-v2v-1.32.7-3.el7.x86_64
libvirt-2.0.0-10.el7.x86_64

Reproduce steps:
1.Prepare a guest with spice graphics type.
2.Use virt-v2v -i disk to convert the disk.
## virt-v2v -i disk  /var/lib/libvirt/images/rhel7.2.qcow2  -on rhel72
[   0.0] Opening the source -i disk /var/lib/libvirt/images/rhel7.2.qcow2
[   0.1] Creating an overlay to protect the source from being modified
[   0.5] Initializing the target -o libvirt -os default
[   0.5] Opening the overlay
[   5.0] Inspecting the overlay
[  14.1] Checking for sufficient free disk space in the guest
[  14.1] Estimating space required on target for each disk
[  14.1] Converting Red Hat Enterprise Linux Server 7.2 (Maipo) to run on KVM
virt-v2v: warning: /files/boot/grub2/device.map/hd1 references unknown 
device "sdb".  You may have to fix this entry manually after conversion.
virt-v2v: warning: /files/boot/grub2/device.map/hd3 references unknown 
device "sdb".  You may have to fix this entry manually after conversion.
virt-v2v: This guest has virtio drivers installed.
[ 114.8] Mapping filesystem data to avoid copying unused and blank areas
[ 115.2] Closing the overlay
[ 116.5] Checking if the guest needs BIOS or UEFI to boot
[ 116.5] Assigning disks to buses
[ 116.5] Copying disk 1/1 to /var/lib/libvirt/images/rhel72-sda (qcow2)
    (100.00/100%)
[ 177.3] Creating output metadata
Pool default refreshed

3.After conversion ,check the xml file of the guest.
#virsh dumpxml rhel72
*********  
 <graphics type='sdl'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>
**********
4.After conversion,try to boot the guest.
# virsh start rhel72
error: Failed to start domain rhel72
error: internal error: process exited while connecting to monitor: qemu-kvm: -sdl: SDL support is disabled

Comment 7 mxie@redhat.com 2017-03-09 09:03:38 UTC
Verify the bug with builds:
virt-v2v-1.36.2-1.el7.x86_64
libguestfs-1.36.2-1.el7.x86_64
libvirt-3.1.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64
libguestfs-winsupport-7.2-2.el7.x86_64
virtio-win-1.9.0-3.el7.noarch

Steps:
Scenario1:
1.Convert a windows guest which has graphic mode spice+VGA

2.Use virt-v2v -i disk to convert this guest disk 
# virt-v2v -i disk win2016.qcow2 -on win2016-bug1372671

3.Check the graphic part xml of guest "win2016-bug1372671" after finishing the virt-v2v conversion, the graphic mode is correct 

# virsh dumpxml win2016-bug1372671 |grep graphic -A 2
    <graphics type='vnc' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>

4.Power on the guest and checkpoints of guest are passed

Scenario2:
1.Convert a linux guest which has graphic mode spice+qxl

2.Use virt-v2v -i disk to convert this guest disk 
# virt-v2v -i disk rhel7.3.qcow2 -on rhel7.3-mxie

3.Check the graphic part xml of guest after finishing the virt-v2v conversion, the graphic mode is correct 
# virsh dumpxml rhel7.3-mxie |grep graphic -A 2
    <graphics type='vnc' port='-1' autoport='yes'>
      <listen type='address'/>
    </graphics>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>

4.Power on the guest and checkpoints of guest are passed


According to above verify result, the bug has been fixed 

So move the bug from ON_QA to VERIFIED

Comment 8 errata-xmlrpc 2017-08-01 22:08:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2023