Add systemd information to validate output.
This commit is contained in:
parent
124c08f82a
commit
4ec9894ea2
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user