libvirt/SOURCES/libvirt-qemu_migration-chec...

57 lines
2.6 KiB
Diff

From c0a4688a4754715e90a1b127c080917be48ee14a Mon Sep 17 00:00:00 2001
Message-Id: <c0a4688a4754715e90a1b127c080917be48ee14a@dist-git>
From: Kristina Hanicova <khanicov@redhat.com>
Date: Thu, 5 Aug 2021 13:42:15 +0200
Subject: [PATCH] qemu_migration: check for interface type 'hostdev'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When we try to migrate vm, we check if it contains only devices
that are able to migrate. If a hostdev device is not able to
migrate we raise an error with <hostdev/>, but it can actually be
<interface/>, so we need to check if hostdev device was created
by us from interface and show the right error message.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1942315
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 814a8aaeeb51fa0fd65a030853cc86bc6d29b9d8)
Signed-off-by: Kristina Hanicova <khanicov@redhat.com>
Message-Id: <3b763f29bb5978cdb4f826ac9d4d632c7631e083.1628163625.git.khanicov@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_migration.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 4d651aeb1a..b441d0226c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1272,9 +1272,17 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
}
/* all other PCI hostdevs can't be migrated */
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
- _("cannot migrate a domain with <hostdev mode='subsystem' type='%s'>"),
- virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+ if (hostdev->parentnet) {
+ virDomainNetType actualType = virDomainNetGetActualType(hostdev->parentnet);
+
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("cannot migrate a domain with <interface type='%s'>"),
+ virDomainNetTypeToString(actualType));
+ } else {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+ _("cannot migrate a domain with <hostdev mode='subsystem' type='%s'>"),
+ virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+ }
return false;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
--
2.32.0