|
|
fbe740 |
From a86311164657b4bc304705b1dd5cea3db83c7c12 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <a86311164657b4bc304705b1dd5cea3db83c7c12@dist-git>
|
|
|
fbe740 |
From: Laine Stump <laine@redhat.com>
|
|
|
fbe740 |
Date: Thu, 30 Jan 2020 14:12:42 -0500
|
|
|
fbe740 |
Subject: [PATCH] qemu: allow migration with assigned PCI hostdev if <teaming>
|
|
|
fbe740 |
is set
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Normally a PCI hostdev can't be migrated, so
|
|
|
fbe740 |
qemuMigrationSrcIsAllowedHostdev() won't permit it. In the case of a a
|
|
|
fbe740 |
hostdev network interface that has <teaming type='transient'/> set,
|
|
|
fbe740 |
QEMU will automatically unplug the device prior to migration, and
|
|
|
fbe740 |
re-plug a corresponding device on the destination. This patch modifies
|
|
|
fbe740 |
qemuMigrationSrcIsAllowedHostdev() to allow domains with those devices
|
|
|
fbe740 |
to be migrated.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 2758f680b7d586baf084f340b153d7706b8ce12b)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/1693587
|
|
|
fbe740 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
fbe740 |
Message-Id: <20200130191244.24174-5-laine@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_migration.c | 52 ++++++++++++++++++++++++++++++++++++---
|
|
|
fbe740 |
1 file changed, 48 insertions(+), 4 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
|
|
|
fbe740 |
index 29d228a8d9..46612a3c84 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_migration.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_migration.c
|
|
|
fbe740 |
@@ -1093,10 +1093,54 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
|
|
|
fbe740 |
* forbidden. */
|
|
|
fbe740 |
for (i = 0; i < def->nhostdevs; i++) {
|
|
|
fbe740 |
virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
|
|
fbe740 |
- if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
|
|
|
fbe740 |
- hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
|
|
|
fbe740 |
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
|
|
fbe740 |
- _("domain has assigned non-USB host devices"));
|
|
|
fbe740 |
+ switch ((virDomainHostdevMode)hostdev->mode) {
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES:
|
|
|
fbe740 |
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
|
|
|
fbe740 |
+ _("cannot migrate a domain with <hostdev mode='capabilities'>"));
|
|
|
fbe740 |
+ return false;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
|
|
|
fbe740 |
+ switch ((virDomainHostdevSubsysType)hostdev->source.subsys.type) {
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
|
|
|
fbe740 |
+ /* USB devices can be "migrated" */
|
|
|
fbe740 |
+ continue;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
|
|
|
fbe740 |
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
|
|
fbe740 |
+ _("cannot migrate a domain with <hostdev mode='subsystem' type='%s'>"),
|
|
|
fbe740 |
+ virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
|
|
|
fbe740 |
+ return false;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
|
|
fbe740 |
+ /*
|
|
|
fbe740 |
+ * if this is a network interface with
|
|
|
fbe740 |
+ * type='transient'>, migration *is* allowed because
|
|
|
fbe740 |
+ * the device will be auto-unplugged by QEMU during
|
|
|
fbe740 |
+ * migration.
|
|
|
fbe740 |
+ */
|
|
|
fbe740 |
+ if (hostdev->parentnet &&
|
|
|
fbe740 |
+ hostdev->parentnet->teaming.type == VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT) {
|
|
|
fbe740 |
+ continue;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ /* all other PCI hostdevs can't be migrated */
|
|
|
fbe740 |
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
|
|
|
fbe740 |
+ _("cannot migrate a domain with <hostdev mode='subsystem' type='%s'>"),
|
|
|
fbe740 |
+ virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
|
|
|
fbe740 |
+ return false;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
|
|
|
fbe740 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
fbe740 |
+ _("invalid hostdev subsystem type"));
|
|
|
fbe740 |
+ return false;
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+ break;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ case VIR_DOMAIN_HOSTDEV_MODE_LAST:
|
|
|
fbe740 |
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
|
|
fbe740 |
+ _("invalid hostdev mode"));
|
|
|
fbe740 |
return false;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
}
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.0
|
|
|
fbe740 |
|