[libvirt PATCH v2 3/6] qemu: support interface <teaming> functionality

Daniel P. Berrangé berrange at redhat.com
Tue Jan 28 15:06:50 UTC 2020

On Fri, Jan 24, 2020 at 10:39:18AM -0500, Laine Stump wrote:
> The QEMU driver uses the <teaming type='persistent|transient'
> persistent='blah'/> element to setup a "failover" pair of devices -
> the persistent device must be a virtio emulated NIC, with the only
> extra configuration being the addition of ",failover=on" to the device
> commandline, and the transient device must be a hostdev NIC
> (<interface type='hostdev'> or <interface type='network'> with a
> network that is a pool of SRIOV VFs) where the extra configuration is
> the addition of ",failover_pair_id=$aliasOfVirtio" to the device
> commandline. These new options are supported in QEMU 4.2.0 and later.
> Extra qemu-specific validation is added to ensure that the device
> type/model is appropriate and that the qemu binary supports these
> commandline options.
> The result of this will be:
> 1) The virtio device presented to the guest will have an extra bit set
> in its PCI capabilities indicating that it can be used as a failover
> backup device. The virtio guest driver will need to be equipped to do
> something with this information. Unfortunately there is no way for
> libvirt to learn whether or not the guest driver supports failover -
> if it doesn't then the extra PCI capability will be ignored and the
> guest OS will just see two independent devices. (NB: the current
> virtio guest driver also requires that the MAC addresses of the two
> NICs match in order to pair them into a bond).
> 2) When a migration is requested, QEMu will automatically unplug the
> transient/hostdev NIC from the guest on the source host before
> starting migration, and automatically re-plug a similar device after
> restarting the guest CPUs on the destination host. While the transient
> NIC is unplugged, all network traffic will go through the
> persistent/virtio device, but when the hostdev NIC is plugged in, it
> will get all the traffic. This means that in normal circumstances the
> guest gets the performance advantage of vfio-assigned "real hardware"
> networking, but it can still be migrated with the only downside being
> a performance penalty (due to using an emulated NIC) during the
> migration.
> Signed-off-by: Laine Stump <laine at redhat.com>
> ---
>  src/qemu/qemu_command.c                       |  9 +++++
>  src/qemu/qemu_domain.c                        | 36 +++++++++++++++--
>  .../qemuxml2argvdata/net-virtio-teaming.args  | 40 +++++++++++++++++++
>  tests/qemuxml2argvtest.c                      |  4 ++
>  4 files changed, 86 insertions(+), 3 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/net-virtio-teaming.args

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>

|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

More information about the libvir-list mailing list