render / rpms / libvirt

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