[lxc-devel] [lxd/master] lxd/instance/lxc: Don't crash in setNetworkPriority

stgraber on Github lxc-bot at linuxcontainers.org
Mon Apr 20 18:21:11 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200420/ae090ade/attachment.bin>
-------------- next part --------------
From 4314e84dc5f5d94f7843d6d29ab711c3f6755281 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 20 Apr 2020 14:20:55 -0400
Subject: [PATCH] lxd/instance/lxc: Don't crash in setNetworkPriority
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lxd/instance/drivers/driver_lxc.go b/lxd/instance/drivers/driver_lxc.go
index 38e7265942..9dfa2d9dc3 100644
--- a/lxd/instance/drivers/driver_lxc.go
+++ b/lxd/instance/drivers/driver_lxc.go
@@ -6369,6 +6369,13 @@ func (c *lxc) removeDiskDevices() error {
 
 // Network I/O limits
 func (c *lxc) setNetworkPriority() error {
+	// Load the go-lxc struct.
+	err := c.initLXC(false)
+	if err != nil {
+		return err
+	}
+
+	// Load the cgroup struct.
 	cg, err := c.cgroup(nil)
 	if err != nil {
 		return err


More information about the lxc-devel mailing list