[lxc-devel] [lxd/master] activateifneeded: Immediately exit when no DB

stgraber on Github lxc-bot at linuxcontainers.org
Fri Nov 11 10:36:31 UTC 2016


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/20161111/b786d97f/attachment.bin>
-------------- next part --------------
From 1d3974661445df5cd9a92a5ddc6a100af4081316 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Fri, 11 Nov 2016 12:35:14 +0200
Subject: [PATCH] activateifneeded: Immediately exit when no DB
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/main.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/main.go b/lxd/main.go
index e288faf..cba11bb 100644
--- a/lxd/main.go
+++ b/lxd/main.go
@@ -480,6 +480,11 @@ func cmdActivateIfNeeded() error {
 		lxcpath:               shared.VarPath("containers"),
 	}
 
+	if !shared.PathExists(shared.VarPath("lxd.db")) {
+		shared.LogDebugf("No DB, so no need to start the daemon now.")
+		return nil
+	}
+
 	err := initializeDbObject(d, shared.VarPath("lxd.db"))
 	if err != nil {
 		return err


More information about the lxc-devel mailing list