From: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
To: svt-core@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, efim.shevrin@virtuozzo.com,
den@openvz.org
Subject: [RFC HCI-8.1 PATCH 1/5] qemu update: allow qemu-update for VMs with PCI and USB hostdevs #VSTOR-103860 #VSTOR-137800
Date: Fri, 9 Oct 2026 17:04:31 +0300 [thread overview]
Message-ID: <20261009140435.483100-2-andrey.drobyshev@virtuozzo.com> (raw)
In-Reply-To: <20261009140435.483100-1-andrey.drobyshev@virtuozzo.com>
Previous commit 23ba7842b6 ("qemu update: disable update if hostdev
device is added to VM #VSTOR-97345") refused qemu-update for any domain
carrying a <hostdev>, because QEMU of that time could not preserve
passthrough devices across cpr-exec. QEMU now does: VFIO devices
survive the update via the CPR FD preservation machinery, and USB
hostdevs are covered by QEMU as well.
Replace the blanket check with an allowlist. PCI hostdevs (VFIO; this
also covers <interface type='hostdev'> SR-IOV VFs, which libvirt keeps
in the hostdevs array too) and USB hostdevs pass. Other hostdev types
(mdev, scsi, scsi_host) haven't been validated with cpr-exec and are
still refused, now naming the offending type in the error.
NVMe disks (QEMU's userspace NVMe driver on top of VFIO) and vDPA
interfaces pin guest memory for device DMA just like VFIO devices, but
they are not hostdevs and thus never went through the hostdev check.
Refuse them explicitly, each with its own error.
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
src/qemu/qemu_driver.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 911690e3909..b3902f10c65 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -25158,6 +25158,7 @@ qemuDomainGuestQemuUpdatePrechecks(virDomainObj *vm)
qemuDomainObjPrivate *priv = vm->privateData;
g_autoptr(GHashTable) blockjobstats = NULL;
g_autoptr(virJSONValue) array = NULL;
+ size_t i;
if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
virReportError(VIR_ERR_OPERATION_INVALID,
@@ -25172,9 +25173,38 @@ qemuDomainGuestQemuUpdatePrechecks(virDomainObj *vm)
return -1;
}
- if (vm->def->nhostdevs > 0) {
+ /* Only PCI (VFIO) and USB hostdevs are known to survive cpr-exec */
+ for (i = 0; i < vm->def->nhostdevs; i++) {
+ virDomainHostdevDef *hostdev = vm->def->hostdevs[i];
+ const char *type;
+
+ if (virHostdevIsPCIDevice(hostdev) ||
+ (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
+ hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB))
+ continue;
+
+ if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
+ type = virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type);
+ else
+ type = virDomainHostdevModeTypeToString(hostdev->mode);
+
virReportError(VIR_ERR_OPERATION_INVALID,
- _("VM '%1$s' has hostdevs, qemu-update cancelled"), vm->def->name);
+ _("VM '%1$s' has hostdev of unsupported type '%2$s', qemu-update cancelled"),
+ vm->def->name, type);
+ return -1;
+ }
+
+ if (virDomainDefHasNVMeDisk(vm->def)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("VM '%1$s' has NVMe disk, qemu-update cancelled"),
+ vm->def->name);
+ return -1;
+ }
+
+ if (virDomainDefHasVDPANet(vm->def)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("VM '%1$s' has vDPA interface, qemu-update cancelled"),
+ vm->def->name);
return -1;
}
--
2.47.1
next prev parent reply other threads:[~2026-10-09 14:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-09 14:04 [RFC HCI-8.1 PATCH 0/5] qemu: allow qemu-update with VFIO hostdevs on shared memfd RAM #VSTOR-103860 Andrey Drobyshev
2026-10-09 14:04 ` Andrey Drobyshev [this message]
2026-10-09 14:04 ` [RFC HCI-8.1 PATCH 2/5] qemu: capabilities: probe aux-ram-share machine property #VSTOR-103860 Andrey Drobyshev
2026-10-09 14:04 ` [RFC HCI-8.1 PATCH 3/5] qemu: back guest RAM with shared memfd for VMs with DMA-pinning devices #VSTOR-103860 Andrey Drobyshev
2026-10-09 14:04 ` [RFC HCI-8.1 PATCH 4/5] qemu: share auxiliary RAM of " Andrey Drobyshev
2026-10-09 14:04 ` [RFC HCI-8.1 PATCH 5/5] qemu update: refuse PCI hostdevs on non-shared guest RAM #VSTOR-103860 Andrey Drobyshev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261009140435.483100-2-andrey.drobyshev@virtuozzo.com \
--to=andrey.drobyshev@virtuozzo.com \
--cc=den@openvz.org \
--cc=efim.shevrin@virtuozzo.com \
--cc=svt-core@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.