libvirt/libvirt-qemu-allow-migration-of-guest-with-mdev-vGPU-to-VF-vGPU.patch
Jiri Denemark c269e5be18 libvirt-10.10.0-5.el10
- qemu: allow migration of guest with mdev vGPU to VF vGPU (RHEL-68065)
- storage_file: Refuse qcow2 images with empty string as 'data_file' (RHEL-70627)
- virstoragetest: Add case for qcow2 image with empty string as 'data_file' (RHEL-70627)
- qemu: snapshot: delete disk image only if parent snapshot is external (RHEL-74040)
- storage_file: de-modularize the local file backend (RHEL-73506)
- libvirt.spec: Move ownership of 'storage-file' backends directory to gluster (RHEL-73506)
- tools: ssh-proxy: Check for domain status before parsing its CID (RHEL-75589)
- qemu: re-use existing ActualNetDef for more interface types during update-device (RHEL-74492)

Resolves: RHEL-68065, RHEL-70627, RHEL-73506, RHEL-74040, RHEL-74492
Resolves: RHEL-75589
2025-01-24 14:14:17 +01:00

77 lines
3.7 KiB
Diff

From ef22696c396c2e54510fd5b912ce9979f1381c96 Mon Sep 17 00:00:00 2001
Message-ID: <ef22696c396c2e54510fd5b912ce9979f1381c96.1737724457.git.jdenemar@redhat.com>
From: Laine Stump <laine@redhat.com>
Date: Fri, 13 Dec 2024 12:47:39 -0500
Subject: [PATCH] qemu: allow migration of guest with mdev vGPU to VF vGPU
GPU vendors are moving away from using mdev to create virtual GPUs
towards using SRIOV VFs that are vGPUs. In both cases, once created
the vGPUs are assigned to guests via <hostdev> (i.e. VFIO device
assignment), and inside the guest the devices look identical, but mdev
vGPUs are located by QEMU/VFIO using a uuid, while VF vGPUs are
located with a PCI address. So although we generally require the
device on the source host to exactly match the device on the
destination host, in the case of mdev-created vGPU vs. VF vGPU
migration *can* potentially work, except that libvirt has a hard-coded
check that prevents us from even trying.
This patch loosens up that check so that we will allow attempts to
migrate a guest from a source host that has mdev-created vGPUs to a
destination host that has VF vGPUs (and vice versa). The expectation
is that if this doesn't actually work then QEMU will fail and generate
an error that we can report.
Signed-off-by: Laine Stump <laine@redhat.com>
Tested-by: Zhiyi Guo <zhguo@redhat.com>
Reviewed-by: Zhiyi Guo <zhguo@redhat.com>
(cherry picked from commit dd82e2baa84eed485fa0554eafd2bdc06a094081)
https://issues.redhat.com/browse/RHEL-68065
Signed-off-by: Laine Stump laine@redhat.com
---
src/conf/domain_conf.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1f0b67ca28..d3f30b08dc 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -20671,13 +20671,27 @@ virDomainHostdevDefCheckABIStability(virDomainHostdevDef *src,
return false;
}
- if (src->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
- src->source.subsys.type != dst->source.subsys.type) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("Target host device subsystem %1$s does not match source %2$s"),
- virDomainHostdevSubsysTypeToString(dst->source.subsys.type),
- virDomainHostdevSubsysTypeToString(src->source.subsys.type));
- return false;
+ if (src->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
+ virDomainHostdevSubsysType srcType = src->source.subsys.type;
+ virDomainHostdevSubsysType dstType = dst->source.subsys.type;
+
+ /* If the source and destination subsys types aren't the same,
+ * then migration can't be supported, *except* that it might
+ * be supported to migrate from subsys type 'pci' to 'mdev'
+ * and vice versa. (libvirt can't know for certain whether or
+ * not it will actually work, so we have to just allow it and
+ * count on QEMU to provide us with an error if it fails)
+ */
+
+ if (srcType != dstType
+ && ((srcType != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && srcType != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV)
+ || (dstType != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI && dstType != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("Target host device subsystem type %1$s is not compatible with source subsystem type %2$s"),
+ virDomainHostdevSubsysTypeToString(dstType),
+ virDomainHostdevSubsysTypeToString(srcType));
+ return false;
+ }
}
if (!virDomainDeviceInfoCheckABIStability(src->info, dst->info))
--
2.48.1