2
0

virtio-net-failover.rst 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ======================================
  2. QEMU virtio-net standby (net_failover)
  3. ======================================
  4. This document explains the setup and usage of virtio-net standby feature which
  5. is used to create a net_failover pair of devices.
  6. The general idea is that we have a pair of devices, a (vfio-)pci and a
  7. virtio-net device. Before migration the vfio device is unplugged and data flows
  8. through the virtio-net device, on the target side another vfio-pci device is
  9. plugged in to take over the data-path. In the guest the net_failover kernel
  10. module will pair net devices with the same MAC address.
  11. The two devices are called primary and standby device. The fast hardware based
  12. networking device is called the primary device and the virtio-net device is the
  13. standby device.
  14. Restrictions
  15. ------------
  16. Currently only PCIe devices are allowed as primary devices, this restriction
  17. can be lifted in the future with enhanced QEMU support. Also, only networking
  18. devices are allowed as primary device. The user needs to ensure that primary
  19. and standby devices are not plugged into the same PCIe slot.
  20. Usecase
  21. -------
  22. Virtio-net standby allows easy migration while using a passed-through fast
  23. networking device by falling back to a virtio-net device for the duration of
  24. the migration. It is like a simple version of a bond, the difference is that it
  25. requires no configuration in the guest. When a guest is live-migrated to
  26. another host QEMU will unplug the primary device via the PCIe based hotplug
  27. handler and traffic will go through the virtio-net device. On the target
  28. system the primary device will be automatically plugged back and the
  29. net_failover module registers it again as the primary device.
  30. Usage
  31. -----
  32. The primary device can be hotplugged or be part of the startup configuration
  33. -device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:54:00:6f:55:cc, \
  34. bus=root2,failover=on
  35. With the parameter failover=on the VIRTIO_NET_F_STANDBY feature will be enabled.
  36. -device vfio-pci,host=5e:00.2,id=hostdev0,bus=root1,failover_pair_id=net1
  37. failover_pair_id references the id of the virtio-net standby device. This
  38. is only for pairing the devices within QEMU. The guest kernel module
  39. net_failover will match devices with identical MAC addresses.
  40. Hotplug
  41. -------
  42. Both primary and standby device can be hotplugged via the QEMU monitor. Note
  43. that if the virtio-net device is plugged first a warning will be issued that it
  44. couldn't find the primary device.
  45. Migration
  46. ---------
  47. A new migration state wait-unplug was added for this feature. If failover primary
  48. devices are present in the configuration, migration will go into this state.
  49. It will wait until the device unplug is completed in the guest and then move into
  50. active state. On the target system the primary devices will be automatically hotplugged
  51. when the feature bit was negotiated for the virtio-net standby device.