For s390 the default console target type is virtio. This also requires
that an implicit virtio-serial controller is instantiated.
This testcase verifies that the target type of virtio is correctly set
in the generated XML if no target element was given and that the
corresponding virtio-serial element is generated too.
Signed-off-by: Viktor Mihajlovski <mihajlov(a)linux.vnet.ibm.com>
---
.../qemuxml2argv-s390-defaultconsole.xml | 20 ++++++++++++++++
.../qemuxml2xmlout-s390-defaultconsole.xml | 24 ++++++++++++++++++++
tests/qemuxml2xmltest.c | 2 ++
3 files changed, 46 insertions(+)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-s390-defaultconsole.xml
create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-defaultconsole.xml
b/tests/qemuxml2argvdata/qemuxml2argv-s390-defaultconsole.xml
new file mode 100644
index 0000000..036027c
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-s390-defaultconsole.xml
@@ -0,0 +1,20 @@
+<domain type='kvm'>
+ <name>test</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-virtio'>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-kvm</emulator>
+ <console type='pty'/>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
new file mode 100644
index 0000000..9a609f8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-defaultconsole.xml
@@ -0,0 +1,24 @@
+<domain type='kvm'>
+ <name>test</name>
+ <uuid>9aa4b45c-b9dd-45ef-91fe-862b27b4231f</uuid>
+ <memory unit='KiB'>262144</memory>
+ <currentMemory unit='KiB'>262144</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='s390x' machine='s390-virtio'>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-kvm</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='virtio-serial' index='0'/>
+ <console type='pty'>
+ <target type='virtio' port='0'/>
+ </console>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 06e4206..65e9591 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -300,6 +300,8 @@ mymain(void)
DO_TEST_DIFFERENT("hostdev-scsi-autogen-address");
+ DO_TEST_DIFFERENT("s390-defaultconsole");
+
virObjectUnref(driver.caps);
virObjectUnref(driver.xmlopt);
--
1.7.9.5