Bug 1487499

Summary: Libvirt tries to create a wrong QEMU device for the <parallel> XML tag on s390x
Product: Red Hat Enterprise Linux 7 Reporter: Thomas Huth <thuth>
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 7.5CC: cohuck, david, dzheng, gsun, mprivozn, ptoscano, rbalakri
Target Milestone: rcKeywords: Upstream
Target Release: ---   
Hardware: s390x   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-3.8.0-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 10:55:31 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Thomas Huth 2017-09-01 05:51:13 UTC
Description of problem:
When adding the <parallel> tag to the XML definition of a KVM guest on s390x, libvirt translates this into a "isa-parallel" device when starting QEMU. Since this device does not exist in the s390x version of QEMU, the guest can not be launched.

Version-Release number of selected component (if applicable):
libvirt-3.2.0-20.el7a.s390x
qemu-kvm-2.9.0-22.el7a.s390x

How reproducible:
100%

Steps to Reproduce:
1. Install qemu-kvm and libvirt on a s390x system
2. Create a guest definition that contains a <parallel> tag, for example:

<domain type="kvm">
  <name>guest</name>
  <memory>786432</memory>
  <vcpu>1</vcpu>
  <os>
    <type arch="s390x" machine="s390-ccw-virtio">hvm</type>
    <boot dev="hd"/>
  </os>
  <clock offset="utc"/>
  <devices>
    <emulator>/usr/libexec/qemu-kvm</emulator>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"/>
      <source file="/var/lib/libvirt/images/guest.qcow2"/>
      <target dev="sda" bus="scsi"/>
    </disk>
    <interface type="bridge">
      <source bridge="virbr0"/>
      <model type="virtio"/>
    </interface>
    <parallel type='pty'/>
    <console type="pty"/>
  </devices>
</domain>

3. Start the guest with "virsh start guest"

Actual results:
error: Failed to start domain guest
error: internal error: qemu unexpectedly closed the monitor: 2017-09-01T05:35:23.648470Z qemu-kvm: -chardev pty,id=charparallel0: char device redirected to /dev/pts/1 (label charparallel0)
2017-09-01T05:35:23.648555Z qemu-kvm: -chardev pty,id=charconsole0: char device redirected to /dev/pts/2 (label charconsole0)
2017-09-01T05:35:23.667744Z qemu-kvm: -device isa-parallel,chardev=charparallel0,id=parallel0: 'isa-parallel' is not a valid device model name

Expected results:
Since there are no parallel ports on s390x, I'd rather expect libvirt to refuse the <parallel> tag right from the start here instead of trying to run QEMU with a "isa-parallel" device.

Additional info:
This is slightly related to bug 1449265 (where the same problems occurs with the <serial> tag).

Comment 1 Thomas Huth 2017-09-01 18:32:36 UTC
FWIW: The same problem exists on ppc64, too.

Comment 2 Michal Privoznik 2017-09-21 11:08:46 UTC
I've just pushed the patches upstream:

commit cf4acafe8b03595163e0e06f1e906f9a46d852fd
Author:     Pino Toscano <ptoscano>
AuthorDate: Thu Sep 7 14:19:40 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Sep 21 13:05:14 2017 +0200

    qemu: reject parallel ports for pseries machines
    
    They are simply not supported on that machine type.
    
    Partially-resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1487499
    
    Signed-off-by: Pino Toscano <ptoscano>

commit 02b1908de6e8303e325336277fd9cebba5d6d50d
Author:     Pino Toscano <ptoscano>
AuthorDate: Thu Sep 7 14:19:39 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Sep 21 13:05:14 2017 +0200

    qemu: reject parallel ports for s390 archs
    
    They are simply not supported on those architectures.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1487499
    
    Signed-off-by: Pino Toscano <ptoscano>

commit 2c79a2b26ccac60042fa355c59882520e65f3f8b
Author:     Pino Toscano <ptoscano>
AuthorDate: Thu Sep 7 14:19:38 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Sep 21 13:05:14 2017 +0200

    qemu: pass the virDomainDef to qemuDomainChrDefValidate
    
    This will be used to improve the validation for this type of devices.
    
    The former @def parameter is renamed to @dev, leaving @def for the
    virDomainDef (following the style used elsewhere).
    
    Signed-off-by: Pino Toscano <ptoscano>

commit 85afb126ad235e9b22d570751fd5eb0aed1eaabe
Author:     Pino Toscano <ptoscano>
AuthorDate: Thu Sep 7 14:19:37 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Sep 21 13:05:14 2017 +0200

    tests: qemuxml2argv: fail also on unexpected pass
    
    If a test expects either a parse error or a failure but then there is
    neither a parse error nor a failure, then properly mark the test as
    failing, instead of failing later on (e.g. trying to open a
    non-existing .args file).
    
    Signed-off-by: Pino Toscano <ptoscano>

commit 4673999d0f725844aebebaf161eefaf6a7e54e17
Author:     Pino Toscano <ptoscano>
AuthorDate: Thu Sep 7 14:19:36 2017 +0200
Commit:     Michal Privoznik <mprivozn>
CommitDate: Thu Sep 21 13:05:14 2017 +0200

    tests: qemuxml2argv: fix expected type for usb-bus-missing
    
    The guest of usb-bus-missing does not cause a parse error, but a
    validation issue -- hence, switch from DO_TEST_PARSE_ERROR to
    DO_TEST_FAILURE.
    
    Fixes commit b003b9781b6ae633cfe4fdf6b9620ca246fa2432.
    
    Signed-off-by: Pino Toscano <ptoscano>

v3.7.0-145-gcf4acafe8

Comment 4 Dan Zheng 2017-12-15 07:57:19 UTC
Test packages:
libvirt-3.9.0-5.el7.s390x
qemu-kvm-ma-2.10.0-11.el7.s390x


Add <parallel type='pty'/> to the guest and save.
# virsh edit vm1
error: unsupported configuration: parallel ports are not supported
Failed. Try again? [y,n,i,f,?]:

Comment 8 errata-xmlrpc 2018-04-10 10:55:31 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704