From 21e1d8f917f7d899b5af59816847bc5c3191fc05 Mon Sep 17 00:00:00 2001 From: Rohit Jnagal Date: Mon, 22 Dec 2014 18:25:13 +0000 Subject: [PATCH] Add cgroup mount directory names to validate output. --- validate/validate.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/validate/validate.go b/validate/validate.go index 9c52b04eee..c386dc526e 100644 --- a/validate/validate.go +++ b/validate/validate.go @@ -194,8 +194,32 @@ func validateCgroupMounts() (string, string) { out += desc return Unsupported, out } + mounts, err := ioutil.ReadDir(mnt) + if err != nil { + out := fmt.Sprintf("Could not read cgroup mount directory %s.\n", mnt) + out += desc + return Unsupported, out + } + mountNames := "\tCgroup mount directories: " + for _, mount := range mounts { + mountNames += mount.Name() + " " + } + mountNames += "\n" out := fmt.Sprintf("Cgroups are mounted at %s.\n", mnt) + out += mountNames out += desc + info, err := ioutil.ReadFile("/proc/mounts") + if err != nil { + out := fmt.Sprintf("Could not read /proc/mounts.\n") + out += desc + return Unsupported, out + } + out += "\tCgroup mounts:\n" + for _, line := range strings.Split(string(info), "\n") { + if strings.Contains(line, " cgroup ") { + out += "\t" + line + "\n" + } + } if mnt == recommendedMount { return Recommended, out }