[lxc-devel] [lxd/master] lxd/containers: Fix cluster shutdown
stgraber on Github
lxc-bot at linuxcontainers.org
Thu Oct 11 21:52:37 UTC 2018
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/20181011/ebd5ea18/attachment.bin>
-------------- next part --------------
From cdc7f34bba9e6e43d7311540e195dc3f939b2c22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 11 Oct 2018 17:51:54 -0400
Subject: [PATCH] lxd/containers: Fix cluster shutdown
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/containers.go | 14 ++++++++++++--
test/suites/clustering.sh | 2 +-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/lxd/containers.go b/lxd/containers.go
index 6eb134de17..f6e68bf36a 100644
--- a/lxd/containers.go
+++ b/lxd/containers.go
@@ -4,6 +4,7 @@ import (
"io/ioutil"
"sort"
"strconv"
+ "strings"
"sync"
"time"
@@ -208,9 +209,18 @@ func containersShutdown(s *state.State) error {
}
for _, file := range files {
+ project := "default"
+ name := file.Name()
+ if strings.Contains(name, "_") {
+ fields := strings.Split(file.Name(), "_")
+ project = fields[0]
+ name = fields[1]
+ }
+
c, err := containerLXCLoad(s, db.ContainerArgs{
- Name: file.Name(),
- Config: make(map[string]string),
+ Project: project,
+ Name: name,
+ Config: make(map[string]string),
}, nil)
if err != nil {
return err
diff --git a/test/suites/clustering.sh b/test/suites/clustering.sh
index ae2d831274..17af533c07 100644
--- a/test/suites/clustering.sh
+++ b/test/suites/clustering.sh
@@ -973,7 +973,7 @@ test_clustering_shutdown_nodes() {
wait "$(cat one.pid)"
# Container foo shouldn't be running anymore
- ! ps -q "$(cat foo.pid)"
+ [ ! -e "/proc/$(cat foo.pid)" ]
rm -f one.pid two.pid three.pid foo.pid
More information about the lxc-devel
mailing list