mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Check sysinfo for Cpuset cpu.shares and blkio
Carried: #14015 If kernel is compiled with CONFIG_FAIR_GROUP_SCHED disabled cpu.shares doesn't exist. If kernel is compiled with CONFIG_CFQ_GROUP_IOSCHED disabled blkio.weight doesn't exist. If kernel is compiled with CONFIG_CPUSETS disabled cpuset won't be supported. We need to handle these conditions by checking sysinfo and verifying them. Signed-off-by: Zefan Li <lizefan@huawei.com> Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
This commit is contained in:
parent
a15b676ee1
commit
b7599d58cb
3 changed files with 69 additions and 0 deletions
|
@ -166,6 +166,11 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *runconfig.HostC
|
|||
return warnings, fmt.Errorf("Invalid value: %v, valid memory swappiness range is 0-100.", swappiness)
|
||||
}
|
||||
}
|
||||
if hostConfig.CPUShares > 0 && !daemon.SystemConfig().CPUShares {
|
||||
warnings = append(warnings, "Your kernel does not support CPU shares. Shares discarded.")
|
||||
logrus.Warnf("Your kernel does not support CPU shares. Shares discarded.")
|
||||
hostConfig.CPUShares = 0
|
||||
}
|
||||
if hostConfig.CPUPeriod > 0 && !daemon.SystemConfig().CPUCfsPeriod {
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs period. Period discarded.")
|
||||
logrus.Warnf("Your kernel does not support CPU cfs period. Period discarded.")
|
||||
|
@ -176,6 +181,17 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *runconfig.HostC
|
|||
logrus.Warnf("Your kernel does not support CPU cfs quota. Quota discarded.")
|
||||
hostConfig.CPUQuota = 0
|
||||
}
|
||||
if (hostConfig.CpusetCpus != "" || hostConfig.CpusetMems != "") && !daemon.SystemConfig().Cpuset {
|
||||
warnings = append(warnings, "Your kernel does not support cpuset. Cpuset discarded.")
|
||||
logrus.Warnf("Your kernel does not support cpuset. Cpuset discarded.")
|
||||
hostConfig.CpusetCpus = ""
|
||||
hostConfig.CpusetMems = ""
|
||||
}
|
||||
if hostConfig.BlkioWeight > 0 && !daemon.SystemConfig().BlkioWeight {
|
||||
warnings = append(warnings, "Your kernel does not support Block I/O weight. Weight discarded.")
|
||||
logrus.Warnf("Your kernel does not support Block I/O weight. Weight discarded.")
|
||||
hostConfig.BlkioWeight = 0
|
||||
}
|
||||
if hostConfig.BlkioWeight > 0 && (hostConfig.BlkioWeight < 10 || hostConfig.BlkioWeight > 1000) {
|
||||
return warnings, fmt.Errorf("Range of blkio weight is from 10 to 1000.")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue