Skip to content

Commit

Permalink
Add cgroup mount directory names to validate output.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjnagal committed Dec 22, 2014
1 parent 6455f81 commit 21e1d8f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 21e1d8f

Please sign in to comment.