From 34a8b1fd9f7bfa03ab3201019bd9519396689a98 Mon Sep 17 00:00:00 2001 From: FengyunPan2 Date: Tue, 25 Sep 2018 10:10:12 +0800 Subject: [PATCH] Add helpful log for checking cgrop path Currently I just get 'xxx cgroup does not exist', but I don't know which path has missed. Let's add log for it. --- pkg/kubelet/cm/cgroup_manager_linux.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/cm/cgroup_manager_linux.go b/pkg/kubelet/cm/cgroup_manager_linux.go index 6a4d65cd858..60b0e656041 100644 --- a/pkg/kubelet/cm/cgroup_manager_linux.go +++ b/pkg/kubelet/cm/cgroup_manager_linux.go @@ -257,6 +257,7 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool { // once resolved, we can remove this code. whitelistControllers := sets.NewString("cpu", "cpuacct", "cpuset", "memory", "systemd") + var missingPaths []string // If even one cgroup path doesn't exist, then the cgroup doesn't exist. for controller, path := range cgroupPaths { // ignore mounts we don't care about @@ -264,10 +265,15 @@ func (m *cgroupManagerImpl) Exists(name CgroupName) bool { continue } if !libcontainercgroups.PathExists(path) { - return false + missingPaths = append(missingPaths, path) } } + if len(missingPaths) > 0 { + glog.V(4).Infof("The Cgroup %v has some missing paths: %v", name, missingPaths) + return false + } + return true }