1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #42878 from thaJeztah/daemon_check_cd_once

daemon.UsingSystemd(): don't call getCD() multiple times
This commit is contained in:
Tianon Gravi 2021-10-06 17:28:35 -07:00 committed by GitHub
commit 1430d849a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -628,11 +628,13 @@ func verifyCgroupDriver(config *config.Config) error {
// UsingSystemd returns true if cli option includes native.cgroupdriver=systemd
func UsingSystemd(config *config.Config) bool {
if getCD(config) == cgroupSystemdDriver {
cd := getCD(config)
if cd == cgroupSystemdDriver {
return true
}
// On cgroup v2 hosts, default to systemd driver
if getCD(config) == "" && cgroups.Mode() == cgroups.Unified && isRunningSystemd() {
if cd == "" && cgroups.Mode() == cgroups.Unified && isRunningSystemd() {
return true
}
return false