]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_command: add support to use virtio as secondary video device
authorPavel Hrdina <phrdina@redhat.com>
Mon, 10 Oct 2016 18:19:06 +0000 (20:19 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Wed, 12 Oct 2016 15:46:48 +0000 (17:46 +0200)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1369633

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
docs/formatdomain.html.in
src/qemu/qemu_domain.c
tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-video-virtio-gpu-secondary.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-secondary.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index b989c8f9a4596655aa548cbd261211a75ab27189..905117881e65bdd51a13768dfbdf4376de47a223 100644 (file)
@@ -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
+          (<span class="since">since 2.4.0</span>) "virtio".
         </p>
       </dd>
 
index 98fb2e52c7fecde7ff9a76805bea9ded3c8c0c62..0c9416f61d1e1b852cda9445bbc75c1d4c4dcfe8 100644 (file)
@@ -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 (file)
index 0000000..9d47e87
--- /dev/null
@@ -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 (file)
index 0000000..61d8eb8
--- /dev/null
@@ -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>
index 5adb2fdddbb8bc4527943936f6b823b37b94ba04..b9961823f8eee8a6dcb98d2064bed0bf9e6d88cb 100644 (file)
@@ -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 (file)
index 0000000..2666004
--- /dev/null
@@ -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>
index a06351d4993f8ad3904a23ecb1f36c3faafc3361..62bff8cd7a16e94ae0852e34eef778193f3ac211 100644 (file)
@@ -876,6 +876,7 @@ mymain(void)
 
     DO_TEST("video-qxl-heads", NONE);
     DO_TEST("video-qxl-noheads", NONE);
+    DO_TEST("video-virtio-gpu-secondary", NONE);
 
     DO_TEST("intel-iommu",
             QEMU_CAPS_DEVICE_PCI_BRIDGE, QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE);