Merge pull request #349 from vmarmol/systemd
Try to detect systemd by checking for its named cgroup hierarchy.
This commit is contained in:
commit
90e407d234
@ -22,6 +22,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/docker/libcontainer/cgroups"
|
||||||
"github.com/docker/libcontainer/cgroups/systemd"
|
"github.com/docker/libcontainer/cgroups/systemd"
|
||||||
"github.com/fsouza/go-dockerclient"
|
"github.com/fsouza/go-dockerclient"
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
@ -42,8 +43,10 @@ var useSystemd bool
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
useSystemd = systemd.UseSystemd()
|
useSystemd = systemd.UseSystemd()
|
||||||
if useSystemd {
|
if !useSystemd {
|
||||||
glog.Infof("System is using systemd")
|
// Second attempt at checking for systemd, check for a "name=systemd" cgroup.
|
||||||
|
_, err := cgroups.FindCgroupMountpoint("name=systemd")
|
||||||
|
useSystemd = (err == nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,6 +203,10 @@ func Register(factory info.MachineInfoFactory) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if useSystemd {
|
||||||
|
glog.Infof("System is using systemd")
|
||||||
|
}
|
||||||
|
|
||||||
glog.Infof("Registering Docker factory")
|
glog.Infof("Registering Docker factory")
|
||||||
f := &dockerFactory{
|
f := &dockerFactory{
|
||||||
machineInfoFactory: factory,
|
machineInfoFactory: factory,
|
||||||
|
Loading…
Reference in New Issue
Block a user