Bug 1312254

Summary: virt-v2v -o libvirt doesn't preserve or use correct <graphics type="vnc|spice">
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2CC: ajia, juzhou, mzhan, ptoscano, rjones, sherold, tzheng, virt-bugs, xiaodwan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: libguestfs-1.32.3-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1225789 Environment:
Last Closed: 2016-11-03 17:59:21 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:

Description Richard W.M. Jones 2016-02-26 09:07:13 UTC
The current -o libvirt code arbitrarily adds <graphics type="vnc"> when the driver is QXL and <graphics type="spice"> when the driver is Cirrus.  This makes no sense.

It should either preserve the input <graphics> element, or it should consistently use only VNC or only SPICE, or it should use VNC for Cirrus and SPICE for QXL.  I'm not sure which, but the current behaviour is wrong.

Version: libguestfs-1.33.12

From https://bugzilla.redhat.com/show_bug.cgi?id=1225789#c10

I tested the with (vnc+cirrus) and it's converted to vnc+qxl successfully. And then tested it with spice+cirrus, it changed to vnc+qxl instead of spice+qxl unexpectedly.

Before converting (spice+cirrus):
# virsh dumpxml rhel7.2-10301 | grep graphic -A5
    <graphics type='spice' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>

After converting (vnc+qxl):
# virsh dumpxml aaa | grep graphic -A5
    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
      <listen type='address' address='0.0.0.0'/>
    </graphics>
    <sound model='ich6'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </sound>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>

Comment 1 Richard W.M. Jones 2016-02-26 10:16:22 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2016-February/thread.html#00241

Comment 3 Richard W.M. Jones 2016-03-01 09:28:39 UTC
Moving back to assigned.  It turns out that qxl+vnc doesn't
work.  If we install qxl drivers, we must change the device
to spice.

Actually, I'm going to ask the virt team to verify if this
is correct or not before making any further changes.

Comment 5 Richard W.M. Jones 2016-03-01 12:50:14 UTC
I'm going to declare that the current behaviour (both in RHEL and
upstream) is the correct behaviour.  qxl + vnc is supported.

Comment 6 tingting zheng 2016-03-04 06:03:20 UTC
(In reply to Richard W.M. Jones from comment #5)
> I'm going to declare that the current behaviour (both in RHEL and
> upstream) is the correct behaviour.  qxl + vnc is supported.

Thanks for make it clear,this bug can be added into erratum and QE will change status after test PASS.

Comment 8 tingting zheng 2016-03-25 10:34:39 UTC
This bug works fine with linux guests,but for windows guest,it still applies: The adds <graphics type="vnc"> when the driver is QXL and <graphics type="spice"> when the driver is Cirrus. 

1.For windows guests(win2008r2,win7) from esx server which will use QXL driver,the xml shows as below after conversion:
    <graphics type='vnc' port='-1' autoport='yes'/>
    <video>
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

2.For windows guests(win2008,win2003,windows 10,windows 2012,windows 8) from esx server which will use VGA,the xml shows as below after conversion:
    <graphics type='spice' autoport='yes'/>
    <video>
      <model type='cirrus' vram='16384' heads='1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
    </video>

All guests from esx server have no graphics part in xml before conversion.
eg:virsh connect to esx6.0 server and get xml file of guest.
# dumpxml esx6.0-win2008r2-x86_64 
<domain type='vmware' xmlns:vmware='http://libvirt.org/schemas/domain/vmware/1.0'>
  <name>esx6.0-win2008r2-x86_64</name>
  <uuid>564d3e2f-84f3-0b4f-05b7-2141186bdf9a</uuid>
  <memory unit='KiB'>1048576</memory>
  <currentMemory unit='KiB'>1048576</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64'>hvm</type>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <disk type='file' device='disk'>
      <source file='[ESX6.0] esx6.0-win2008r2-x86_64/esx6.0-win2008r2-x86_64.vmdk'/>
      <target dev='sda' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <source file='[win-iso] Windows_Server_2008_R2_GA_EN.iso'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <controller type='scsi' index='0' model='lsisas1068'/>
    <controller type='ide' index='0'/>
    <interface type='bridge'>
      <mac address='00:0c:29:6b:df:9a'/>
      <source bridge='VM Network'/>
      <model type='e1000'/>
    </interface>
    <video>
      <model type='vmvga' vram='8192'/>
    </video>
  </devices>
  <vmware:datacenterpath>data</vmware:datacenterpath>
</domain>

Comment 9 tingting zheng 2016-03-28 05:32:28 UTC
Refer to comment 8,move this bug to ASSIGNED.

Comment 10 tingting zheng 2016-03-30 05:37:35 UTC
(In reply to tingting zheng from comment #8)
> This bug works fine with linux guests,but for windows guest,it still
> applies: The adds <graphics type="vnc"> when the driver is QXL and <graphics
> type="spice"> when the driver is Cirrus. 
> 
> 1.For windows guests(win2008r2,win7) from esx server which will use QXL
> driver,the xml shows as below after conversion:
>     <graphics type='vnc' port='-1' autoport='yes'/>
>     <video>
>       <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>     </video>
> 
> 2.For windows guests(win2008,win2003,windows 10,windows 2012,windows 8) from
> esx server which will use VGA,the xml shows as below after conversion:
>     <graphics type='spice' autoport='yes'/>
>     <video>
>       <model type='cirrus' vram='16384' heads='1'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x02'
> function='0x0'/>
>     </video>


Sorry,I've made a mistake.
The results are come from the auto job and the colleague who are debugging the auto job forget to upgrade virt-v2v to latest version.

I retested the bug with latest version and the above issue can not be reproduced,so I move the bug back to ON_QA.

Comment 11 keanli 2016-04-14 08:58:32 UTC
I can reproduce it with:
libguestfs-1.31.7-1.el7.x86_64
virt-v2v-1.31.7-1.el7.x86_64

Steps: 
1,Prepare a guest with spice graphics and cirrus driver
#virsh dumpxml rhel6.6
…
<graphics type='spice' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
…

2,Convert it using virt-v2v 
#virt-v2v -o libvirt -of raw -os default rhel6.6 -b virbr0 -on aa 
Convert successfully without any error notification
3,Check the xml file after converted it
virsh dumpxml aa | grep graphics -A6
<graphics type='vnc' port='-1' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
It’s changed to vnc+cirrus instead of spice+qxl
Testing with:
libguestfs-1.32.3-1.el7.x86_64
virt-v2v-1.32.3-1.el7.x86_64
The testing steps is same as reproduce steps 
Scenarios 1: spice graphics with cirrus driver
virsh dumpxml rhel6.6 | grep graphics -A 6
<graphics type='spice' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='16384' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
After steps 3,
virsh dumpxml bb | grep graphics -A6
<graphics type='spice' autoport='yes' keymap='en-us'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<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'/>
Result:
Spice + cirrus =>Spice+qxl 
Check the video driver if is qxl after boot the guest
cat /var/log/Xorg.0.log | grep -i qxl
…
[ 31.719] (II) qxl(0): Creating default Display subsection in Screen section
[ 31.719] (==) qxl(0): Depth 24, (--) framebuffer bpp 32
[ 31.719] (==) qxl(0): RGB weight 888
[ 31.719] (==) qxl(0): Default visual is TrueColor
[ 31.719] (==) qxl(0): Using gamma correction (1.0, 1.0, 1.0)
...

Scenarios 2:spice with qxl 
Result:
spice+qxl=>spice+qxl
The video driver is qxl

Scenarios 3:VNC with cirrus 
Result:
vnc+cirrus=>vnc+qxl
The video driver is qxl

Scenarios 4, vnc with qxl
Result:
vnc+qxl =>vnc+qxl 
The video driver is qxl
Refer above comments, the bug has already been fixed ,so move it to VERIFIED

Comment 13 errata-xmlrpc 2016-11-03 17:59:21 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://rhn.redhat.com/errata/RHSA-2016-2576.html