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