Red Hat Bugzilla – Bug 1325757
virsh create fails if <video> element is not set in XML
Last modified: 2016-11-03 14:41:46 EDT
Description of problem: When video element don't set in xml file, guest create failed. Version-Release number of selected component (if applicable): libvirt-1.3.3-1.el7.x86_64 qemu-kvm-rhev-2.5.0-4.el7.x86_64 How reproducible: 100% Steps to Reproduce: [root@hp-dl380pgen8-01 ~]# cat test.xml <domain type="kvm"> <name>nfs</name> <memory>1048576</memory> <vcpu>1</vcpu> <os> <type machine="pc">hvm</type> <boot dev="hd"/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset="utc"/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <disk device="disk" type="file"> <driver name="qemu" type='qcow2'/> <source file='/var/lib/libvirt/images/libvirt-test-api'/> <target bus='virtio' dev='vda'/> </disk> <interface type="network"> <source network="default"/> <mac address='54:52:00:45:a1:2c'/> <model type='virtio'/> </interface> <console/> <input bus="ps2" type="mouse"/> <graphics keymap="en-us" port="-1" autoport="yes" type="vnc"/> <channel type='unix'> <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/snapshotguest-nfs.agent'/> <target type='virtio' name='org.qemu.guest_agent.0'/> </channel> </devices> </domain> [root@hp-dl380pgen8-01 ~]# virsh create test.xml error: Failed to create domain from test.xml error: unsupported configuration: non-primary video device must be type of 'qxl' Actual results: Guest create failed. Expected results: Guest create successful. Additional info: It works well with libvirt-1.3.2-1.el7.x86_64.
Upstream patches: https://www.redhat.com/archives/libvir-list/2016-April/msg00495.html
Fixed upstream by: commit 6d8b6d2847f31a3d7a234536c12b8feca751a02f Author: Ján Tomko <jtomko@redhat.com> CommitDate: 2016-04-12 10:45:35 +0200 conf: also mark the implicit video as primary Commit 119cd06 started setting the primary bool for the first user-specified video even if user omitted the 'primary' attribute. However this was done before the addition of the implicit device. This broke startup of transient qemu domains with no <video>: https://bugzilla.redhat.com/show_bug.cgi?id=1325757 Move this default to virDomainDefPostParseInternal, after the addition of the implicit video device, to catch the implicit video as well. git describe: v1.3.3-64-g6d8b6d2
I can reproduce this BZ on build libvirt-1.3.3-2.el7.x86_64. Verify pass on build libvirt-1.3.5-1.el7.x86_64 Steps: 1. Prepare a guest xml without video element. # grep video rhel7.2.xml (nothing output) 2. # virsh create rhel7.2.xml Domain rhel7.2 created from rhel7.2.xml 3. Dump guest xml, video device is added automatically and marked as primary: # virsh dumpxml rhel7.2 ... <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> <alias name='video0'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> ... 4. Re-test step 1~3 with the following guest xml: <video> <model type='cirrus' vram='16384' heads='1'/> ==> with video element and without specified primary </video> 5. Re-test step 1~3 with the following guest xml: <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> ==> with video element and with specified primary </video> 6. Prepare a guest xml without video element. # grep video rhel7.2.xml (nothing output) 7. Define guest: # virsh undefine rhel7.2 Domain rhel7.2 has been undefined 8. Check guest xml, video device is added automatically and marked as primary: # virsh dumlxml rhel7.2 <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> 9. Undefine guest rhel7.2 and Re-test step 6~8 with the following guest xml: ... <video> <model type='cirrus' vram='16384' heads='1'/> ==> with video element and without specified primary </video> ... 10. Undefine guest rhel7.2 and Re-test step 6~8 with the following guest xml: ... <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> </video> ... 11. Guest rhel7.2 has been defined, delete video element by "virsh edit" and save: # virsh edit rhel7.2 Domain rhel7.2 XML configuration edited. 12. Check guest xml, video device is added automatically and marked as primary: # virsh dumlxml rhel7.2 <video> <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video>
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-2577.html