Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1369633 Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- Changes in v2: - added bugzilla into commit message docs/formatdomain.html.in | 3 +- src/qemu/qemu_domain.c | 3 +- .../qemuxml2argv-video-virtio-gpu-sec.args | 22 ++++++++++++++ .../qemuxml2argv-video-virtio-gpu-sec.xml | 27 +++++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ .../qemuxml2xmlout-video-virtio-gpu-sec.xml | 35 ++++++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-sec.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b989c8f..14e0f48 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5641,7 +5641,8 @@ qemu-kvm -net nic,model=? /dev/null video device in domain xml is the primary one, but the optional attribute <code>primary</code> (<span class="since">since 1.0.2</span>) with value 'yes' can be used to mark the primary in cases of multiple - video device. The non-primary must be type of "qxl". + video device. The non-primary must be type of "qxl" or + "virtio" (<span class="since">since 2.4.0</span>). </p> </dd> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index cd574fb..8273009 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2421,7 +2421,8 @@ qemuDomainDefValidateVideo(const virDomainDef *def) } if (!video->primary && - video->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + video->type != VIR_DOMAIN_VIDEO_TYPE_QXL && + video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type '%s' is only valid as primary " "video device"), diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.args new file mode 100644 index 0000000..9d47e87 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.args @@ -0,0 +1,22 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 1024 \ +-smp 1,sockets=1,cores=1,threads=1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-device virtio-gpu-pci,id=video0,bus=pci.0,addr=0x2 \ +-device virtio-gpu-pci,id=video1,bus=pci.0,addr=0x4 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.xml new file mode 100644 index 0000000..61d8eb8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-sec.xml @@ -0,0 +1,27 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='pci' index='0' model='pci-root'/> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <video> + <model type='virtio' heads='1' primary='yes'/> + </video> + <video> + <model type='virtio' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5adb2fd..755118b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1616,6 +1616,9 @@ mymain(void) QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_GL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-virtio-gpu-sec", + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); DO_TEST("video-virtio-vga", QEMU_CAPS_DEVICE_VIRTIO_GPU, QEMU_CAPS_DEVICE_VIRTIO_VGA, diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-sec.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-sec.xml new file mode 100644 index 0000000..2666004 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-sec.xml @@ -0,0 +1,35 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu placement='static'>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <controller type='pci' index='0' model='pci-root'/> + <controller type='usb' index='0'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> + </controller> + <input type='mouse' bus='ps2'/> + <input type='keyboard' bus='ps2'/> + <video> + <model type='virtio' heads='1' primary='yes'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> + </video> + <video> + <model type='virtio' heads='1'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> + </video> + <memballoon model='virtio'> + <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> + </memballoon> + </devices> +</domain> diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a06351d..b346929 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -876,6 +876,7 @@ mymain(void) DO_TEST("video-qxl-heads", NONE); DO_TEST("video-qxl-noheads", NONE); + DO_TEST("video-virtio-gpu-sec", NONE); DO_TEST("intel-iommu", QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE); -- 2.10.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list