Merge pull request #355 from rjnagal/syst
Fix Docker handler for machines that use systemd just as a naming service
This commit is contained in:
commit
0123fe1d07
@ -28,6 +28,7 @@ import (
|
|||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
"github.com/google/cadvisor/container"
|
"github.com/google/cadvisor/container"
|
||||||
"github.com/google/cadvisor/info"
|
"github.com/google/cadvisor/info"
|
||||||
|
"github.com/google/cadvisor/utils"
|
||||||
)
|
)
|
||||||
|
|
||||||
var ArgDockerEndpoint = flag.String("docker", "unix:///var/run/docker.sock", "docker endpoint")
|
var ArgDockerEndpoint = flag.String("docker", "unix:///var/run/docker.sock", "docker endpoint")
|
||||||
@ -45,8 +46,13 @@ func init() {
|
|||||||
useSystemd = systemd.UseSystemd()
|
useSystemd = systemd.UseSystemd()
|
||||||
if !useSystemd {
|
if !useSystemd {
|
||||||
// Second attempt at checking for systemd, check for a "name=systemd" cgroup.
|
// Second attempt at checking for systemd, check for a "name=systemd" cgroup.
|
||||||
_, err := cgroups.FindCgroupMountpoint("name=systemd")
|
mnt, err := cgroups.FindCgroupMountpoint("cpu")
|
||||||
useSystemd = (err == nil)
|
if err == nil {
|
||||||
|
// systemd presence does not mean systemd controls cgroups.
|
||||||
|
// If system.slice cgroup exists, then systemd is taking control.
|
||||||
|
// This breaks if user creates system.slice manually :)
|
||||||
|
useSystemd = utils.FileExists(mnt + "/system.slice")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user