[lxc-devel] [lxd/master] lxd/instance/qemu: Use a minimum of 2 network queues

stgraber on Github lxc-bot at linuxcontainers.org
Thu Dec 17 22:00:33 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 454 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20201217/c1fe4b9e/attachment.bin>
-------------- next part --------------
From 43799cb6446543aaf347324f07909d330866633f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 17 Dec 2020 16:59:48 -0500
Subject: [PATCH] lxd/instance/qemu: Use a minimum of 2 network queues
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Otherwise qemu expects a single queue TAP device which isn't what we're
preparing these days :)

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/instance/drivers/driver_qemu.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lxd/instance/drivers/driver_qemu.go b/lxd/instance/drivers/driver_qemu.go
index 6acec3b51e..48afeace3f 100644
--- a/lxd/instance/drivers/driver_qemu.go
+++ b/lxd/instance/drivers/driver_qemu.go
@@ -2380,11 +2380,17 @@ func (d *qemu) addNetDevConfig(sb *strings.Builder, cpuCount int, bus *qemuBus,
 		// Detect TAP (via TUN driver) device.
 		tplFields["ifName"] = nicName
 
+		// Run with a minimum of two queues.
+		queueCount := cpuCount
+		if queueCount < 2 {
+			queueCount = 2
+		}
+
 		// Number of queues is the same as number of vCPUs.
-		tplFields["queues"] = cpuCount
+		tplFields["queues"] = queueCount
 
 		// Number of vectors is number of vCPUs * 2 (RX/TX) + 2 (config/control MSI-X).
-		tplFields["vectors"] = 2*cpuCount + 2
+		tplFields["vectors"] = 2*queueCount + 2
 
 		tpl = qemuNetDevTapTun
 	} else if pciSlotName != "" {


More information about the lxc-devel mailing list