libvirt/libvirt-qemu-validate-that-model-is-virtio-for-vhostuser-and-vdpa-interfaces-in-the-same-place.patch
Jiri Denemark 4a97ecd040 libvirt-10.10.0-7.el9
- qemu_migration: Refactor qemuMigrationSrcRestoreDomainState (RHEL-79168)
- qemu_migration: Do not automatically resume domain after I/O error (RHEL-79168)
- qemucapabilitiestest: Add data for the qemu-10.0 dev cycle on x86_64 (RHEL-79095)
- qemucapabilitiestest: Update 'caps_10.0.0_x86_64' to 'v9.2.0-1636-gffaf7f0376' (RHEL-79095)
- qemu: capabilies: Introduce QEMU_CAPS_BLOCKDEV_SET_ACTIVE (RHEL-79095)
- qemu: monitor: Add monitor backend for 'blockdev-set-active' (RHEL-79095)
- qemu: migration: Reactivate block nodes after migration if VM is left paused (RHEL-79095)
- conf: change virDomainHostdevInsert() to return void (RHEL-69455)
- qemu: fix qemu validation to forbid guest-side IP address for type='vdpa' (RHEL-69455)
- qemu: validate that model is virtio for vhostuser and vdpa interfaces in the same place (RHEL-69455)
- qemu: automatically set model type='virtio' for interface type='vhostuser' (RHEL-69455)
- qemu: do all vhostuser attribute validation in qemu driver (RHEL-69455)
- conf/qemu: make <source> element *almost* optional for type=vhostuser (RHEL-69455)
- qemu: use switch instead of if in qemuProcessPrepareDomainNetwork() (RHEL-69455)
- qemu: make qemuPasstCreateSocketPath() public (RHEL-69455)
- qemu: complete vhostuser + passt support (RHEL-69455)
- qemu: fail validation if a domain def has vhostuser/passt but no shared mem (RHEL-69455)
- docs: improve type='user' docs to higlight differences between SLIRP and passt (RHEL-69455)
- docs: document using passt backend with <interface type='vhostuser'> (RHEL-69455)
- utils: Canonicalize paths before comparing them (RHEL-79166)

Resolves: RHEL-69455, RHEL-79095, RHEL-79166, RHEL-79168
2025-02-17 21:30:50 +01:00

83 lines
3.5 KiB
Diff

From 64f9ffd6ba6384c3ce11312e645dac6cb3cab27e Mon Sep 17 00:00:00 2001
Message-ID: <64f9ffd6ba6384c3ce11312e645dac6cb3cab27e.1739824249.git.jdenemar@redhat.com>
From: Laine Stump <laine@redhat.com>
Date: Sun, 9 Feb 2025 18:46:00 -0500
Subject: [PATCH] qemu: validate that model is virtio for vhostuser and vdpa
interfaces in the same place
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Both vhostuser and vdpa interface types must use the virtio model in
the guest (because part of the functionality is implemented in the
guest virtio driver). Due to ["because that's the way it happened"]
this has been validated for vhostuser in the hypervisor-agnostic
validate function, but for vdpa it has been done in the QEMU-specific
validate. Since these interface models are only supported by QEMU
anyway, validate for both of them in the QEMU validation function.
Take advantage of this change to switch to using
virDomainNetIsVirtioModel(net) instead of "net->model ==
VIR_DOMAIN_NET_MODEL_VIRTIO" (the former also matches
...VIRTIO_TRANSITIONAL and ...VIRTIO_NON_TRANSITIONAL, so is more
correct).
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 154d44a585c40d0b6cf3bae674da2a8ca11ddb95)
https://issues.redhat.com/browse/RHEL-69455
Signed-off-by: Laine Stump <laine@redhat.com>
---
src/conf/domain_validate.c | 6 ------
src/qemu/qemu_validate.c | 11 ++++++-----
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 1034bb57f5..f56ff5b7bb 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2180,12 +2180,6 @@ virDomainNetDefValidate(const virDomainNetDef *net)
switch (net->type) {
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
- if (!virDomainNetIsVirtioModel(net)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Wrong or no <model> 'type' attribute specified with <interface type='vhostuser'/>. vhostuser requires the virtio-net* frontend"));
- return -1;
- }
-
if (net->data.vhostuser->data.nix.listen &&
net->data.vhostuser->data.nix.reconnect.enabled == VIR_TRISTATE_BOOL_YES) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 9310457cb1..841d320541 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -1808,17 +1808,18 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
_("vDPA devices are not supported with this QEMU binary"));
return -1;
}
+ }
- if (net->model != VIR_DOMAIN_NET_MODEL_VIRTIO) {
+ if (!virDomainNetIsVirtioModel(net)) {
+ if (net->type == VIR_DOMAIN_NET_TYPE_VDPA ||
+ net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("invalid model for interface of type '%1$s': '%2$s'"),
+ _("invalid model for interface of type '%1$s': '%2$s' - must be 'virtio'"),
virDomainNetTypeToString(net->type),
virDomainNetModelTypeToString(net->model));
return -1;
}
- }
-
- if (virDomainNetIsVirtioModel(net)) {
+ } else {
if (net->driver.virtio.rx_queue_size) {
if (!VIR_IS_POW2(net->driver.virtio.rx_queue_size)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
--
2.48.1