]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virDomainNetDefCheckABIStability: Consider virtio 'queues' ABI
authorPeter Krempa <pkrempa@redhat.com>
Tue, 13 May 2025 12:03:48 +0000 (14:03 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 15 May 2025 06:30:42 +0000 (08:30 +0200)
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 <pkrempa@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
src/conf/domain_conf.c
src/qemu/qemu_command.c

index 542d6ade910baa1cddcc1dcebd81ef26bcb5be13..b3b0bd732955cd269af5cd3ffdfeca4146de6cfd 100644 (file)
@@ -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;
 
index e6d308534f87bb5c2f40158d24b802b70cdc98a2..bf03561fde9a3247a21dcfdebb5be138b6711a0d 100644 (file)
@@ -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;
             }
         }