- 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
204 lines
8.7 KiB
Diff
204 lines
8.7 KiB
Diff
From 1010499de016dd5babf375c203baa62d9799e190 Mon Sep 17 00:00:00 2001
|
|
Message-ID: <1010499de016dd5babf375c203baa62d9799e190.1739824249.git.jdenemar@redhat.com>
|
|
From: Laine Stump <laine@redhat.com>
|
|
Date: Fri, 14 Feb 2025 13:10:19 -0500
|
|
Subject: [PATCH] qemu: fail validation if a domain def has vhostuser/passt but
|
|
no shared mem
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
This can/should also be done for a traditional vhost-user interface
|
|
(ie not backend type='passt') but that will be a separate change.
|
|
|
|
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
(cherry picked from commit 70bce2e6ee7a6b738d08fa79d14342969f51668b)
|
|
|
|
https://issues.redhat.com/browse/RHEL-69455
|
|
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
---
|
|
src/qemu/qemu_validate.c | 9 ++-
|
|
...vhostuser-passt-no-shmem.x86_64-latest.err | 1 +
|
|
.../net-vhostuser-passt-no-shmem.xml | 70 +++++++++++++++++++
|
|
.../net-vhostuser-passt.x86_64-latest.args | 2 +-
|
|
.../net-vhostuser-passt.x86_64-latest.xml | 3 +
|
|
tests/qemuxmlconfdata/net-vhostuser-passt.xml | 3 +
|
|
tests/qemuxmlconftest.c | 1 +
|
|
7 files changed, 87 insertions(+), 2 deletions(-)
|
|
create mode 100644 tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
|
create mode 100644 tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.xml
|
|
|
|
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
|
|
index f33c0c07b4..289a3f94cc 100644
|
|
--- a/src/qemu/qemu_validate.c
|
|
+++ b/src/qemu/qemu_validate.c
|
|
@@ -1724,6 +1724,7 @@ qemuValidateDomainDefVhostUserRequireSharedMemory(const virDomainDef *def,
|
|
|
|
static int
|
|
qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
|
+ const virDomainDef *def,
|
|
virQEMUCaps *qemuCaps)
|
|
{
|
|
bool hasIPv4 = false;
|
|
@@ -1804,6 +1805,12 @@ qemuValidateDomainDeviceDefNetwork(const virDomainNetDef *net,
|
|
return -1;
|
|
}
|
|
|
|
+ if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER &&
|
|
+ net->backend.type == VIR_DOMAIN_NET_BACKEND_PASST) {
|
|
+ if (qemuValidateDomainDefVhostUserRequireSharedMemory(def, "interface type=\"vhostuser\" backend type=\"passt\"") < 0)
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
|
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_VHOST_VDPA)) {
|
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
@@ -5400,7 +5407,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef *dev,
|
|
|
|
switch (dev->type) {
|
|
case VIR_DOMAIN_DEVICE_NET:
|
|
- return qemuValidateDomainDeviceDefNetwork(dev->data.net, qemuCaps);
|
|
+ return qemuValidateDomainDeviceDefNetwork(dev->data.net, def, qemuCaps);
|
|
|
|
case VIR_DOMAIN_DEVICE_CHR:
|
|
return qemuValidateDomainChrDef(dev->data.chr, def, qemuCaps);
|
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
|
new file mode 100644
|
|
index 0000000000..274af5c722
|
|
--- /dev/null
|
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.x86_64-latest.err
|
|
@@ -0,0 +1 @@
|
|
+unsupported configuration: 'interface type="vhostuser" backend type="passt"' requires shared memory
|
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.xml b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.xml
|
|
new file mode 100644
|
|
index 0000000000..e44c91e541
|
|
--- /dev/null
|
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt-no-shmem.xml
|
|
@@ -0,0 +1,70 @@
|
|
+<domain type='qemu'>
|
|
+ <name>QEMUGuest1</name>
|
|
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
+ <memory unit='KiB'>219136</memory>
|
|
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
+ <vcpu placement='static'>1</vcpu>
|
|
+ <os>
|
|
+ <type arch='x86_64' machine='pc'>hvm</type>
|
|
+ <boot dev='hd'/>
|
|
+ </os>
|
|
+ <clock offset='utc'/>
|
|
+ <on_poweroff>destroy</on_poweroff>
|
|
+ <on_reboot>restart</on_reboot>
|
|
+ <on_crash>destroy</on_crash>
|
|
+ <devices>
|
|
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
|
|
+ <disk type='block' device='disk'>
|
|
+ <driver name='qemu' type='raw'/>
|
|
+ <source dev='/dev/HostVG/QEMUGuest1'/>
|
|
+ <target dev='hda' bus='ide'/>
|
|
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
+ </disk>
|
|
+ <controller type='usb' index='0' model='none'/>
|
|
+ <controller type='ide' index='0'>
|
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
|
+ </controller>
|
|
+ <controller type='pci' index='0' model='pci-root'/>
|
|
+ <interface type='vhostuser'>
|
|
+ <mac address='00:11:22:33:44:55'/>
|
|
+ <ip address='172.17.2.0' family='ipv4' prefix='24'/>
|
|
+ <ip address='2001:db8:ac10:fd01::feed' family='ipv6'/>
|
|
+ <source dev='eth42'/>
|
|
+ <portForward proto='tcp' address='2001:db8:ac10:fd01::1:10'>
|
|
+ <range start='22' to='2022'/>
|
|
+ <range start='1000' end='1050'/>
|
|
+ <range start='1020' exclude='yes'/>
|
|
+ <range start='1030' end='1040' exclude='yes'/>
|
|
+ </portForward>
|
|
+ <portForward proto='udp' address='1.2.3.4' dev='eth0'>
|
|
+ <range start='5000' end='5020' to='6000'/>
|
|
+ <range start='5010' end='5015' exclude='yes'/>
|
|
+ </portForward>
|
|
+ <portForward proto='tcp'>
|
|
+ <range start='80'/>
|
|
+ </portForward>
|
|
+ <portForward proto='tcp'>
|
|
+ <range start='443' to='344'/>
|
|
+ </portForward>
|
|
+ <model type='virtio'/>
|
|
+ <backend type='passt' logFile='/var/log/loglaw.blog'/>
|
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
|
|
+ </interface>
|
|
+ <interface type='vhostuser'>
|
|
+ <mac address='00:11:22:33:44:11'/>
|
|
+ <backend type='passt'/>
|
|
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
|
+ </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'/>
|
|
+ </interface>
|
|
+ <input type='mouse' bus='ps2'/>
|
|
+ <input type='keyboard' bus='ps2'/>
|
|
+ <audio id='1' type='none'/>
|
|
+ <memballoon model='none'/>
|
|
+ </devices>
|
|
+</domain>
|
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
|
|
index 21d78d6072..7c030d7067 100644
|
|
--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
|
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.args
|
|
@@ -14,7 +14,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
|
|
-accel tcg \
|
|
-cpu qemu64 \
|
|
-m size=219136k \
|
|
--object '{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}' \
|
|
+-object '{"qom-type":"memory-backend-file","id":"pc.ram","mem-path":"/var/lib/libvirt/qemu/ram/-1-QEMUGuest1/pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":224395264}' \
|
|
-overcommit mem-lock=off \
|
|
-smp 1,sockets=1,cores=1,threads=1 \
|
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
|
|
index 26aa4c8d05..a1f9366722 100644
|
|
--- a/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
|
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt.x86_64-latest.xml
|
|
@@ -3,6 +3,9 @@
|
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
<memory unit='KiB'>219136</memory>
|
|
<currentMemory unit='KiB'>219136</currentMemory>
|
|
+ <memoryBacking>
|
|
+ <access mode='shared'/>
|
|
+ </memoryBacking>
|
|
<vcpu placement='static'>1</vcpu>
|
|
<os>
|
|
<type arch='x86_64' machine='pc'>hvm</type>
|
|
diff --git a/tests/qemuxmlconfdata/net-vhostuser-passt.xml b/tests/qemuxmlconfdata/net-vhostuser-passt.xml
|
|
index e44c91e541..71b845329b 100644
|
|
--- a/tests/qemuxmlconfdata/net-vhostuser-passt.xml
|
|
+++ b/tests/qemuxmlconfdata/net-vhostuser-passt.xml
|
|
@@ -3,6 +3,9 @@
|
|
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
<memory unit='KiB'>219136</memory>
|
|
<currentMemory unit='KiB'>219136</currentMemory>
|
|
+ <memoryBacking>
|
|
+ <access mode='shared'/>
|
|
+ </memoryBacking>
|
|
<vcpu placement='static'>1</vcpu>
|
|
<os>
|
|
<type arch='x86_64' machine='pc'>hvm</type>
|
|
diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c
|
|
index 9603984b60..3947f508a2 100644
|
|
--- a/tests/qemuxmlconftest.c
|
|
+++ b/tests/qemuxmlconftest.c
|
|
@@ -1792,6 +1792,7 @@ mymain(void)
|
|
DO_TEST_CAPS_VER("net-user-passt", "7.2.0");
|
|
DO_TEST_CAPS_LATEST_PARSE_ERROR("net-user-slirp-portforward");
|
|
DO_TEST_CAPS_LATEST("net-vhostuser-passt");
|
|
+ DO_TEST_CAPS_LATEST_PARSE_ERROR("net-vhostuser-passt-no-shmem");
|
|
DO_TEST_CAPS_LATEST("net-virtio");
|
|
DO_TEST_CAPS_LATEST("net-virtio-device");
|
|
DO_TEST_CAPS_LATEST("net-virtio-disable-offloads");
|
|
--
|
|
2.48.1
|