[lxc-devel] [lxd/master] Bugfixes

stgraber on Github lxc-bot at linuxcontainers.org
Thu Sep 1 01:39:20 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160901/71e0190b/attachment.bin>
-------------- next part --------------
From 6d84f345d677cac326cbaa3aa3e2fa65c69b0950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 31 Aug 2016 21:35:01 -0400
Subject: [PATCH] Allow unsetting any config key
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Prevents a DB failure when trying to unset one of the volatile network
keys (name or hwaddr).

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/container_lxc.go | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 50a1ec9..ed9ef60 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2192,11 +2192,6 @@ func (c *containerLXC) Update(args containerArgs, userRequested bool) error {
 		return err
 	}
 
-	err = c.initLXC()
-	if err != nil {
-		return err
-	}
-
 	// Diff the configurations
 	changedConfig := []string{}
 	for key, _ := range oldExpandedConfig {
@@ -2649,6 +2644,14 @@ func (c *containerLXC) Update(args containerArgs, userRequested bool) error {
 		return err
 	}
 
+	// Invalidate the go-lxc cache
+	c.c = nil
+
+	err = c.initLXC()
+	if err != nil {
+		return err
+	}
+
 	// Success, update the closure to mark that the changes should be kept.
 	undoChanges = false
 


More information about the lxc-devel mailing list