mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #24773 from clnperez/cgroup-warnings
More accurate cgroup error messages
This commit is contained in:
commit
4640c19a88
1 changed files with 32 additions and 32 deletions
|
@ -271,14 +271,14 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
return warnings, fmt.Errorf("Minimum memory limit allowed is 4MB")
|
||||
}
|
||||
if resources.Memory > 0 && !sysInfo.MemoryLimit {
|
||||
warnings = append(warnings, "Your kernel does not support memory limit capabilities. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support memory limit capabilities. Limitation discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.Memory = 0
|
||||
resources.MemorySwap = -1
|
||||
}
|
||||
if resources.Memory > 0 && resources.MemorySwap != -1 && !sysInfo.SwapLimit {
|
||||
warnings = append(warnings, "Your kernel does not support swap limit capabilities, memory limited without swap.")
|
||||
logrus.Warn("Your kernel does not support swap limit capabilities, memory limited without swap.")
|
||||
warnings = append(warnings, "Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.")
|
||||
logrus.Warn("Your kernel does not support swap limit capabilities,or the cgroup is not mounted. Memory limited without swap.")
|
||||
resources.MemorySwap = -1
|
||||
}
|
||||
if resources.Memory > 0 && resources.MemorySwap > 0 && resources.MemorySwap < resources.Memory {
|
||||
|
@ -288,8 +288,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage")
|
||||
}
|
||||
if resources.MemorySwappiness != nil && *resources.MemorySwappiness != -1 && !sysInfo.MemorySwappiness {
|
||||
warnings = append(warnings, "Your kernel does not support memory swappiness capabilities. Memory swappiness discarded.")
|
||||
logrus.Warn("Your kernel does not support memory swappiness capabilities. Memory swappiness discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.")
|
||||
logrus.Warn("Your kernel does not support memory swappiness capabilities, or the cgroup is not mounted. Memory swappiness discarded.")
|
||||
resources.MemorySwappiness = nil
|
||||
}
|
||||
if resources.MemorySwappiness != nil {
|
||||
|
@ -299,8 +299,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
}
|
||||
}
|
||||
if resources.MemoryReservation > 0 && !sysInfo.MemoryReservation {
|
||||
warnings = append(warnings, "Your kernel does not support memory soft limit capabilities. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support memory soft limit capabilities. Limitation discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support memory soft limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support memory soft limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.MemoryReservation = 0
|
||||
}
|
||||
if resources.MemoryReservation > 0 && resources.MemoryReservation < linuxMinMemory {
|
||||
|
@ -310,8 +310,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
return warnings, fmt.Errorf("Minimum memory limit can not be less than memory reservation limit, see usage")
|
||||
}
|
||||
if resources.KernelMemory > 0 && !sysInfo.KernelMemory {
|
||||
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support kernel memory limit capabilities. Limitation discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
logrus.Warn("Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
||||
resources.KernelMemory = 0
|
||||
}
|
||||
if resources.KernelMemory > 0 && resources.KernelMemory < linuxMinMemory {
|
||||
|
@ -332,28 +332,28 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
}
|
||||
|
||||
if resources.PidsLimit != 0 && !sysInfo.PidsLimit {
|
||||
warnings = append(warnings, "Your kernel does not support pids limit capabilities. Pids limit discarded.")
|
||||
logrus.Warn("Your kernel does not support pids limit capabilities. Pids limit discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded.")
|
||||
logrus.Warn("Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded.")
|
||||
resources.PidsLimit = 0
|
||||
}
|
||||
|
||||
// cpu subsystem checks and adjustments
|
||||
if resources.CPUShares > 0 && !sysInfo.CPUShares {
|
||||
warnings = append(warnings, "Your kernel does not support CPU shares. Shares discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU shares. Shares discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support CPU shares or the cgroup is not mounted. Shares discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU shares or the cgroup is not mounted. Shares discarded.")
|
||||
resources.CPUShares = 0
|
||||
}
|
||||
if resources.CPUPeriod > 0 && !sysInfo.CPUCfsPeriod {
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs period. Period discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU cfs period. Period discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs period or the cgroup is not mounted. Period discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU cfs period or the cgroup is not mounted. Period discarded.")
|
||||
resources.CPUPeriod = 0
|
||||
}
|
||||
if resources.CPUPeriod != 0 && (resources.CPUPeriod < 1000 || resources.CPUPeriod > 1000000) {
|
||||
return warnings, fmt.Errorf("CPU cfs period can not be less than 1ms (i.e. 1000) or larger than 1s (i.e. 1000000)")
|
||||
}
|
||||
if resources.CPUQuota > 0 && !sysInfo.CPUCfsQuota {
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs quota. Quota discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU cfs quota. Quota discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support CPU cfs quota or the cgroup is not mounted. Quota discarded.")
|
||||
logrus.Warn("Your kernel does not support CPU cfs quota or the cgroup is not mounted. Quota discarded.")
|
||||
resources.CPUQuota = 0
|
||||
}
|
||||
if resources.CPUQuota > 0 && resources.CPUQuota < 1000 {
|
||||
|
@ -367,8 +367,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
|
||||
// cpuset subsystem checks and adjustments
|
||||
if (resources.CpusetCpus != "" || resources.CpusetMems != "") && !sysInfo.Cpuset {
|
||||
warnings = append(warnings, "Your kernel does not support cpuset. Cpuset discarded.")
|
||||
logrus.Warn("Your kernel does not support cpuset. Cpuset discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support cpuset or the cgroup is not mounted. Cpuset discarded.")
|
||||
logrus.Warn("Your kernel does not support cpuset or the cgroup is not mounted. Cpuset discarded.")
|
||||
resources.CpusetCpus = ""
|
||||
resources.CpusetMems = ""
|
||||
}
|
||||
|
@ -389,8 +389,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
|
||||
// blkio subsystem checks and adjustments
|
||||
if resources.BlkioWeight > 0 && !sysInfo.BlkioWeight {
|
||||
warnings = append(warnings, "Your kernel does not support Block I/O weight. Weight discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O weight. Weight discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support Block I/O weight or the cgroup is not mounted. Weight discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O weight or the cgroup is not mounted. Weight discarded.")
|
||||
resources.BlkioWeight = 0
|
||||
}
|
||||
if resources.BlkioWeight > 0 && (resources.BlkioWeight < 10 || resources.BlkioWeight > 1000) {
|
||||
|
@ -400,28 +400,28 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi
|
|||
return warnings, fmt.Errorf("Invalid QoS settings: %s does not support Maximum IO Bandwidth or Maximum IO IOps", runtime.GOOS)
|
||||
}
|
||||
if len(resources.BlkioWeightDevice) > 0 && !sysInfo.BlkioWeightDevice {
|
||||
warnings = append(warnings, "Your kernel does not support Block I/O weight-device. Weight-device discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O weight-device. Weight-device discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support Block I/O weight_device or the cgroup is not mounted. Weight-device discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O weight_device or the cgroup is not mounted. Weight-device discarded.")
|
||||
resources.BlkioWeightDevice = []*pblkiodev.WeightDevice{}
|
||||
}
|
||||
if len(resources.BlkioDeviceReadBps) > 0 && !sysInfo.BlkioReadBpsDevice {
|
||||
warnings = append(warnings, "Your kernel does not support Block read limit in bytes per second. Device read bps discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O read limit in bytes per second. Device read bps discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support BPS Block I/O read limit or the cgroup is not mounted. Block I/O BPS read limit discarded.")
|
||||
logrus.Warn("Your kernel does not support BPS Block I/O read limit or the cgroup is not mounted. Block I/O BPS read limit discarded")
|
||||
resources.BlkioDeviceReadBps = []*pblkiodev.ThrottleDevice{}
|
||||
}
|
||||
if len(resources.BlkioDeviceWriteBps) > 0 && !sysInfo.BlkioWriteBpsDevice {
|
||||
warnings = append(warnings, "Your kernel does not support Block write limit in bytes per second. Device write bps discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O write limit in bytes per second. Device write bps discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support BPS Block I/O write limit or the cgroup is not mounted. Block I/O BPS write limit discarded.")
|
||||
logrus.Warn("Your kernel does not support BPS Block I/O write limit or the cgroup is not mounted. Block I/O BPS write limit discarded.")
|
||||
resources.BlkioDeviceWriteBps = []*pblkiodev.ThrottleDevice{}
|
||||
}
|
||||
if len(resources.BlkioDeviceReadIOps) > 0 && !sysInfo.BlkioReadIOpsDevice {
|
||||
warnings = append(warnings, "Your kernel does not support Block read limit in IO per second. Device read iops discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O read limit in IO per second. Device read iops discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support IOPS Block read limit or the cgroup is not mounted. Block I/O IOPS read limit discarded.")
|
||||
logrus.Warn("Your kernel does not support IOPS Block I/O read limit in IO or the cgroup is not mounted. Block I/O IOPS read limit discarded.")
|
||||
resources.BlkioDeviceReadIOps = []*pblkiodev.ThrottleDevice{}
|
||||
}
|
||||
if len(resources.BlkioDeviceWriteIOps) > 0 && !sysInfo.BlkioWriteIOpsDevice {
|
||||
warnings = append(warnings, "Your kernel does not support Block write limit in IO per second. Device write iops discarded.")
|
||||
logrus.Warn("Your kernel does not support Block I/O write limit in IO per second. Device write iops discarded.")
|
||||
warnings = append(warnings, "Your kernel does not support IOPS Block write limit or the cgroup is not mounted. Block I/O IOPS write limit discarded.")
|
||||
logrus.Warn("Your kernel does not support IOPS Block I/O write limit or the cgroup is not mounted. Block I/O IOPS write limit discarded.")
|
||||
resources.BlkioDeviceWriteIOps = []*pblkiodev.ThrottleDevice{}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue