a41c76
From a7ad591f6a6b86b24b1ed030cc9b1ca5b3bf4346 Mon Sep 17 00:00:00 2001
a41c76
Message-Id: <a7ad591f6a6b86b24b1ed030cc9b1ca5b3bf4346@dist-git>
a41c76
From: Laine Stump <laine@redhat.com>
a41c76
Date: Thu, 30 Jan 2020 14:12:44 -0500
a41c76
Subject: [PATCH] docs: document <interface> subelement <teaming>
a41c76
MIME-Version: 1.0
a41c76
Content-Type: text/plain; charset=UTF-8
a41c76
Content-Transfer-Encoding: 8bit
a41c76
a41c76
Signed-off-by: Laine Stump <laine@redhat.com>
a41c76
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
a41c76
(cherry picked from commit f0f34056ab26eaa9f903a51cd1fa155088fd640f)
a41c76
a41c76
Conflicts:
a41c76
   docs/news.xml - feature is in release 6.1.0 upstream, but
a41c76
      that release doesn't exist downstream.
a41c76
a41c76
https://bugzilla.redhat.com/1693587
a41c76
Signed-off-by: Laine Stump <laine@redhat.com>
a41c76
Message-Id: <20200130191244.24174-7-laine@redhat.com>
a41c76
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
a41c76
---
a41c76
 docs/formatdomain.html.in | 101 ++++++++++++++++++++++++++++++++++++++
a41c76
 docs/news.xml             |  28 +++++++++++
a41c76
 2 files changed, 129 insertions(+)
a41c76
a41c76
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
a41c76
index 4db9c292b7..98a811bd09 100644
a41c76
--- a/docs/formatdomain.html.in
a41c76
+++ b/docs/formatdomain.html.in
a41c76
@@ -5873,6 +5873,107 @@
a41c76
 </devices>
a41c76
 ...
a41c76
 
a41c76
+    
Teaming a virtio/hostdev NIC pair
a41c76
+
a41c76
+    

a41c76
+      Since 6.1.0 (QEMU and KVM only, requires
a41c76
+        QEMU 4.2.0 or newer axnd a guest virtio-net driver supporting
a41c76
+        the "failover" feature, such as the one included in Linux
a41c76
+        kernel 4.18 and newer)
a41c76
+      
a41c76
+      The <teaming> element of two interfaces can
a41c76
+      be used to connect them as a team/bond device in the guest
a41c76
+      (assuming proper support in the hypervisor and the guest
a41c76
+      network driver).
a41c76
+    

a41c76
+
a41c76
+
a41c76
+...
a41c76
+<devices>
a41c76
+  <interface type='network'>
a41c76
+    <source network='mybridge'/>
a41c76
+    <mac address='00:11:22:33:44:55'/>
a41c76
+    <model type='virtio'/>
a41c76
+    <teaming type='persistent'/>
a41c76
+    <alias name='ua-backup0'/>
a41c76
+  </interface>
a41c76
+  <interface type='network'>
a41c76
+    <source network='hostdev-pool'/>
a41c76
+    <mac address='00:11:22:33:44:55'/>
a41c76
+    <model type='virtio'/>
a41c76
+    <teaming type='transient' persistent='ua-backup0'/>
a41c76
+  </interface>
a41c76
+</devices>
a41c76
+...
a41c76
+
a41c76
+    

a41c76
+      The <teaming> element required
a41c76
+      attribute type will be set to
a41c76
+      either "persistent" to indicate a device that
a41c76
+      should always be present in the domain,
a41c76
+      or "transient" to indicate a device that may
a41c76
+      periodically be removed, then later re-added to the domain. When
a41c76
+      type="transient", there should be a second attribute
a41c76
+      to <teaming> called "persistent"
a41c76
+      - this attribute should be set to the alias name of the other
a41c76
+      device in the pair (the one that has <teaming
a41c76
+      type="persistent'/>).
a41c76
+    

a41c76
+    

a41c76
+      In the particular case of QEMU,
a41c76
+      libvirt's <teaming> element is used to setup
a41c76
+      a virtio-net "failover" device pair. For this setup, the
a41c76
+      persistent device must be an interface with <model
a41c76
+      type="virtio"/>, and the transient device must
a41c76
+      be <interface type='hostdev'/>
a41c76
+      (or <interface type='network'/> where the
a41c76
+      referenced network defines a pool of SRIOV VFs). The guest will
a41c76
+      then have a simple network team/bond device made of the virtio
a41c76
+      NIC + hostdev NIC pair. In this configuration, the
a41c76
+      higher-performing hostdev NIC will normally be preferred for all
a41c76
+      network traffic, but when the domain is migrated, QEMU will
a41c76
+      automatically unplug the VF from the guest, and then hotplug a
a41c76
+      similar device once migration is completed; while migration is
a41c76
+      taking place, network traffic will use the virtio NIC. (Of
a41c76
+      course the emulated virtio NIC and the hostdev NIC must be
a41c76
+      connected to the same subnet for bonding to work properly).
a41c76
+    

a41c76
+    

a41c76
+      NB1: Since you must know the alias name of the virtio NIC when
a41c76
+      configuring the hostdev NIC, it will need to be manually set in
a41c76
+      the virtio NIC's configuration (as with all other manually set
a41c76
+      alias names, this means it must start with "ua-").
a41c76
+    

a41c76
+    

a41c76
+      NB2: Currently the only implementation of the guest OS
a41c76
+      virtio-net driver supporting virtio-net failover requires that
a41c76
+      the MAC addresses of the virtio and hostdev NIC must
a41c76
+      match. Since that may not always be a requirement in the future,
a41c76
+      libvirt doesn't enforce this limitation - it is up to the
a41c76
+      person/management application that is creating the configuration
a41c76
+      to assure the MAC addresses of the two devices match.
a41c76
+    

a41c76
+    

a41c76
+      NB3: Since the PCI addresses of the SRIOV VFs on the hosts that
a41c76
+      are the source and destination of the migration will almost
a41c76
+      certainly be different, either higher level management software
a41c76
+      will need to modify the <source> of the
a41c76
+      hostdev NIC (<interface type='hostdev'>) at
a41c76
+      the start of migration, or (a simpler solution) the
a41c76
+      configuration will need to use a libvirt "hostdev" virtual
a41c76
+      network that maintains a pool of such devices, as is implied in
a41c76
+      the example's use of the libvirt network named "hostdev-pool" -
a41c76
+      as long as the hostdev network pools on both hosts have the same
a41c76
+      name, libvirt itself will take care of allocating an appropriate
a41c76
+      device on both ends of the migration. Similarly the XML for the
a41c76
+      virtio interface must also either work correctly unmodified on
a41c76
+      both the source and destination of the migration (e.g. by
a41c76
+      connecting to the same bridge device on both hosts, or by using
a41c76
+      the same virtual network), or the management software must
a41c76
+      properly modify the interface XML during migration so that the
a41c76
+      virtio device remains connected to the same network segment
a41c76
+      before and after migration.
a41c76
+    

a41c76
 
a41c76
     
Multicast tunnel
a41c76
 
a41c76
diff --git a/docs/news.xml b/docs/news.xml
a41c76
index 731f010297..408ffc8518 100644
a41c76
--- a/docs/news.xml
a41c76
+++ b/docs/news.xml
a41c76
@@ -65,6 +65,34 @@
a41c76
       </change>
a41c76
     </section>
a41c76
     <section title="New features">
a41c76
+      <change>
a41c76
+        <summary>
a41c76
+          support for virtio+hostdev NIC <teaming>
a41c76
+        </summary>
a41c76
+        <description>
a41c76
+          QEMU 4.2.0 and later, combined with a sufficiently recent
a41c76
+          guest virtio-net driver (e.g. the driver included in Linux
a41c76
+          kernel 4.18 and later), supports setting up a simple network
a41c76
+          bond device comprised of one virtio emulated NIC and one
a41c76
+          hostdev NIC (which must be an SRIOV VF). (in QEMU, this is
a41c76
+          known as the "virtio failover" feature). The allure of this
a41c76
+          setup is that the bond will always favor the hostdev device,
a41c76
+          providing better performance, until the guest is migrated -
a41c76
+          at that time QEMU will automatically unplug the hostdev NIC
a41c76
+          and the bond will send all traffic via the virtio NIC until
a41c76
+          migration is completed, then QEMU on the destination side
a41c76
+          will hotplug a new hostdev NIC and the bond will switch back
a41c76
+          to using the hostdev for network traffic. The result is that
a41c76
+          guests desiring the extra performance of a hostdev NIC are
a41c76
+          now migratable without network downtime (performance is just
a41c76
+          degraded during migration) and without requiring a
a41c76
+          complicated bonding configuration in the guest OS network
a41c76
+          config and complicated unplug/replug logic in the management
a41c76
+          application on the host - it can instead all be accomplished
a41c76
+          in libvirt with the interface <teaming> subelement
a41c76
+          "type" and "persistent" attributes.
a41c76
+        </description>
a41c76
+      </change>
a41c76
       <change>
a41c76
         <summary>
a41c76
           new PCI hostdev address type: unassigned
a41c76
-- 
a41c76
2.25.0
a41c76