render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
3e5111
From 5c213cb256cbe66c368c2978b2ff41ab45dd0e44 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <5c213cb256cbe66c368c2978b2ff41ab45dd0e44@dist-git>
3e5111
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
3e5111
Date: Fri, 9 Jun 2017 12:48:58 +0200
3e5111
Subject: [PATCH] qemuxml2xmltest: add virtio-options test
3e5111
MIME-Version: 1.0
3e5111
Content-Type: text/plain; charset=UTF-8
3e5111
Content-Transfer-Encoding: 8bit
3e5111
3e5111
Add a test case with all the virtio devices we know to demonstrate
3e5111
the addition of new options.
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1283251
3e5111
3e5111
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
3e5111
(cherry picked from commit 15911ab8201f46b99352eea818c798828b6e4ff1)
3e5111
Signed-off-by: Ján Tomko <jtomko@redhat.com>
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
---
3e5111
 .../qemuxml2argv-virtio-options.xml                | 81 ++++++++++++++++++++++
3e5111
 .../qemuxml2xmlout-virtio-options.xml              |  1 +
3e5111
 tests/qemuxml2xmltest.c                            |  1 +
3e5111
 3 files changed, 83 insertions(+)
3e5111
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
3e5111
 create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
3e5111
3e5111
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
3e5111
new file mode 100644
3e5111
index 0000000000..c88cf649b1
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2argvdata/qemuxml2argv-virtio-options.xml
3e5111
@@ -0,0 +1,81 @@
3e5111
+<domain type='qemu'>
3e5111
+  <name>QEMUGuest1</name>
3e5111
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
3e5111
+  <memory unit='KiB'>219136</memory>
3e5111
+  <currentMemory unit='KiB'>219136</currentMemory>
3e5111
+  <vcpu placement='static'>1</vcpu>
3e5111
+  <os>
3e5111
+    <type arch='x86_64' machine='pc'>hvm</type>
3e5111
+    <boot dev='hd'/>
3e5111
+  </os>
3e5111
+  <clock offset='utc'/>
3e5111
+  <on_poweroff>destroy</on_poweroff>
3e5111
+  <on_reboot>restart</on_reboot>
3e5111
+  <on_crash>destroy</on_crash>
3e5111
+  <devices>
3e5111
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
3e5111
+    <disk type='file' device='disk'>
3e5111
+      <driver name='qemu' type='raw'/>
3e5111
+      <source file='/var/lib/libvirt/images/img1'/>
3e5111
+      <target dev='vda' bus='virtio'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
3e5111
+    </disk>
3e5111
+    <controller type='usb' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
3e5111
+    </controller>
3e5111
+    <controller type='ide' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
3e5111
+    </controller>
3e5111
+    <controller type='scsi' index='0' model='virtio-scsi'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
3e5111
+    </controller>
3e5111
+    <controller type='pci' index='0' model='pci-root'/>
3e5111
+    <controller type='virtio-serial' index='0'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
3e5111
+    </controller>
3e5111
+    <filesystem type='mount' accessmode='passthrough'>
3e5111
+      <source dir='/export/fs1'/>
3e5111
+      <target dir='fs1'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
3e5111
+    </filesystem>
3e5111
+    <filesystem type='mount' accessmode='mapped'>
3e5111
+      <driver type='path' wrpolicy='immediate'/>
3e5111
+      <source dir='/export/fs2'/>
3e5111
+      <target dir='fs2'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
3e5111
+    </filesystem>
3e5111
+    <interface type='user'>
3e5111
+      <mac address='52:54:56:58:5a:5c'/>
3e5111
+      <model type='virtio'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
3e5111
+    </interface>
3e5111
+    <input type='mouse' bus='virtio'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
3e5111
+    </input>
3e5111
+    <input type='keyboard' bus='virtio'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/>
3e5111
+    </input>
3e5111
+    <input type='tablet' bus='virtio'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/>
3e5111
+    </input>
3e5111
+    <input type='passthrough' bus='virtio'>
3e5111
+      <source evdev='/dev/input/event1234'/>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/>
3e5111
+    </input>
3e5111
+    <input type='mouse' bus='ps2'/>
3e5111
+    <input type='keyboard' bus='ps2'/>
3e5111
+    <video>
3e5111
+      <model type='virtio' heads='1' primary='yes'>
3e5111
+        <acceleration accel3d='yes'/>
3e5111
+      </model>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
3e5111
+    </video>
3e5111
+    <memballoon model='virtio'>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/>
3e5111
+    </memballoon>
3e5111
+    <rng model='virtio'>
3e5111
+      <backend model='random'>/dev/random</backend>
3e5111
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/>
3e5111
+    </rng>
3e5111
+  </devices>
3e5111
+</domain>
3e5111
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
3e5111
new file mode 120000
3e5111
index 0000000000..d757b8aac0
3e5111
--- /dev/null
3e5111
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-virtio-options.xml
3e5111
@@ -0,0 +1 @@
3e5111
+../qemuxml2argvdata/qemuxml2argv-virtio-options.xml
3e5111
\ No newline at end of file
3e5111
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
3e5111
index 3f7c268e43..72eac5e716 100644
3e5111
--- a/tests/qemuxml2xmltest.c
3e5111
+++ b/tests/qemuxml2xmltest.c
3e5111
@@ -1109,6 +1109,7 @@ mymain(void)
3e5111
 
3e5111
     DO_TEST("memorybacking-set", NONE);
3e5111
     DO_TEST("memorybacking-unset", NONE);
3e5111
+    DO_TEST("virtio-options", QEMU_CAPS_VIRTIO_SCSI);
3e5111
 
3e5111
     virObjectUnref(cfg);
3e5111
 
3e5111
-- 
3e5111
2.13.1
3e5111