From e384c4e2a1088b2456ef58ed932218f5be77d349 Mon Sep 17 00:00:00 2001
From: liuhao <liuhao27@huawei.com>
Date: Wed, 19 Jun 2019 16:48:50 +0800
Subject: [PATCH 116/131] lxc: set base cgroup path to '/'

reason:base cgroup may be started with /system.slice when cg_hybrid_init
read /proc/1/cgroup on host, and cgroup init will set all containers
cgroup path under /sys/fs/cgroup/<controller>/system.slice/xxx/lxc
directory, this is not consistent with docker. The default cgroup path
should be under /sys/fs/cgroup/<controller>/lxc directory.

Signed-off-by: zhangsong <zhangsong34@huawei.com>
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
 src/lxc/cgroups/cgfsng.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c
index 46f13f4d..7c92abe6 100644
--- a/src/lxc/cgroups/cgfsng.c
+++ b/src/lxc/cgroups/cgfsng.c
@@ -2545,6 +2545,9 @@ static bool cg_hybrid_init(struct cgroup_ops *ops)
 		if (!writeable)
 			goto next;
 		*/
+		if (strlen(base_cgroup) > 1 && base_cgroup[0] == '/') {
+			base_cgroup[1] = '\0';
+		}
 		if (type == CGROUP2_SUPER_MAGIC) {
 			char *cgv2_ctrl_path;
 
-- 
2.23.0

