From d892d3c276ced3b2f0471df49653e842509f9262 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 13 May 2025 14:03:48 +0200 Subject: [PATCH] virDomainNetDefCheckABIStability: Consider virtio 'queues' ABI MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit While the queue count itself is not a guest visible property, libvirt uses it to calculate the 'vectors' property of the 'virtio-net' device which is ABI. Since we don't expose control of 'vectors' explicitly, consider 'queues' ABI. Signed-off-by: Peter Krempa Reviewed-by: Daniel P. Berrangé --- src/conf/domain_conf.c | 11 +++++++++++ src/qemu/qemu_command.c | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 542d6ade91..b3b0bd7329 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20801,6 +20801,17 @@ virDomainNetDefCheckABIStability(virDomainNetDef *src, return false; } + /* The number of queues is used to calculate the value for 'vectors' + * (see qemuBuildNicDevProps) which is machine ABI thus we need to ensure + * that the number of queues is kept in sync */ + if (virDomainNetIsVirtioModel(src) && + (src->driver.virtio.queues != dst->driver.virtio.queues)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target virtio network queue count '%1$d' does not match source '%2$d'"), + dst->driver.virtio.queues, src->driver.virtio.queues); + return false; + } + if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio)) return false; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e6d308534f..bf03561fde 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3770,6 +3770,8 @@ qemuBuildNicDevProps(virDomainDef *def, * we should add vectors=2*N+2 where N is the vhostfdSize */ mq = VIR_TRISTATE_SWITCH_ON; + /* As 'vectors' is a guest-OS visible property and thus + * effectively guest ABI this formula *MUST NOT* change */ vectors = 2 * net->driver.virtio.queues + 2; } } -- 2.47.2