Bug 1770725

Summary: Target model ignored on <console>
Product: Red Hat Enterprise Linux 8 Reporter: smitterl
Component: libvirtAssignee: Andrea Bolognani <abologna>
Status: CLOSED CURRENTRELEASE QA Contact: jiyan <jiyan>
Severity: low Docs Contact:
Priority: unspecified    
Version: 8.1CC: dyuan, dzheng, lmen, rbalakri, smitterl, xuzhang, yalzhang
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-02-11 16:34:03 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 smitterl 2019-11-11 09:09:30 UTC
Description of problem:
Target model for <console> is ignored.


Version-Release number of selected component (if applicable):
libvirt-5.6.0-7.module+el8.1.1+4483+2f45aaa2.x86_64

How reproducible:
Always

Steps to Reproduce:
1. virsh edit x86_64 machine to only character device
<console type='pty'>
 <target port='0'>
  <model name='usb-serial'/>
 </target>
</console>
2. Save changes
3. virsh dumpxml

Actual results:
The model is ignored; generated xml is
<serial type='pty'>
 <target type='isa-serial' port='0'>
  <model name='isa-serial'/>
 </target>
</serial>
<console type='pty'>
 <target type='serial' port='0'/>
</console>


Expected results:
A) As documentation says "In each of these directives, the top-level element name (parallel, serial, console, channel) describes how the device is presented to the guest. The guest interface is configured by the target element." I expected the shown definition to be equivalent with 
<serial type='pty'>
 <target type='usb-serial' port='0'>
  <model name='usb-serial'/>
 </target>
</serial>
(doc https://libvirt.org/formatdomain.html#elementsConsole)
B) Alternatively, I'd expect a validation error when target/model is used on console (instead of serial).

Comment 2 Andrea Bolognani 2020-02-11 14:46:58 UTC
Unfortunately we can't really make this scenario work the way you'd
expect, so the best I can offer is a documentation update.

Patch posted upstream:

  https://www.redhat.com/archives/libvir-list/2020-February/msg00467.html

More information in the commit message.

Comment 3 Andrea Bolognani 2020-02-11 16:34:03 UTC
Merged upstream.

  commit c4a78d00f8d00ef4ab84c3110ffb6975ed680554
  Author: Andrea Bolognani <abologna>
  Date:   Tue Feb 11 15:37:05 2020 +0100

    docs: Improve documentation for <serial> and <console>

    Users expect to be able to configure the <console> element and see
    that configuration reflected into the <serial> element or at least
    sticking, however due to our crazy back-compat code that doesn't
    always happen.

    There's really not much we can do to make this kind of corner cases
    work as the user would expect, especially not without introducing
    additional complexity in a part of libvirt that already has more
    than a fair share of it; we can, however, improve the documentation
    so that it will nudge said users in the right direction.

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

    Signed-off-by: Andrea Bolognani <abologna>
    Reviewed-by: Ján Tomko <jtomko>

  v6.0.0-374-gc4a78d00f8

Since we usually don't backport documentation changes, and the code
itself is already working as well as we can reasonably expect it to,
I'll mark this as CLOSED CURRENTRELEASE.