The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/4330
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 15d5df628e46cea0d0465ee519f673ec06480968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com> Date: Tue, 13 Mar 2018 18:20:07 -0400 Subject: [PATCH] lxd: Re-introduce early check for running daemon MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- lxd/daemon.go | 8 +++++++- lxd/endpoints/local.go | 2 +- lxd/endpoints/socket.go | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lxd/daemon.go b/lxd/daemon.go index 25ee1aae8..7c00809d4 100644 --- a/lxd/daemon.go +++ b/lxd/daemon.go @@ -367,8 +367,14 @@ func (d *Daemon) Init() error { } func (d *Daemon) init() error { + // Lets check if there's an existing LXD running + err := endpoints.CheckAlreadyRunning(d.UnixSocket()) + if err != nil { + return err + } + /* Set the LVM environment */ - err := os.Setenv("LVM_SUPPRESS_FD_WARNINGS", "1") + err = os.Setenv("LVM_SUPPRESS_FD_WARNINGS", "1") if err != nil { return err } diff --git a/lxd/endpoints/local.go b/lxd/endpoints/local.go index e4dd85986..c91db701e 100644 --- a/lxd/endpoints/local.go +++ b/lxd/endpoints/local.go @@ -9,7 +9,7 @@ import ( func localCreateListener(dir string, group string) (net.Listener, error) { path := filepath.Join(dir, "unix.socket") - err := socketUnixCheckAlreadyRunning(path) + err := CheckAlreadyRunning(path) if err != nil { return nil, err } diff --git a/lxd/endpoints/socket.go b/lxd/endpoints/socket.go index 51ba2df46..8db63d09c 100644 --- a/lxd/endpoints/socket.go +++ b/lxd/endpoints/socket.go @@ -26,14 +26,14 @@ func socketUnixListen(path string) (net.Listener, error) { } -// Check if the socket at the given path is already bound to a running LXD -// process, and return an error if so. +// CheckAlreadyRunning checks if the socket at the given path is already +// bound to a running LXD process, and return an error if so. // // FIXME: We should probably rather just try a regular unix socket // connection without using the client. However this is the way // this logic has historically behaved, so let's keep it like it // was. -func socketUnixCheckAlreadyRunning(path string) error { +func CheckAlreadyRunning(path string) error { // If there's no socket file at all, there's nothing to do. if !shared.PathExists(path) { return nil
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel