From fb8f3b1c22c8f272bb9a47e8f8915acc3cfb47f1 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Mon, 10 Oct 2016 20:19:06 +0200 Subject: [PATCH] qemu_command: add support to use virtio as secondary video device Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1369633 Signed-off-by: Pavel Hrdina --- docs/formatdomain.html.in | 3 +- src/qemu/qemu_domain.c | 3 +- ...muxml2argv-video-virtio-gpu-secondary.args | 22 ++++++++++++ ...emuxml2argv-video-virtio-gpu-secondary.xml | 27 ++++++++++++++ tests/qemuxml2argvtest.c | 3 ++ ...uxml2xmlout-video-virtio-gpu-secondary.xml | 35 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-secondary.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index b989c8f9a4..905117881e 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 primary (since 1.0.2) 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 + (since 2.4.0) "virtio".

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 98fb2e52c7..0c9416f61d 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-secondary.args b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.args new file mode 100644 index 0000000000..9d47e87986 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.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-secondary.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.xml new file mode 100644 index 0000000000..61d8eb85d6 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.xml @@ -0,0 +1,27 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + destroy + restart + destroy + + /usr/bin/qemu + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5adb2fdddb..b9961823f8 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-secondary", + 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-secondary.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-secondary.xml new file mode 100644 index 0000000000..2666004546 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-secondary.xml @@ -0,0 +1,35 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 1048576 + 1048576 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + +
+ + + +