]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: add VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP
authorPino Toscano <ptoscano@redhat.com>
Tue, 14 Nov 2017 15:27:04 +0000 (16:27 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Tue, 28 Nov 2017 14:46:34 +0000 (15:46 +0100)
Introduce specific a target types with two models for the console
devices (sclp and sclplm) used in s390 and s390x guests, so isa-serial
is no more used for them.

This makes <serial> usable on s390 and s390x guests, with at most only
a single sclpconsole and one sclplmconsole devices usable in a single
guest (due to limitations in QEMU, which will enforce already at
runtime).

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1449265

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
18 files changed:
docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h
src/qemu/qemu_command.c
src/qemu/qemu_domain.c
src/qemu/qemu_domain_address.c
tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args [new file with mode: 0644]
tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index 8cccccc523ec769df7531fa1b1a162e8e527aa10..29a96814673b62b7fd61f1cd59d7be905c6cce65 100644 (file)
@@ -6547,8 +6547,9 @@ qemu-kvm -net nic,model=? /dev/null
       with x86 guests), <code>usb-serial</code> (usable whenever USB support
       is available) and <code>pci-serial</code> (usable whenever PCI support
       is available); <span class="since">since 3.10.0</span>,
-      <code>spapr-vio-serial</code> (usable with ppc64/pseries guests) and
-      <code>system-serial</code> (usable with aarch64/virt guests) are
+      <code>spapr-vio-serial</code> (usable with ppc64/pseries guests),
+      <code>system-serial</code> (usable with aarch64/virt guests) and
+      <code>sclp-serial</code> (usable with s390 and s390x guests) are
       available as well.
     </p>
 
@@ -6562,7 +6563,9 @@ qemu-kvm -net nic,model=? /dev/null
       (usable with the <code>pci-serial</code> target type);
       <code>spapr-vty</code> (usable with the <code>spapr-vio-serial</code>
       target type); <code>pl011</code> (usable with the
-      <code>system-serial</code> target type).
+      <code>system-serial</code> target type); <code>sclpconsole</code> and
+      <code>sclplmconsole</code> (usable with the <code>sclp-serial</code>
+      target type).
     </p>
 
     <p>
@@ -6577,7 +6580,8 @@ qemu-kvm -net nic,model=? /dev/null
       <code>isa-serial</code>), <code>usb</code> (for <code>usb-serial</code>),
       <code>pci</code> (for <code>pci-serial</code>) and <code>spapr-vio</code>
       (for <code>spapr-vio-serial</code>). The <code>system-serial</code>
-      target type doesn't support specifying an address.
+      and <code>sclp-serial</code> target types don't support specifying an
+      address.
     </p>
 
     <p>
@@ -6625,8 +6629,11 @@ qemu-kvm -net nic,model=? /dev/null
       <code>virtio</code> (usable whenever VirtIO support is available);
       <code>xen</code>, <code>lxc</code>, <code>uml</code> and
       <code>openvz</code> (available when the corresponding hypervisor is in
-      use); <code>sclp</code> and <code>sclplm</code> (usable for s390 and
-      s390x QEMU guests).
+      use). <code>sclp</code> and <code>sclplm</code> (usable for s390 and
+      s390x QEMU guests) are supported for compatibility reasons but should
+      not be used for new guests: use the <code>sclpconsole</code> and
+      <code>sclplmconsole</code> target models, respectively, with the
+      <code>serial</code> element instead.
     </p>
 
     <p>
index 5fff3a40f37b4c942dba3772ad9a974bb7ff32f6..5b9fc162c4ea00770b3961f0594596427d91946f 100644 (file)
         <value>pci-serial</value>
         <value>spapr-vio-serial</value>
         <value>system-serial</value>
+        <value>sclp-serial</value>
       </choice>
     </attribute>
   </define>
           <value>pci-serial</value>
           <value>spapr-vty</value>
           <value>pl011</value>
+          <value>sclpconsole</value>
+          <value>sclplmconsole</value>
         </choice>
       </attribute>
     </element>
index 820caba0fc96e1bf15e9c6727eb6c5e81ba2afc8..b31917dad9c03919049ff0081efbb0d2de69eb3d 100644 (file)
@@ -454,6 +454,7 @@ VIR_ENUM_IMPL(virDomainChrSerialTarget,
               "pci-serial",
               "spapr-vio-serial",
               "system-serial",
+              "sclp-serial",
 );
 
 VIR_ENUM_IMPL(virDomainChrChannelTarget,
@@ -483,6 +484,8 @@ VIR_ENUM_IMPL(virDomainChrSerialTargetModel,
               "pci-serial",
               "spapr-vty",
               "pl011",
+              "sclpconsole",
+              "sclplmconsole",
 );
 
 VIR_ENUM_IMPL(virDomainChrDevice, VIR_DOMAIN_CHR_DEVICE_TYPE_LAST,
@@ -4064,6 +4067,7 @@ virDomainDefAddConsoleCompat(virDomainDefPtr def)
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE: {
 
             /* Create a stub console to match the serial port.
index 28d15898058de7fe830493feb195dd1503ef8838..48b07226eace0cdec5fbe948ee74e7fcee580663 100644 (file)
@@ -1083,6 +1083,7 @@ typedef enum {
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI,
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO,
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM,
+    VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP,
 
     VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST
 } virDomainChrSerialTargetType;
@@ -1117,6 +1118,8 @@ typedef enum {
     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL,
     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY,
     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011,
+    VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE,
+    VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE,
 
     VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST
 } virDomainChrSerialTargetModel;
index dfdb6231e0d26271a3d536ea189f81c4aca49259..1a5e9824ae02cc97be6279f3c9668fe863d6396e 100644 (file)
@@ -9233,6 +9233,10 @@ qemuChrSerialTargetModelToCaps(virDomainChrSerialTargetModel targetModel)
         return QEMU_CAPS_DEVICE_PCI_SERIAL;
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
         return QEMU_CAPS_DEVICE_SPAPR_VTY;
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+        return QEMU_CAPS_DEVICE_SCLPCONSOLE;
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
+        return QEMU_CAPS_DEVICE_SCLPLMCONSOLE;
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_ISA_SERIAL:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
@@ -10384,6 +10388,8 @@ qemuBuildSerialChrDeviceStr(char **deviceStr,
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_USB_SERIAL:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
 
         caps = qemuChrSerialTargetModelToCaps(serial->targetModel);
 
index 2cc91b46855398c9204998fb99db057206044056..b3b34348ba1e0dc86d681af2345874441383eee3 100644 (file)
@@ -3473,6 +3473,7 @@ qemuDomainChrSerialTargetTypeToAddressType(int targetType)
     case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO:
         return VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO;
     case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
         break;
@@ -3496,6 +3497,9 @@ qemuDomainChrSerialTargetModelToTargetType(int targetModel)
         return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
         return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+    case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
+        return VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP;
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_NONE:
     case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_LAST:
         break;
@@ -3533,6 +3537,7 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr)
             break;
 
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
             if (chr->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("Target type '%s' cannot have an "
@@ -3554,6 +3559,8 @@ qemuDomainChrTargetDefValidate(const virDomainChrDef *chr)
         case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PCI_SERIAL:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SPAPR_VTY:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011:
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE:
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE:
 
             expected = qemuDomainChrSerialTargetModelToTargetType(chr->targetModel);
 
@@ -3616,6 +3623,13 @@ qemuDomainChrDefValidate(const virDomainChrDef *dev,
             isCompatible = false;
         }
 
+        if (!ARCH_IS_S390(def->os.arch) &&
+            (dev->targetType == VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP ||
+             dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE ||
+             dev->targetModel == VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPLMCONSOLE)) {
+            isCompatible = false;
+        }
+
         if (!isCompatible) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Serial device with target type '%s' and "
@@ -4269,6 +4283,8 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
             chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO;
         } else if (qemuDomainIsVirt(def)) {
             chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM;
+        } else if (ARCH_IS_S390(def->os.arch)) {
+            chr->targetType = VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP;
         }
     }
 
@@ -4291,6 +4307,9 @@ qemuDomainChrDefPostParse(virDomainChrDefPtr chr,
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
             chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_PL011;
             break;
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
+            chr->targetModel = VIR_DOMAIN_CHR_SERIAL_TARGET_MODEL_SCLPCONSOLE;
+            break;
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
             /* Nothing to do */
@@ -5214,6 +5233,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driver,
                 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_ISA:
                 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_PCI:
                 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
+                case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
                 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
                 case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
                     /* Nothing to do */
index db9656a3a5dfe203b3374cf9c2f23d06d36d99c3..a40cdb399310af7f9fc22471bd4c5bc4b2a9795c 100644 (file)
@@ -785,6 +785,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_USB:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SPAPR_VIO:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SYSTEM:
+        case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_SCLP:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_NONE:
         case VIR_DOMAIN_CHR_SERIAL_TARGET_TYPE_LAST:
             return 0;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.args
new file mode 100644 (file)
index 0000000..346dcd1
--- /dev/null
@@ -0,0 +1,24 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name QEMUGuest1 \
+-S \
+-M s390-ccw-virtio \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-boot c \
+-chardev pty,id=charserial0 \
+-device sclpconsole,chardev=charserial0,id=serial0 \
+-chardev pty,id=charserial1 \
+-device sclplmconsole,chardev=charserial1,id=serial1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-2.xml
new file mode 100644 (file)
index 0000000..b6eb377
--- /dev/null
@@ -0,0 +1,19 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <serial type='pty'/>
+    <serial type='pty'>
+      <target type='sclp-serial'>
+        <model name='sclplmconsole'/>
+      </target>
+    </serial>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.args
new file mode 100644 (file)
index 0000000..c405fb5
--- /dev/null
@@ -0,0 +1,25 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-s390x \
+-name QEMUGuest1 \
+-S \
+-M s390-ccw-virtio \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-boot c \
+-device virtio-serial-ccw,id=virtio-serial0,devno=fe.0.0000 \
+-chardev pty,id=charserial0 \
+-device sclpconsole,chardev=charserial0,id=serial0 \
+-chardev pty,id=charconsole1 \
+-device virtconsole,chardev=charconsole1,id=console1
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial-console.xml
new file mode 100644 (file)
index 0000000..c841f1f
--- /dev/null
@@ -0,0 +1,15 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <serial type='pty'/>
+    <console type='pty'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.args
new file mode 100644 (file)
index 0000000..20968f7
--- /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-system-s390x \
+-name QEMUGuest1 \
+-S \
+-M s390-ccw-virtio \
+-m 214 \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-nographic \
+-nodefconfig \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-QEMUGuest1/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-boot c \
+-chardev pty,id=charserial0 \
+-device sclpconsole,chardev=charserial0,id=serial0
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml b/tests/qemuxml2argvdata/qemuxml2argv-s390-serial.xml
new file mode 100644 (file)
index 0000000..55b45ba
--- /dev/null
@@ -0,0 +1,14 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
+  </os>
+  <devices>
+    <emulator>/usr/bin/qemu-system-s390x</emulator>
+    <serial type='pty'/>
+    <memballoon model='none'/>
+  </devices>
+</domain>
index 593057653d2bca95fe8e5f72b9ddfb58a39df720..d9ed8af790ad221450c017116ca73aa3381c14c7 100644 (file)
@@ -2051,6 +2051,22 @@ mymain(void)
             QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_VIRTIO_CCW,
             QEMU_CAPS_VIRTIO_S390);
+    DO_TEST("s390-serial",
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_CCW,
+            QEMU_CAPS_VIRTIO_S390,
+            QEMU_CAPS_DEVICE_SCLPCONSOLE);
+    DO_TEST("s390-serial-2",
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_CCW,
+            QEMU_CAPS_VIRTIO_S390,
+            QEMU_CAPS_DEVICE_SCLPCONSOLE,
+            QEMU_CAPS_DEVICE_SCLPLMCONSOLE);
+    DO_TEST("s390-serial-console",
+            QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_VIRTIO_CCW,
+            QEMU_CAPS_VIRTIO_S390,
+            QEMU_CAPS_DEVICE_SCLPCONSOLE);
 
     DO_TEST("ppc-dtb",
             QEMU_CAPS_KVM,
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-2.xml
new file mode 100644 (file)
index 0000000..bb9ca30
--- /dev/null
@@ -0,0 +1,33 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-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-system-s390x</emulator>
+    <serial type='pty'>
+      <target type='sclp-serial' port='0'>
+        <model name='sclpconsole'/>
+      </target>
+    </serial>
+    <serial type='pty'>
+      <target type='sclp-serial' port='1'>
+        <model name='sclplmconsole'/>
+      </target>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <memballoon model='none'/>
+    <panic model='s390'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial-console.xml
new file mode 100644 (file)
index 0000000..db3023b
--- /dev/null
@@ -0,0 +1,34 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-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-system-s390x</emulator>
+    <controller type='virtio-serial' index='0'>
+      <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+    </controller>
+    <serial type='pty'>
+      <target type='sclp-serial' port='0'>
+        <model name='sclpconsole'/>
+      </target>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <console type='pty'>
+      <target type='virtio' port='0'/>
+    </console>
+    <memballoon model='none'/>
+    <panic model='s390'/>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-s390-serial.xml
new file mode 100644 (file)
index 0000000..9c9b4dd
--- /dev/null
@@ -0,0 +1,28 @@
+<domain type='qemu'>
+  <name>QEMUGuest1</name>
+  <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>219100</memory>
+  <currentMemory unit='KiB'>219100</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='s390x' machine='s390-ccw-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-system-s390x</emulator>
+    <serial type='pty'>
+      <target type='sclp-serial' port='0'>
+        <model name='sclpconsole'/>
+      </target>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <memballoon model='none'/>
+    <panic model='s390'/>
+  </devices>
+</domain>
index 32384534048114fceacf81c4545bea15c407d16e..146a67ee27debfc164410bc03fcb4e37de4bb250 100644 (file)
@@ -1157,6 +1157,12 @@ mymain(void)
             QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
     DO_TEST("s390-panic-no-address",
             QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST("s390-serial",
+            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST("s390-serial-2",
+            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+    DO_TEST("s390-serial-console",
+            QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
 
     DO_TEST("pcihole64", NONE);
     DO_TEST("pcihole64-gib", NONE);