Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1668139

Summary: libvirt can set default video model=cirrus even if qemu doesn't support it
Product: Red Hat Enterprise Linux Advanced Virtualization Reporter: zonglin jiang <zjiang>
Component: libvirtAssignee: Pavel Mores <pmores>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: crobinso, fjin, jdenemar, jsuchane, juzhou, knoel, lizhu, mxie, mzhan, pmores, rbalakri, rjones, tzheng, xiaodwan, xuzhang, yafu, zili
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-5.10.0-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1668141 (view as bug list) Environment:
Last Closed: 2020-05-05 09:45:09 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:
Bug Depends On:    
Bug Blocks: 1668141    
Attachments:
Description Flags
virt-manager log
none
rhel8.0 xml none

Description zonglin jiang 2019-01-22 03:14:10 UTC
Description of problem:
Incorrect default video device type after adding graphical device on rhel8

Version-Release number of selected component (if applicable):
virt-manager-2.0.0-2.el8.noarch
qemu-kvm-2.12.0-57.module+el8+2683+02b3b955.x86_64
libvirt-4.5.0-18.module+el8+2691+dc742e5d.x86_64
python3-libvirt-4.5.0-1.module+el8+2529+a9686a4d.x86_64
kernel-4.18.0-60.el8.x86_64


How reproducible
100%

Steps to Reproduce
1.Launch virt-manager, Open an existing VM and remove all its graphical and video devices
2.Click "Add Hardware">"Graphics" to add a display device


Actual results:
After step 2,another video device is added and its model type is "cirrus" while it is not in the drop list that can be chosen

Expected results:
Default video type should not be "circus"

Comment 1 Cole Robinson 2019-01-22 14:49:04 UTC
Can you provide full virt-manager --debug output when reproducing? It's unclear if this is virt-manager setting cirrus, or libvirt

Comment 2 zonglin jiang 2019-01-23 06:35:38 UTC
Created attachment 1522581 [details]
virt-manager log

Comment 3 zonglin jiang 2019-01-23 06:37:45 UTC
Created attachment 1522582 [details]
rhel8.0 xml

Comment 4 zonglin jiang 2019-01-23 06:38:44 UTC
(In reply to Cole Robinson from comment #1)
> Can you provide full virt-manager --debug output when reproducing? It's
> unclear if this is virt-manager setting cirrus, or libvirt

Thanks for your time. I've uploaded both virt-manager's debug log and the xml file for this vm.

Comment 5 Cole Robinson 2019-02-03 17:12:35 UTC
Looks like a libvit bug. qemuDomainDeviceVideoDefPostParse will set a video model without checking if qemu supports it, despite the fact that qemuProcessStartValidateVideo later will check qemu capabilities and reject the cirrus config.

Kind of a corner case though so not a priority for fixing in 8.0 GA

Comment 7 Lili Zhu 2020-02-12 04:52:49 UTC
Hi, Pavel,

Tested with:
libvirt-6.0.0-4.module+el8.2.0+5642+838f3513.x86_64
virt-manager-2.2.1-3.el8.noarch
qemu-kvm-4.2.0-8.module+el8.2.0+5607+dc756904.x86_64

1.Launch virt-manager, Open an existing VM and remove all its graphical and video devices
2.Click "Add Hardware">"Graphics" to add a display device

After step 2, the added default video device is still with model of "cirrus" 

Please help to check. Thanks

Comment 8 Pavel Mores 2020-02-14 11:22:43 UTC
Hi, could you please check if your qemu supports cirrus?  If it does then the result that you report would be expected, as cirrus is still preferred to plain vga whenever it's available.

The intention of my fix is to prevent ending up with cirrus even if qemu does not support it, in which case you should now get vga if vga is available and no video device at all (in other words, an invalid domain configuration) otherwise.

I should have made this clear beforehand, I'm sorry for that.

Hope this helps,

Pavel

Comment 9 Cole Robinson 2020-02-14 14:53:38 UTC
Also check 'virt-manager --debug' output for the XML virt-manager is producing, it may be incorrectly setting 'cirrus' itself, which would be a separate bug

Comment 10 zhoujunqin 2020-02-16 03:23:06 UTC
(In reply to Cole Robinson from comment #9)
> Also check 'virt-manager --debug' output for the XML virt-manager is
> producing, it may be incorrectly setting 'cirrus' itself, which would be a
> separate bug

Hi Core,
I find that when I adding graphics back, there is no xml notification about Video change, but video "cirrus" is added together with the graphics.

Package:
libvirt-4.5.0-39.module+el8.2.0+5690+f1eb5920.x86_64
virt-manager-2.2.1-3.el8.noarch
qemu-kvm-2.12.0-98.module+el8.2.0+5698+10a84757.x86_64


# virt-manager --debug

[Sun, 16 Feb 2020 11:14:55 virt-manager 1567] DEBUG (addhardware:1303) Adding device:
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
  <gl enable="no"/>
  <image compression="off"/>
</graphics>

[Sun, 16 Feb 2020 11:14:55 virt-manager 1567] DEBUG (libvirtobject:57) Redefining <vmmDomain name=spice-73 id=0x7fc374055558> with XML diff:
--- Original XML
+++ New XML
@@ -141,5 +141,9 @@
       <backend model="random">/dev/urandom</backend>
       <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
     </rng>
+    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+      <gl enable="no"/>
+      <image compression="off"/>
+    </graphics>
   </devices>
 </domain>

# virsh dumpxml $vm
...
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
      <image compression='off'/>
      <gl enable='no'/>
    </graphics>
...
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>


# /usr/libexec/qemu-kvm  --help |grep -a2A2 cirrus
-portrait       rotate graphical output 90 deg left (only PXA LCD)
-rotate <deg>   rotate graphical output some deg left (only PXA LCD)
-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]
                select video card type
-full-screen    start in full screen

Hopes it can help you to debug the issue, thanks.

Comment 11 Cole Robinson 2020-02-16 14:46:05 UTC
Okay Comment #10 indicates virt-manager isn't at fault here

Comment 12 zhoujunqin 2020-02-17 02:41:22 UTC
(In reply to Cole Robinson from comment #11)
> Okay Comment #10 indicates virt-manager isn't at fault here

Hi Core,
Comment 10 is based on slow train version testing
Today I tested with fast train version again, I get the same result with Comment 10.

Package version:
virt-manager-2.2.1-3.el8.noarch
libvirt-6.0.0-4.module+el8.2.0+5642+838f3513.x86_64
qemu-kvm-4.2.0-8.module+el8.2.0+5607+dc756904.x86_64

Steps:
1. Remove all graphics and videos, then add graphics again.

# virt-manager --debug
[Sun, 16 Feb 2020 21:30:16 virt-manager 3545] DEBUG (libvirtobject:57) Redefining <vmmDomain name=vm2-yqz id=0x7fd2b55f2750> with XML diff:
--- Original XML
+++ New XML
@@ -137,5 +137,9 @@
       <backend model="random">/dev/urandom</backend>
       <address type="pci" domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
     </rng>
+    <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+      <gl enable="no"/>
+      <image compression="off"/>
+    </graphics>
   </devices>
 </domain>

# virsh dumpxml $vm
...
    <graphics type='spice' autoport='yes'>
      <listen type='address'/>
      <image compression='off'/>
      <gl enable='no'/>
    </graphics>
    <video>
      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    </video>

Check whether cirrus is supported by qemu-kvm:

# /usr/libexec/qemu-kvm  --help |grep -a2A2 cirrus
-portrait       rotate graphical output 90 deg left (only PXA LCD)
-rotate <deg>   rotate graphical output some deg left (only PXA LCD)
-vga [std|cirrus|vmware|qxl|xenfb|tcx|cg3|virtio|none]
                select video card type
-full-screen    start in full screen

As a summary , this is a AV bug, so I test with AV version again, thanks.

Comment 13 Pavel Mores 2020-02-17 09:36:44 UTC
(In reply to Pavel Mores from comment #8)
> Hi, could you please check if your qemu supports cirrus?

More specifically, there might be multiple ways to check this but one simple way could be just running

virsh domcapabilities --emulatorbin <path_to_your_emulator_binary> | grep cirrus

If the output is something like

<value>cirrus</value>

then your qemu supports cirrus and the addition of cirrus is expected.

Comment 14 Lili Zhu 2020-02-26 03:50:52 UTC
Tested using s390 and ppc arch,
For ppc arch:
libvirt-6.0.0-6.module+el8.2.0+5821+109ee33c.ppc64le
virt-manager-2.2.1-3.el8.noarch
qemu-kvm-4.2.0-12.module+el8.2.0+5858+afd073bc.ppc64le

1. check whether qemu support cirrus 
# virsh domcapabilities |grep cirrus
(no output)

2. Launch virt-manager, Open an existing VM and remove all its graphical and video devices
# virsh dumpxml avocado-vt-vm1 |grep -e graphics -e video
(no output)

3. Click "Add Hardware">"Graphics" to add a display device, and check the virt-manager log

[Tue, 25 Feb 2020 21:39:57 virt-manager 127173] DEBUG (addhardware:1303) Adding device:
<graphics type="vnc" port="-1">
  <gl enable="no" rendernode="/dev/dri/by-path/pci-000a:01:00.0-render"/>
</graphics>

[Tue, 25 Feb 2020 21:39:57 virt-manager 127173] DEBUG (libvirtobject:57) Redefining <vmmDomain name=avocado-vt-vm1 id=0x7fff8808c8b8> with XML diff:
--- Original XML
+++ New XML
@@ -72,5 +72,8 @@
       <address type="pci" domain="0x0000" bus="0x00" slot="0x06" function="0x0"/>
     </rng>
     <panic model="pseries"/>
+    <graphics type="vnc" port="-1">
+      <gl enable="no" rendernode="/dev/dri/by-path/pci-000a:01:00.0-render"/>
+    </graphics>
   </devices>
 </domain>


4. check the xml of guest
...
    <graphics type='vnc' port='-1' autoport='yes'>
      <listen type='address'/>
    </graphics>
    <video>
      <model type='vga' vram='16384' heads='1' primary='yes'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </video>
...

The added video device by default is "vga"

For s390 arch:
libvirt-6.0.0-6.module+el8.2.0+5821+109ee33c.s390x
virt-manager-2.2.1-3.el8.noarch
qemu-kvm-4.2.0-12.module+el8.2.0+5858+afd073bc.s390x

1. check the video model type of qemu supported
# virsh domcapabilities |grep "<video" -A5
    <video supported='yes'>
      <enum name='modelType'>
        <value>virtio</value>
        <value>none</value>
      </enum>
    </video>


2. remove graphics and video devices in guest xml
# virsh dumpxml avocado-vt-vm1 |grep -e videp -e graphics
(no output)

3. add the graphics device, then check the added video device
....
  <graphics type='vnc' port='-1' autoport='yes'>
      <listen type='address'/>
    </graphics>
    <video>
      <model type='virtio' heads='1' primary='yes'/>
      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0002'/>
    </video>
...

the added video device by default is with model type "virtio"

As the testing result matched with the expected result, mark the bug as verified.

Comment 16 errata-xmlrpc 2020-05-05 09:45:09 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-2020:2017