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

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 c497e53dc064bc467652a620d950caf7280f1749 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Fri, 20 Sep 2019 12:14:43 +0200
Subject: [PATCH] lxd/containers: Respect raw.lxc on stop/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/container_lxc.go | 38 ++++++++++++++++++++++++++++----------
 1 file changed, 28 insertions(+), 10 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 93b7beaf06..67e2e5f2d6 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2864,11 +2864,20 @@ func (c *containerLXC) Stop(stateful bool) error {
        }
 
        // Load the go-lxc struct
-       err = c.initLXC(false)
-       if err != nil {
-               op.Done(err)
-               logger.Error("Failed stopping container", ctxMap)
-               return err
+       if c.expandedConfig["raw.lxc"] != "" {
+               err = c.initLXC(true)
+               if err != nil {
+                       op.Done(err)
+                       logger.Error("Failed stopping container", ctxMap)
+                       return err
+               }
+       } else {
+               err = c.initLXC(false)
+               if err != nil {
+                       op.Done(err)
+                       logger.Error("Failed stopping container", ctxMap)
+                       return err
+               }
        }
 
        // Fork-bomb mitigation, prevent forking from this point on
@@ -2935,11 +2944,20 @@ func (c *containerLXC) Shutdown(timeout time.Duration) 
error {
        logger.Info("Shutting down container", ctxMap)
 
        // Load the go-lxc struct
-       err = c.initLXC(false)
-       if err != nil {
-               op.Done(err)
-               logger.Error("Failed shutting down container", ctxMap)
-               return err
+       if c.expandedConfig["raw.lxc"] != "" {
+               err = c.initLXC(true)
+               if err != nil {
+                       op.Done(err)
+                       logger.Error("Failed stopping container", ctxMap)
+                       return err
+               }
+       } else {
+               err = c.initLXC(false)
+               if err != nil {
+                       op.Done(err)
+                       logger.Error("Failed stopping container", ctxMap)
+                       return err
+               }
        }
 
        if err := c.c.Shutdown(timeout); err != nil {
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to