[lxc-devel] [lxd/master] lxd/devlxd: Fix handling of projects

stgraber on Github lxc-bot at linuxcontainers.org
Wed Sep 25 19:40:10 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190925/ff43c662/attachment.bin>
-------------- next part --------------
From ac3f1eb656b00cfb1dafb77047129df26f25333d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 25 Sep 2019 15:38:48 -0400
Subject: [PATCH] lxd/devlxd: Fix handling of projects
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6239

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/devlxd.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxd/devlxd.go b/lxd/devlxd.go
index 60bbdae845..390a5bf9ea 100644
--- a/lxd/devlxd.go
+++ b/lxd/devlxd.go
@@ -435,7 +435,9 @@ func findContainerForPid(pid int32, d *Daemon) (container, error) {
 
 			project := "default"
 			if strings.Contains(name, "_") {
-				project = strings.Split(name, "_")[0]
+				fields := strings.SplitN(name, "_", 2)
+				project = fields[0]
+				name = fields[1]
 			}
 
 			inst, err := instanceLoadByProjectAndName(d.State(), project, name)


More information about the lxc-devel mailing list