[lxc-devel] [lxd/master] container/lxc: Fixes ipvlan support check

tomponline on Github lxc-bot at linuxcontainers.org
Fri May 10 09:46:10 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 433 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190510/1f15779f/attachment.bin>
-------------- next part --------------
From 8dd19e86f13606d9cf5c5938155ee747c7f455d4 Mon Sep 17 00:00:00 2001
From: Thomas Parrott <thomas.parrott at canonical.com>
Date: Fri, 10 May 2019 10:44:55 +0100
Subject: [PATCH] container/lxc: Fixes ipvlan support check

Also alerts user if they try to add ipvlan nic to running container.

Signed-off-by: Thomas Parrott <thomas.parrott at canonical.com>
---
 lxd/container_lxc.go | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 4955294dbf..466b5c17f2 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -8171,13 +8171,13 @@ func (c *containerLXC) insertNetworkDevice(name string, m types.Device) (types.D
 		return nil, err
 	}
 
+	// Alert user if trying to add an ipvlan nic on running container.
+	if m["nictype"] == "ipvlan" {
+		return nil, errors.New("Can't insert ipvlan device to running container")
+	}
+
 	// Setup network device if not type ipvlan (which is done via liblxc only)
 	if m["nictype"] != "ipvlan" {
-		err := c.checkIPVLANSupport()
-		if err != nil {
-			return nil, err
-		}
-
 		// Create the interface
 		devName, err := c.createNetworkDevice(name, m)
 		if err != nil {


More information about the lxc-devel mailing list