[lxc-devel] [lxd/master] lxd/patches: Make config re-gen fault tollerant

stgraber on Github lxc-bot at linuxcontainers.org
Thu Jul 19 18:02:42 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180719/83e563ff/attachment.bin>
-------------- next part --------------
From ca6009c7dc68361e89a53dc021794e3b6a657325 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 19 Jul 2018 14:01:54 -0400
Subject: [PATCH] lxd/patches: Make config re-gen fault tollerant
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #4807

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/patches.go | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lxd/patches.go b/lxd/patches.go
index b098e0d40..74af6895d 100644
--- a/lxd/patches.go
+++ b/lxd/patches.go
@@ -1908,7 +1908,8 @@ func patchContainerConfigRegen(name string, d *Daemon) error {
 		// Load the container from the database.
 		c, err := containerLoadByName(d.State(), ct)
 		if err != nil {
-			return err
+			logger.Errorf("Failed to open container '%s': %v", ct, err)
+			continue
 		}
 
 		if !c.IsRunning() {
@@ -1922,7 +1923,8 @@ func patchContainerConfigRegen(name string, d *Daemon) error {
 
 		err = lxcCt.initLXC(true)
 		if err != nil {
-			return err
+			logger.Errorf("Failed to generate LXC config for '%s': %v", ct, err)
+			continue
 		}
 
 		// Generate the LXC config
@@ -1930,7 +1932,8 @@ func patchContainerConfigRegen(name string, d *Daemon) error {
 		err = lxcCt.c.SaveConfigFile(configPath)
 		if err != nil {
 			os.Remove(configPath)
-			return err
+			logger.Errorf("Failed to save LXC config for '%s': %v", ct, err)
+			continue
 		}
 	}
 


More information about the lxc-devel mailing list