libvirt/libvirt-conf-parse-interface-source-dev-for-all-interface-types-with-backend-type-passt.patch
Jiri Denemark ef809b76a6 libvirt-10.10.0-10.el9
- esxConnectListAllDomains: Don't propagate failure to lookup a single domain (RHEL-80606)
- conf: parse interface/source/@dev for all interface types (with backend type='passt') (RHEL-82539)
- libvirt-host: Clarify/fix description of the CPU frequency field (RHEL-86197)
- virNodeGetInfo: Improve description of the case when fake data is reported (RHEL-86197)
- manpages: virsh: Use disclaimer from 'virNodeGetInfo()' for 'virsh nodeinfo' (RHEL-86197)
- esx: Accept empty "path" URI component same way as "/" (RHEL-86459)
- qemu: Rename outgoingMigration parameter in various TPM functions (RHEL-86800)
- qemu: Properly propagate migration state to TPM cleanup code (RHEL-86800)
- qemuDomainBlockCopyCommon: Don't revoke access to file twice on failure (RHEL-7357)
- qemuxmlconftest: Drop s390-default-cpu-...ccw-virtio-2.7 test cases (RHEL-72976)
- tests: add capabilities for QEMU 10.0.0 on s390x (RHEL-72976)
- qemu: Do NOT autoadd NUMA node for s390 (RHEL-72976)
- qemu_command: Use qemuBuildVirtioDevProps() to build cmd line for virtio-mem and virtio-pmem (RHEL-72976)
- qemuxmlconftest: Introduce memory-hotplug-virtio-mem-pci-s390x.xml (RHEL-72976)
- qemu_caps: Introduce QEMU_CAPS_DEVICE_VIRTIO_MEM_CCW (RHEL-72976)
- qemu: Validate virtio-mem-ccw (RHEL-72976)
- qemu: Allow virtio-mem on CCW (RHEL-72976)
- qemuxmlconftest: Introduce memory-hotplug-virtio-mem-ccw-s390x.xml (RHEL-72976)
- qemu_domain_address: fix CCW virtio-mem hotplug (RHEL-72976)

Resolves: RHEL-72976, RHEL-7357, RHEL-80606, RHEL-82539, RHEL-86197
Resolves: RHEL-86459, RHEL-86800
2025-04-17 09:56:28 +02:00

104 lines
4.3 KiB
Diff

From 29ea0453595ee14cdd64b2e9c07343aa870426d0 Mon Sep 17 00:00:00 2001
Message-ID: <29ea0453595ee14cdd64b2e9c07343aa870426d0.1744876587.git.jdenemar@redhat.com>
From: Laine Stump <laine@redhat.com>
Date: Thu, 6 Mar 2025 19:19:12 -0500
Subject: [PATCH] conf: parse interface/source/@dev for all interface types
(with backend type='passt')
The original implementation of the passt backend for vhost-user
interfaces erroneously forgot to parse:
<source dev='blah'/>
for interface type='vhostuser', so it wasn't being added to the passt
commandline, and also wasn't being saved to the domain config. Now we
parse it whenever the <backend> type='passt', no matter what the
interface type, and then throw an error during validation if
source/@dev was specified for interface type = 'user|vhostuser' and
backend type != 'passt'.
Fixes: 1e9054b9c79d721a55f413c2983c5370044f8f60
Resolves: https://issues.redhat.com/browse/RHEL-82539
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 4c979edaa545c8425f7a856c06ebc0de939d4b9f)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/conf/domain_conf.c | 8 +++++---
src/conf/domain_validate.c | 8 +++++++-
.../qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml | 2 ++
3 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f6d3d849eb..726c3095ed 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -9919,9 +9919,6 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
break;
case VIR_DOMAIN_NET_TYPE_USER:
- def->sourceDev = virXMLPropString(source_node, "dev");
- break;
-
case VIR_DOMAIN_NET_TYPE_NULL:
case VIR_DOMAIN_NET_TYPE_LAST:
break;
@@ -10036,6 +10033,11 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt,
return NULL;
}
+ if (def->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
+ def->sourceDev = virXMLPropString(source_node, "dev");
+ }
+
+
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
if (linkstate != NULL) {
if ((def->linkstate = virDomainNetInterfaceLinkStateTypeFromString(linkstate)) <= 0) {
diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index 597ae3d938..9cedc8d6d2 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2160,12 +2160,18 @@ virDomainNetDefValidate(const virDomainNetDef *net)
if (net->type != VIR_DOMAIN_NET_TYPE_USER &&
net->type != VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
if (net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("The 'passt' backend can only be used with interface type='user' or type='vhostuser'"));
return -1;
}
}
+ if (net->sourceDev && net->backend.type != VIR_DOMAIN_NET_BACKEND_PASST) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("The 'dev' attribute of the <source> element can only be used with <interface> type='user' or type='vhostuser' if the <backend> type='passt'"));
+ return -1;
+ }
+
if (net->nPortForwards > 0) {
size_t p;
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
index a1f9366722..529aff11f8 100644
--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
@@ -33,6 +33,7 @@
<controller type='pci' index='0' model='pci-root'/>
<interface type='vhostuser'>
<mac address='00:11:22:33:44:55'/>
+ <source dev='eth42'/>
<ip address='172.17.2.0' family='ipv4' prefix='24'/>
<ip address='2001:db8:ac10:fd01::feed' family='ipv6'/>
<portForward proto='tcp' address='2001:db8:ac10:fd01::1:10'>
@@ -63,6 +64,7 @@
</interface>
<interface type='vhostuser'>
<mac address='00:11:22:33:44:11'/>
+ <source dev='eth43'/>
<model type='virtio'/>
<backend type='passt'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
--
2.49.0