[lxc-devel] [lxd/master] Log the error that made Daemon.Init() fail

freeekanayaka on Github lxc-bot at linuxcontainers.org
Mon Apr 16 17:37:04 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 417 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180416/46e3166e/attachment.bin>
-------------- next part --------------
From dbfae42a2b115a664b0484b01a235d1d4e266c16 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <free.ekanayaka at canonical.com>
Date: Mon, 16 Apr 2018 17:18:35 +0000
Subject: [PATCH] Log the error that made Daemon.Init() fail

Signed-off-by: Free Ekanayaka <free.ekanayaka at canonical.com>
---
 lxd/daemon.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/daemon.go b/lxd/daemon.go
index a045bb339..8c8ef3bfc 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -365,6 +365,7 @@ func (d *Daemon) Init() error {
 	// cleanup any state we produced so far. Errors happening here will be
 	// ignored.
 	if err != nil {
+		logger.Errorf("Failed to start the daemon: %v", err)
 		d.Stop()
 	}
 
@@ -699,6 +700,7 @@ func (d *Daemon) Kill() {
 
 // Stop stops the shared daemon.
 func (d *Daemon) Stop() error {
+	logger.Info("Starting shutdown sequence")
 	errs := []error{}
 	trackError := func(err error) {
 		if err != nil {
@@ -780,6 +782,9 @@ func (d *Daemon) Stop() error {
 		}
 		err = fmt.Errorf(format, errs[0])
 	}
+	if err != nil {
+		logger.Errorf("Failed to cleanly shutdown daemon: %v", err)
+	}
 	return err
 }
 


More information about the lxc-devel mailing list