render / rpms / libvirt

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