The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/8001

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) ===

From f5d8caf7988e3d6e6fd0a772540d696c92e2bc7d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 8 Oct 2020 11:18:34 -0400
Subject: [PATCH 1/2] lxd/operations: Fix timeout
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/operations.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/operations.go b/lxd/operations.go
index aa982b7034..e5d934c9ed 100644
--- a/lxd/operations.go
+++ b/lxd/operations.go
@@ -97,7 +97,7 @@ func waitForOperations(s *state.State, chCancel chan 
struct{}) {
                        if execConsoleOps > 0 {
                                logger.Info("Timeout reached, continuing with 
shutdown")
                        }
-
+                       return
                case <-logTick:
                        // Print log message every minute.
                        logger.Infof("Waiting for %d operation(s) to finish", 
runningOps)

From 3a6bf54b1ac3dc9156f267a7694aa4eb3f9b896c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Thu, 8 Oct 2020 13:06:49 -0400
Subject: [PATCH 2/2] lxd/daemon: Allow more operations during shutdown
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 | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/lxd/daemon.go b/lxd/daemon.go
index a422ef8b20..e04cafc397 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -461,7 +461,25 @@ func (d *Daemon) createCmd(restAPI *mux.Router, version 
string, c APIEndpoint) {
                // - internal calls, e.g. lxd shutdown
                // - events endpoint as this is accessed when running `lxd 
shutdown`
                // - /1.0 endpoint
-               if version != "internal" && c.Path != "events" && c.Path != "" 
&& d.ctx.Err() == context.Canceled {
+               // - /1.0/operations endpoints
+               // - GET queries
+               allowedDuringShutdown := func() bool {
+                       if version == "internal" {
+                               return true
+                       }
+
+                       if c.Path == "" || c.Path == "events" || c.Path == 
"operations" || strings.HasPrefix(c.Path, "operations/") {
+                               return true
+                       }
+
+                       if r.Method == "GET" {
+                               return true
+                       }
+
+                       return false
+               }
+
+               if d.ctx.Err() == context.Canceled && !allowedDuringShutdown() {
                        response.Unavailable(fmt.Errorf("LXD is shutting 
down")).Render(w)
                        return
                }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to