Add systemd information to validate output.

This commit is contained in:
Rohit Jnagal 2014-12-15 23:26:30 +00:00
parent 124c08f82a
commit 4ec9894ea2
2 changed files with 12 additions and 2 deletions

View File

@ -50,6 +50,11 @@ func init() {
}
}
func UseSystemd() bool {
// init would run and initialize useSystemd before we can call this method.
return useSystemd
}
type dockerFactory struct {
machineInfoFactory info.MachineInfoFactory

View File

@ -23,12 +23,12 @@ import (
"io/ioutil"
"log"
"net/http"
"os"
"strings"
"github.com/docker/libcontainer/cgroups"
dclient "github.com/fsouza/go-dockerclient"
"github.com/google/cadvisor/container/docker"
"github.com/google/cadvisor/utils"
)
const ValidatePage = "/validate/"
@ -163,6 +163,11 @@ func validateDockerInfo() (string, string) {
execDriver := info.Get("ExecutionDriver")
storageDriver := info.Get("Driver")
desc := fmt.Sprintf("Docker exec driver is %s. Storage driver is %s.\n", execDriver, storageDriver)
if docker.UseSystemd() {
desc += "\tsystemd is being used to create cgroups.\n"
} else {
desc += "\tCgroups are being created through cgroup filesystem.\n"
}
if strings.Contains(execDriver, "native") {
return Recommended, desc
} else if strings.Contains(execDriver, "lxc") {
@ -184,7 +189,7 @@ func validateCgroupMounts() (string, string) {
return Unknown, out
}
mnt = strings.TrimSuffix(mnt, "/cpu")
if _, err := os.Stat(mnt); err != nil {
if !utils.FileExists(mnt) {
out := fmt.Sprintf("Cgroup mount directory %s inaccessible.\n", mnt)
out += desc
return Unsupported, out