fbe740
From a2712d6a8ef06050b4e31d9e6e9800a4babc2cd8 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <a2712d6a8ef06050b4e31d9e6e9800a4babc2cd8@dist-git>
fbe740
From: Laine Stump <laine@redhat.com>
fbe740
Date: Thu, 30 Jan 2020 14:12:39 -0500
fbe740
Subject: [PATCH] qemu: add capabilities flag for failover feature
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
Presence of the virtio-net-pci option called "failover" indicates
fbe740
support in a qemu binary of a simplistic bonding of a virtio-net
fbe740
device with another PCI device. This feature allows migration of
fbe740
guests that have a network device assigned to a guest with VFIO, by
fbe740
creating a network bond device in the guest consisting of the
fbe740
VFIO-assigned device and a virtio-net-pci device, then temporarily
fbe740
(and automatically) unplugging the VFIO net device prior to migration
fbe740
(and hotplugging an equivalent device on the migration
fbe740
destination). (The feature is called "failover" because the bond
fbe740
device uses the vfio-pci netdev for normal guest networking, but
fbe740
"fails over" to the virtio-net-pci netdev once the vfio-pci device is
fbe740
unplugged for migration.)
fbe740
fbe740
Full functioning of the feature also requires support in the
fbe740
virtio-net driver in the guest OS (since that is where the bond device
fbe740
resides), but if the "failover" commandline option is present for the
fbe740
virtio-net-pci device in qemu, at least the qemu part of the feature
fbe740
is available, and libvirt can add the proper options to both the
fbe740
virtio-net-pci and vfio-pci device commandlines to indicate qemu
fbe740
should attempt doing the failover during migration.
fbe740
fbe740
This patch just adds the qemu capabilities flag "virtio-net.failover".
fbe740
fbe740
Signed-off-by: Laine Stump <laine@redhat.com>
fbe740
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
fbe740
(cherry picked from commit cad65f222f29dffd4e91d43b230665aca813c7a6)
fbe740
fbe740
Conflicts:
fbe740
   src/qemu/qemu_capabilities.c
fbe740
   src/qemu/qemu_capabilities.h
fbe740
   tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
fbe740
   tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
fbe740
fbe740
     context changed due to other capabilities flags
fbe740
     added upstream
fbe740
fbe740
   tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
fbe740
fbe740
     only exists upstream
fbe740
fbe740
https://bugzilla.redhat.com/1693587
fbe740
Signed-off-by: Laine Stump <laine@redhat.com>
fbe740
Message-Id: <20200130191244.24174-2-laine@redhat.com>
fbe740
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_capabilities.c                      | 4 ++++
fbe740
 src/qemu/qemu_capabilities.h                      | 3 +++
fbe740
 tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 +
fbe740
 tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml  | 1 +
fbe740
 4 files changed, 9 insertions(+)
fbe740
fbe740
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
fbe740
index 893fc5a1bb..10c17323be 100644
fbe740
--- a/src/qemu/qemu_capabilities.c
fbe740
+++ b/src/qemu/qemu_capabilities.c
fbe740
@@ -554,6 +554,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
fbe740
               "savevm-monitor-nodes",
fbe740
               "drive-nvme",
fbe740
               "smp-dies",
fbe740
+
fbe740
+              /* 350 */
fbe740
+              "virtio-net.failover",
fbe740
     );
fbe740
 
fbe740
 
fbe740
@@ -1299,6 +1302,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = {
fbe740
     { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY },
fbe740
     { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM },
fbe740
     { "ats", QEMU_CAPS_VIRTIO_PCI_ATS },
fbe740
+    { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER },
fbe740
 };
fbe740
 
fbe740
 static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSpaprPCIHostBridge[] = {
fbe740
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
fbe740
index 5ec8901bb3..6ab0eabd3f 100644
fbe740
--- a/src/qemu/qemu_capabilities.h
fbe740
+++ b/src/qemu/qemu_capabilities.h
fbe740
@@ -536,6 +536,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
fbe740
     QEMU_CAPS_DRIVE_NVME, /* -drive file.driver=nvme */
fbe740
     QEMU_CAPS_SMP_DIES, /*  -smp dies= */
fbe740
 
fbe740
+    /* 350 */
fbe740
+    QEMU_CAPS_VIRTIO_NET_FAILOVER, /* virtio-net-*.failover */
fbe740
+
fbe740
     QEMU_CAPS_LAST /* this must always be the last item */
fbe740
 } virQEMUCapsFlags;
fbe740
 
fbe740
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
fbe740
index 184bb7ff77..6af09e1a83 100644
fbe740
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
fbe740
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
fbe740
@@ -176,6 +176,7 @@
fbe740
   <flag name='savevm-monitor-nodes'/>
fbe740
   <flag name='drive-nvme'/>
fbe740
   <flag name='smp-dies'/>
fbe740
+  <flag name='virtio-net.failover'/>
fbe740
   <version>4001050</version>
fbe740
   <kvmVersion>0</kvmVersion>
fbe740
   <microcodeVersion>61700242</microcodeVersion>
fbe740
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
fbe740
index afd59a269d..c71791e205 100644
fbe740
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
fbe740
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
fbe740
@@ -219,6 +219,7 @@
fbe740
   <flag name='savevm-monitor-nodes'/>
fbe740
   <flag name='drive-nvme'/>
fbe740
   <flag name='smp-dies'/>
fbe740
+  <flag name='virtio-net.failover'/>
fbe740
   <version>4002000</version>
fbe740
   <kvmVersion>0</kvmVersion>
fbe740
   <microcodeVersion>43100242</microcodeVersion>
fbe740
-- 
fbe740
2.25.0
fbe740