More accurate cgroup error messages
| ... | ... |
@@ -271,14 +271,14 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 271 | 271 |
return warnings, fmt.Errorf("Minimum memory limit allowed is 4MB")
|
| 272 | 272 |
} |
| 273 | 273 |
if resources.Memory > 0 && !sysInfo.MemoryLimit {
|
| 274 |
- warnings = append(warnings, "Your kernel does not support memory limit capabilities. Limitation discarded.") |
|
| 275 |
- logrus.Warn("Your kernel does not support memory limit capabilities. Limitation discarded.")
|
|
| 274 |
+ warnings = append(warnings, "Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.") |
|
| 275 |
+ logrus.Warn("Your kernel does not support memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
|
| 276 | 276 |
resources.Memory = 0 |
| 277 | 277 |
resources.MemorySwap = -1 |
| 278 | 278 |
} |
| 279 | 279 |
if resources.Memory > 0 && resources.MemorySwap != -1 && !sysInfo.SwapLimit {
|
| 280 |
- warnings = append(warnings, "Your kernel does not support swap limit capabilities, memory limited without swap.") |
|
| 281 |
- logrus.Warn("Your kernel does not support swap limit capabilities, memory limited without swap.")
|
|
| 280 |
+ warnings = append(warnings, "Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.") |
|
| 281 |
+ logrus.Warn("Your kernel does not support swap limit capabilities,or the cgroup is not mounted. Memory limited without swap.")
|
|
| 282 | 282 |
resources.MemorySwap = -1 |
| 283 | 283 |
} |
| 284 | 284 |
if resources.Memory > 0 && resources.MemorySwap > 0 && resources.MemorySwap < resources.Memory {
|
| ... | ... |
@@ -288,8 +288,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 288 | 288 |
return warnings, fmt.Errorf("You should always set the Memory limit when using Memoryswap limit, see usage")
|
| 289 | 289 |
} |
| 290 | 290 |
if resources.MemorySwappiness != nil && *resources.MemorySwappiness != -1 && !sysInfo.MemorySwappiness {
|
| 291 |
- warnings = append(warnings, "Your kernel does not support memory swappiness capabilities. Memory swappiness discarded.") |
|
| 292 |
- logrus.Warn("Your kernel does not support memory swappiness capabilities. Memory swappiness discarded.")
|
|
| 291 |
+ warnings = append(warnings, "Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.") |
|
| 292 |
+ logrus.Warn("Your kernel does not support memory swappiness capabilities, or the cgroup is not mounted. Memory swappiness discarded.")
|
|
| 293 | 293 |
resources.MemorySwappiness = nil |
| 294 | 294 |
} |
| 295 | 295 |
if resources.MemorySwappiness != nil {
|
| ... | ... |
@@ -299,8 +299,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 299 | 299 |
} |
| 300 | 300 |
} |
| 301 | 301 |
if resources.MemoryReservation > 0 && !sysInfo.MemoryReservation {
|
| 302 |
- warnings = append(warnings, "Your kernel does not support memory soft limit capabilities. Limitation discarded.") |
|
| 303 |
- logrus.Warn("Your kernel does not support memory soft limit capabilities. Limitation discarded.")
|
|
| 302 |
+ warnings = append(warnings, "Your kernel does not support memory soft limit capabilities or the cgroup is not mounted. Limitation discarded.") |
|
| 303 |
+ logrus.Warn("Your kernel does not support memory soft limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
|
| 304 | 304 |
resources.MemoryReservation = 0 |
| 305 | 305 |
} |
| 306 | 306 |
if resources.MemoryReservation > 0 && resources.MemoryReservation < linuxMinMemory {
|
| ... | ... |
@@ -310,8 +310,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 310 | 310 |
return warnings, fmt.Errorf("Minimum memory limit can not be less than memory reservation limit, see usage")
|
| 311 | 311 |
} |
| 312 | 312 |
if resources.KernelMemory > 0 && !sysInfo.KernelMemory {
|
| 313 |
- warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities. Limitation discarded.") |
|
| 314 |
- logrus.Warn("Your kernel does not support kernel memory limit capabilities. Limitation discarded.")
|
|
| 313 |
+ warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.") |
|
| 314 |
+ logrus.Warn("Your kernel does not support kernel memory limit capabilities or the cgroup is not mounted. Limitation discarded.")
|
|
| 315 | 315 |
resources.KernelMemory = 0 |
| 316 | 316 |
} |
| 317 | 317 |
if resources.KernelMemory > 0 && resources.KernelMemory < linuxMinMemory {
|
| ... | ... |
@@ -332,28 +332,28 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 332 | 332 |
} |
| 333 | 333 |
|
| 334 | 334 |
if resources.PidsLimit != 0 && !sysInfo.PidsLimit {
|
| 335 |
- warnings = append(warnings, "Your kernel does not support pids limit capabilities. Pids limit discarded.") |
|
| 336 |
- logrus.Warn("Your kernel does not support pids limit capabilities. Pids limit discarded.")
|
|
| 335 |
+ warnings = append(warnings, "Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded.") |
|
| 336 |
+ logrus.Warn("Your kernel does not support pids limit capabilities or the cgroup is not mounted. PIDs limit discarded.")
|
|
| 337 | 337 |
resources.PidsLimit = 0 |
| 338 | 338 |
} |
| 339 | 339 |
|
| 340 | 340 |
// cpu subsystem checks and adjustments |
| 341 | 341 |
if resources.CPUShares > 0 && !sysInfo.CPUShares {
|
| 342 |
- warnings = append(warnings, "Your kernel does not support CPU shares. Shares discarded.") |
|
| 343 |
- logrus.Warn("Your kernel does not support CPU shares. Shares discarded.")
|
|
| 342 |
+ warnings = append(warnings, "Your kernel does not support CPU shares or the cgroup is not mounted. Shares discarded.") |
|
| 343 |
+ logrus.Warn("Your kernel does not support CPU shares or the cgroup is not mounted. Shares discarded.")
|
|
| 344 | 344 |
resources.CPUShares = 0 |
| 345 | 345 |
} |
| 346 | 346 |
if resources.CPUPeriod > 0 && !sysInfo.CPUCfsPeriod {
|
| 347 |
- warnings = append(warnings, "Your kernel does not support CPU cfs period. Period discarded.") |
|
| 348 |
- logrus.Warn("Your kernel does not support CPU cfs period. Period discarded.")
|
|
| 347 |
+ warnings = append(warnings, "Your kernel does not support CPU cfs period or the cgroup is not mounted. Period discarded.") |
|
| 348 |
+ logrus.Warn("Your kernel does not support CPU cfs period or the cgroup is not mounted. Period discarded.")
|
|
| 349 | 349 |
resources.CPUPeriod = 0 |
| 350 | 350 |
} |
| 351 | 351 |
if resources.CPUPeriod != 0 && (resources.CPUPeriod < 1000 || resources.CPUPeriod > 1000000) {
|
| 352 | 352 |
return warnings, fmt.Errorf("CPU cfs period can not be less than 1ms (i.e. 1000) or larger than 1s (i.e. 1000000)")
|
| 353 | 353 |
} |
| 354 | 354 |
if resources.CPUQuota > 0 && !sysInfo.CPUCfsQuota {
|
| 355 |
- warnings = append(warnings, "Your kernel does not support CPU cfs quota. Quota discarded.") |
|
| 356 |
- logrus.Warn("Your kernel does not support CPU cfs quota. Quota discarded.")
|
|
| 355 |
+ warnings = append(warnings, "Your kernel does not support CPU cfs quota or the cgroup is not mounted. Quota discarded.") |
|
| 356 |
+ logrus.Warn("Your kernel does not support CPU cfs quota or the cgroup is not mounted. Quota discarded.")
|
|
| 357 | 357 |
resources.CPUQuota = 0 |
| 358 | 358 |
} |
| 359 | 359 |
if resources.CPUQuota > 0 && resources.CPUQuota < 1000 {
|
| ... | ... |
@@ -367,8 +367,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 367 | 367 |
|
| 368 | 368 |
// cpuset subsystem checks and adjustments |
| 369 | 369 |
if (resources.CpusetCpus != "" || resources.CpusetMems != "") && !sysInfo.Cpuset {
|
| 370 |
- warnings = append(warnings, "Your kernel does not support cpuset. Cpuset discarded.") |
|
| 371 |
- logrus.Warn("Your kernel does not support cpuset. Cpuset discarded.")
|
|
| 370 |
+ warnings = append(warnings, "Your kernel does not support cpuset or the cgroup is not mounted. Cpuset discarded.") |
|
| 371 |
+ logrus.Warn("Your kernel does not support cpuset or the cgroup is not mounted. Cpuset discarded.")
|
|
| 372 | 372 |
resources.CpusetCpus = "" |
| 373 | 373 |
resources.CpusetMems = "" |
| 374 | 374 |
} |
| ... | ... |
@@ -389,8 +389,8 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 389 | 389 |
|
| 390 | 390 |
// blkio subsystem checks and adjustments |
| 391 | 391 |
if resources.BlkioWeight > 0 && !sysInfo.BlkioWeight {
|
| 392 |
- warnings = append(warnings, "Your kernel does not support Block I/O weight. Weight discarded.") |
|
| 393 |
- logrus.Warn("Your kernel does not support Block I/O weight. Weight discarded.")
|
|
| 392 |
+ warnings = append(warnings, "Your kernel does not support Block I/O weight or the cgroup is not mounted. Weight discarded.") |
|
| 393 |
+ logrus.Warn("Your kernel does not support Block I/O weight or the cgroup is not mounted. Weight discarded.")
|
|
| 394 | 394 |
resources.BlkioWeight = 0 |
| 395 | 395 |
} |
| 396 | 396 |
if resources.BlkioWeight > 0 && (resources.BlkioWeight < 10 || resources.BlkioWeight > 1000) {
|
| ... | ... |
@@ -400,28 +400,28 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
| 400 | 400 |
return warnings, fmt.Errorf("Invalid QoS settings: %s does not support Maximum IO Bandwidth or Maximum IO IOps", runtime.GOOS)
|
| 401 | 401 |
} |
| 402 | 402 |
if len(resources.BlkioWeightDevice) > 0 && !sysInfo.BlkioWeightDevice {
|
| 403 |
- warnings = append(warnings, "Your kernel does not support Block I/O weight-device. Weight-device discarded.") |
|
| 404 |
- logrus.Warn("Your kernel does not support Block I/O weight-device. Weight-device discarded.")
|
|
| 403 |
+ warnings = append(warnings, "Your kernel does not support Block I/O weight_device or the cgroup is not mounted. Weight-device discarded.") |
|
| 404 |
+ logrus.Warn("Your kernel does not support Block I/O weight_device or the cgroup is not mounted. Weight-device discarded.")
|
|
| 405 | 405 |
resources.BlkioWeightDevice = []*pblkiodev.WeightDevice{}
|
| 406 | 406 |
} |
| 407 | 407 |
if len(resources.BlkioDeviceReadBps) > 0 && !sysInfo.BlkioReadBpsDevice {
|
| 408 |
- warnings = append(warnings, "Your kernel does not support Block read limit in bytes per second. Device read bps discarded.") |
|
| 409 |
- logrus.Warn("Your kernel does not support Block I/O read limit in bytes per second. Device read bps discarded.")
|
|
| 408 |
+ 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.") |
|
| 409 |
+ 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")
|
|
| 410 | 410 |
resources.BlkioDeviceReadBps = []*pblkiodev.ThrottleDevice{}
|
| 411 | 411 |
} |
| 412 | 412 |
if len(resources.BlkioDeviceWriteBps) > 0 && !sysInfo.BlkioWriteBpsDevice {
|
| 413 |
- warnings = append(warnings, "Your kernel does not support Block write limit in bytes per second. Device write bps discarded.") |
|
| 414 |
- logrus.Warn("Your kernel does not support Block I/O write limit in bytes per second. Device write bps discarded.")
|
|
| 413 |
+ 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.") |
|
| 414 |
+ 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.")
|
|
| 415 | 415 |
resources.BlkioDeviceWriteBps = []*pblkiodev.ThrottleDevice{}
|
| 416 | 416 |
} |
| 417 | 417 |
if len(resources.BlkioDeviceReadIOps) > 0 && !sysInfo.BlkioReadIOpsDevice {
|
| 418 |
- warnings = append(warnings, "Your kernel does not support Block read limit in IO per second. Device read iops discarded.") |
|
| 419 |
- logrus.Warn("Your kernel does not support Block I/O read limit in IO per second. Device read iops discarded.")
|
|
| 418 |
+ 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.") |
|
| 419 |
+ 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.")
|
|
| 420 | 420 |
resources.BlkioDeviceReadIOps = []*pblkiodev.ThrottleDevice{}
|
| 421 | 421 |
} |
| 422 | 422 |
if len(resources.BlkioDeviceWriteIOps) > 0 && !sysInfo.BlkioWriteIOpsDevice {
|
| 423 |
- warnings = append(warnings, "Your kernel does not support Block write limit in IO per second. Device write iops discarded.") |
|
| 424 |
- logrus.Warn("Your kernel does not support Block I/O write limit in IO per second. Device write iops discarded.")
|
|
| 423 |
+ 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.") |
|
| 424 |
+ 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.")
|
|
| 425 | 425 |
resources.BlkioDeviceWriteIOps = []*pblkiodev.ThrottleDevice{}
|
| 426 | 426 |
} |
| 427 | 427 |
|