404507
From 07ed5aa86d223b1e99ef716429be60c1823ce0f5 Mon Sep 17 00:00:00 2001
404507
Message-Id: <07ed5aa86d223b1e99ef716429be60c1823ce0f5@dist-git>
404507
From: Andrea Bolognani <abologna@redhat.com>
404507
Date: Wed, 29 Nov 2017 16:22:55 +0100
404507
Subject: [PATCH] docs: Improve documentation for serial consoles
404507
404507
Our current documentation is missing some information and doesn't
404507
do a great job at explaining how the <serial> and <console> elements
404507
are connected. Let's try to fix that.
404507
404507
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
404507
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
404507
(cherry picked from commit 4567cecb372c48095fce23ce3040d1c687cc3640)
404507
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1449265
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1511421
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512929
404507
https://bugzilla.redhat.com/show_bug.cgi?id=1512934
404507
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
404507
---
404507
 docs/formatdomain.html.in | 224 +++++++++++++++++++++++++++++++++-------------
404507
 1 file changed, 164 insertions(+), 60 deletions(-)
404507
404507
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
404507
index 4f28dce355..f57a124056 100644
404507
--- a/docs/formatdomain.html.in
404507
+++ b/docs/formatdomain.html.in
404507
@@ -6434,77 +6434,68 @@ qemu-kvm -net nic,model=? /dev/null
404507
 
404507
 ...
404507
 <devices>
404507
+  <!-- Serial port -->
404507
   <serial type='pty'>
404507
     <source path='/dev/pts/3'/>
404507
     <target port='0'/>
404507
   </serial>
404507
 </devices>
404507
+...
404507
+
404507
+
404507
+...
404507
+<devices>
404507
+  <!-- USB serial port -->
404507
+  <serial type='pty'>
404507
+    <target type='usb-serial' port='0'/>
404507
+    <address type='usb' bus='0' port='1'/>
404507
+  </serial>
404507
+</devices>
404507
 ...
404507
 
404507
     

404507
-      target can have a port attribute, which
404507
-      specifies the port number. Ports are numbered starting from 0. There are
404507
-      usually 0, 1 or 2 serial ports. There is also an optional
404507
-      type attribute since 1.0.2
404507
-      which has three choices for its value, one is isa-serial,
404507
-      then usb-serial and last one is pci-serial.
404507
-      If type is missing, isa-serial will be used by
404507
-      default. For usb-serial an optional sub-element
404507
-      <address/> with type='usb' can tie the
404507
-      device to a particular controller, documented above.
404507
-      Similarly, pci-serial can be used to attach the device to
404507
-      the pci bus (since 1.2.16). Again, it has
404507
-      optional sub-element <address/> with
404507
-      type='pci' to select desired location on the PCI bus.
404507
+      The target element can have an optional port
404507
+      attribute, which specifies the port number (starting from 0), and an
404507
+      optional type attribute: valid values are,
404507
+      since 1.0.2, isa-serial (usable
404507
+      with x86 guests), usb-serial (usable whenever USB support
404507
+      is available) and pci-serial (usable whenever PCI support
404507
+      is available).
404507
+    

404507
+
404507
+    

404507
+      If any of the attributes is not specified by the user, libvirt will
404507
+      choose a value suitable for most users.
404507
+    

404507
+
404507
+    

404507
+      All of the target types support configuring the guest-visible device
404507
+      address as documented above; more
404507
+      specifically, acceptable address types are isa (for
404507
+      isa-serial), usb (for usb-serial)
404507
+      and pci (for pci-serial).
404507
+    

404507
+
404507
+    

404507
+      For the relationship between serial ports and consoles,
404507
+      see below.
404507
     

404507
 
404507
     
Console
404507
 
404507
-    

404507
-      The console element is used to represent interactive consoles. Depending
404507
-      on the type of guest in use, the consoles might be paravirtualized devices,
404507
-      or they might be a clone of a serial device, according to the following
404507
-      rules:
404507
-    

404507
-
404507
-    
    404507
    -      
  • If no targetType attribute is set, then the default
  • 404507
    -        device type is according to the hypervisor's rules. The default
    404507
    -        type will be added when re-querying the XML fed into libvirt.
    404507
    -        For fully virtualized guests, the default device type will usually
    404507
    -        be a serial port.
    404507
    -      
  • If the targetType attribute is serial,
  • 404507
    -        then if no <serial> element exists, the console
    404507
    -        element will be copied to the serial element. If a <serial>
    404507
    -        element does already exist, the console element will be ignored.
    404507
    -      
  • If the targetType attribute is not serial,
  • 404507
    -        it will be treated normally.
    404507
    -      
  • Only the first console element may use a targetType
  • 404507
    -        of serial. Secondary consoles must all be paravirtualized.
    404507
    -      
    404507
    -      
  • On S390, the console element may use a
  • 404507
    -        targetType of sclp or sclplm
    404507
    -        (line mode). SCLP is the native console type for S390. There's no
    404507
    -        controller associated to SCLP consoles.
    404507
    -        Since 1.0.2
    404507
    -      
    404507
    -    
    404507
    -
    404507
    -    

    404507
    -      A virtio console device is exposed in the
    404507
    -      guest as /dev/hvc[0-7] (for more information, see
    404507
    -      http://fedoraproject.org/wiki/Features/VirtioSerial)
    404507
    -      Since 0.8.3
    404507
    -    

    404507
    -
    404507
     
    404507
     ...
    404507
     <devices>
    404507
    +  <!-- Serial console -->
    404507
       <console type='pty'>
    404507
    -    <source path='/dev/pts/4'/>
    404507
    -    <target port='0'/>
    404507
    +    <source path='/dev/pts/2'/>
    404507
    +    <target type='serial' port='0'/>
    404507
       </console>
    404507
    +</devices>
    404507
    +...
    404507
     
    404507
    +
    404507
    +...
    404507
       <!-- KVM virtio console -->
    404507
       <console type='pty'>
    404507
         <source path='/dev/pts/5'/>
    404507
    @@ -6513,21 +6504,134 @@ qemu-kvm -net nic,model=? /dev/null
    404507
     </devices>
    404507
     ...
    404507
     
    404507
    +    

    404507
    +      The console element is used to represent interactive
    404507
    +      serial consoles. Depending on the type of guest in use and the specifics
    404507
    +      of the configuration, the console element might represent
    404507
    +      the same device as an existing serial element or a separate
    404507
    +      device.
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      A target subelement is supported and works the same
    404507
    +      way as with the serial element
    404507
    +      (see above for details).
    404507
    +      Valid values for the type attribute are:
    404507
    +      serial (described below);
    404507
    +      virtio (usable whenever VirtIO support is available);
    404507
    +      xen, lxc, uml and
    404507
    +      openvz (available when the corresponding hypervisor is in
    404507
    +      use); sclp and sclplm (usable for s390 and
    404507
    +      s390x QEMU guests).
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      Of the target types listed above, serial is special in
    404507
    +      that it doesn't represents a separate device, but rather the same
    404507
    +      device as the first serial element. Due to this, there can
    404507
    +      only be a single console element with target type
    404507
    +      serial per guest.
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      Virtio consoles are usually accessible as /dev/hvc[0-7]
    404507
    +      from inside the guest; for more information, see
    404507
    +      http://fedoraproject.org/wiki/Features/VirtioSerial.
    404507
    +      Since 0.8.3
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      For the relationship between serial ports and consoles,
    404507
    +      see below.
    404507
    +    

    404507
    +
    404507
    +    
    Relationship between serial ports and consoles
    404507
    +
    404507
    +    

    404507
    +      Due to hystorical reasons, the serial and
    404507
    +      console elements have partially overlapping scopes.
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      In general, both elements are used to configure one or more serial
    404507
    +      consoles to be used for interacting with the guest. The main difference
    404507
    +      between the two is that serial is used for emulated,
    404507
    +      usually native, serial consoles, whereas console is used
    404507
    +      for paravirtualized ones.
    404507
    +    

    404507
    +
    404507
    +    

    404507
    +      Both emulated and paravirtualized serial consoles have advantages and
    404507
    +      disadvantages:
    404507
    +    

    404507
    +
    404507
    +    
      404507
      +      
    • 404507
      +        emulated serial consoles are usually initialized much earlier than
      404507
      +        paravirtualized ones, so they can be used to control the bootloader
      404507
      +        and display both firmware and early boot messages;
      404507
      +      
      404507
      +      
    • 404507
      +        on several platforms, there can only be a single emulated serial
      404507
      +        console per guest but paravirtualized consoles don't suffer from the
      404507
      +        same limitation.
      404507
      +      
      404507
      +    
      404507
      +
      404507
      +    

      404507
      +      A configuration such as:
      404507
      +    

      404507
      +
      404507
       
      404507
       ...
      404507
      -<devices>
      404507
      -  <!-- KVM S390 sclp console -->
      404507
      +</devices>
      404507
         <console type='pty'>
      404507
      -    <source path='/dev/pts/1'/>
      404507
      -    <target type='sclp' port='0'/>
      404507
      +    <target type='serial'/>
      404507
      +  </console>
      404507
      +  <console type='pty'>
      404507
      +    <target type='virtio'/>
      404507
         </console>
      404507
       </devices>
      404507
       ...
      404507
       
      404507
           

      404507
      -      If the console is presented as a serial port, the target
      404507
      -      element has the same attributes as for a serial port. There is usually
      404507
      -      only 1 console.
      404507
      +      will work on any platform and will result in one emulated serial console
      404507
      +      for early boot logging / interactive / recovery use, and one
      404507
      +      paravirtualized serial console to be used eg. as a side channel. Most
      404507
      +      people will be fine with having just the first console
      404507
      +      element in their configuration.
      404507
      +    

      404507
      +
      404507
      +    

      404507
      +      Note that, due to the compatibility concerns mentioned earlier, all the
      404507
      +      following configurations:
      404507
      +    

      404507
      +
      404507
      +
      404507
      +...
      404507
      +</devices>
      404507
      +  <serial type='pty'/>
      404507
      +</devices>
      404507
      +...
      404507
      +
      404507
      +
      404507
      +...
      404507
      +</devices>
      404507
      +  <console type='pty'/>
      404507
      +</devices>
      404507
      +...
      404507
      +
      404507
      +
      404507
      +...
      404507
      +</devices>
      404507
      +  <serial type='pty'/>
      404507
      +  <console type='pty'/>
      404507
      +</devices>
      404507
      +...
      404507
      +
      404507
      +    

      404507
      +      will be treated the same and will result in a single emulated serial
      404507
      +      console being available to the guest.
      404507
           

      404507
       
      404507
           
      Channel
      404507
      -- 
      404507
      2.15.1
      404507