Signed-off-by: allencloud <allen.sun@daocloud.io>
allencloud authored on 2016/07/11 19:29:17... | ... |
@@ -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. Memory swappiness discarded.") |
|
292 |
+ logrus.Warn("Your kernel does not support memory swappiness capabilities. Memory swappiness discarded.") |
|
293 | 293 |
resources.MemorySwappiness = nil |
294 | 294 |
} |
295 | 295 |
if resources.MemorySwappiness != nil { |
... | ... |
@@ -307,7 +307,7 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
307 | 307 |
return warnings, fmt.Errorf("Minimum memory reservation allowed is 4MB") |
308 | 308 |
} |
309 | 309 |
if resources.Memory > 0 && resources.MemoryReservation > 0 && resources.Memory < resources.MemoryReservation { |
310 |
- return warnings, fmt.Errorf("Minimum memory limit should be larger than memory reservation limit, see usage") |
|
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 | 313 |
warnings = append(warnings, "Your kernel does not support kernel memory limit capabilities. Limitation discarded.") |
... | ... |
@@ -325,15 +325,15 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
325 | 325 |
// only produce warnings if the setting wasn't to *disable* the OOM Kill; no point |
326 | 326 |
// warning the caller if they already wanted the feature to be off |
327 | 327 |
if *resources.OomKillDisable { |
328 |
- warnings = append(warnings, "Your kernel does not support OomKillDisable, OomKillDisable discarded.") |
|
329 |
- logrus.Warn("Your kernel does not support OomKillDisable, OomKillDisable discarded.") |
|
328 |
+ warnings = append(warnings, "Your kernel does not support OomKillDisable. OomKillDisable discarded.") |
|
329 |
+ logrus.Warn("Your kernel does not support OomKillDisable. OomKillDisable discarded.") |
|
330 | 330 |
} |
331 | 331 |
resources.OomKillDisable = nil |
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. Pids limit discarded.") |
|
336 |
+ logrus.Warn("Your kernel does not support pids limit capabilities. Pids limit discarded.") |
|
337 | 337 |
resources.PidsLimit = 0 |
338 | 338 |
} |
339 | 339 |
|
... | ... |
@@ -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.") |
|
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. Weight-device discarded.") |
|
404 |
+ logrus.Warn("Your kernel does not support Block I/O weight-device. 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.") |
|
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 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.") |
|
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.") |
|
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 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.") |
|
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.") |
|
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 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.") |
|
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.") |
|
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 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.") |
|
425 | 425 |
resources.BlkioDeviceWriteIOps = []*pblkiodev.ThrottleDevice{} |
426 | 426 |
} |
427 | 427 |
|
... | ... |
@@ -481,7 +481,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes. |
481 | 481 |
warnings = append(warnings, w...) |
482 | 482 |
|
483 | 483 |
if hostConfig.ShmSize < 0 { |
484 |
- return warnings, fmt.Errorf("SHM size must be greater than 0") |
|
484 |
+ return warnings, fmt.Errorf("SHM size can not be less than 0") |
|
485 | 485 |
} |
486 | 486 |
|
487 | 487 |
if hostConfig.OomScoreAdj < -1000 || hostConfig.OomScoreAdj > 1000 { |
... | ... |
@@ -101,33 +101,33 @@ func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysi |
101 | 101 |
// TODO Windows: Add more validation of resource settings not supported on Windows |
102 | 102 |
|
103 | 103 |
if resources.BlkioWeight > 0 { |
104 |
- warnings = append(warnings, "Windows does not support Block I/O weight. Weight discarded.") |
|
105 |
- logrus.Warn("Windows does not support Block I/O weight. --blkio-weight discarded.") |
|
104 |
+ warnings = append(warnings, "Windows does not support Block I/O weight. Block I/O weight discarded.") |
|
105 |
+ logrus.Warn("Windows does not support Block I/O weight. Block I/O weight discarded.") |
|
106 | 106 |
resources.BlkioWeight = 0 |
107 | 107 |
} |
108 | 108 |
if len(resources.BlkioWeightDevice) > 0 { |
109 |
- warnings = append(warnings, "Windows does not support Block I/O weight_device.") |
|
110 |
- logrus.Warn("Windows does not support Block I/O weight_device. --blkio-weight-device discarded.") |
|
109 |
+ warnings = append(warnings, "Windows does not support Block I/O weight-device. Weight-device discarded.") |
|
110 |
+ logrus.Warn("Windows does not support Block I/O weight-device. Weight-device discarded.") |
|
111 | 111 |
resources.BlkioWeightDevice = []*pblkiodev.WeightDevice{} |
112 | 112 |
} |
113 | 113 |
if len(resources.BlkioDeviceReadBps) > 0 { |
114 |
- warnings = append(warnings, "Windows does not support Block read limit in bytes per second.") |
|
115 |
- logrus.Warn("Windows does not support Block I/O read limit in bytes per second. --device-read-bps discarded.") |
|
114 |
+ warnings = append(warnings, "Windows does not support Block read limit in bytes per second. Device read bps discarded.") |
|
115 |
+ logrus.Warn("Windows does not support Block I/O read limit in bytes per second. Device read bps discarded.") |
|
116 | 116 |
resources.BlkioDeviceReadBps = []*pblkiodev.ThrottleDevice{} |
117 | 117 |
} |
118 | 118 |
if len(resources.BlkioDeviceWriteBps) > 0 { |
119 |
- warnings = append(warnings, "Windows does not support Block write limit in bytes per second.") |
|
120 |
- logrus.Warn("Windows does not support Block I/O write limit in bytes per second. --device-write-bps discarded.") |
|
119 |
+ warnings = append(warnings, "Windows does not support Block write limit in bytes per second. Device write bps discarded.") |
|
120 |
+ logrus.Warn("Windows does not support Block I/O write limit in bytes per second. Device write bps discarded.") |
|
121 | 121 |
resources.BlkioDeviceWriteBps = []*pblkiodev.ThrottleDevice{} |
122 | 122 |
} |
123 | 123 |
if len(resources.BlkioDeviceReadIOps) > 0 { |
124 |
- warnings = append(warnings, "Windows does not support Block read limit in IO per second.") |
|
125 |
- logrus.Warn("Windows does not support Block I/O read limit in IO per second. -device-read-iops discarded.") |
|
124 |
+ warnings = append(warnings, "Windows does not support Block read limit in IO per second. Device read iops discarded.") |
|
125 |
+ logrus.Warn("Windows does not support Block I/O read limit in IO per second. Device read iops discarded.") |
|
126 | 126 |
resources.BlkioDeviceReadIOps = []*pblkiodev.ThrottleDevice{} |
127 | 127 |
} |
128 | 128 |
if len(resources.BlkioDeviceWriteIOps) > 0 { |
129 |
- warnings = append(warnings, "Windows does not support Block write limit in IO per second.") |
|
130 |
- logrus.Warn("Windows does not support Block I/O write limit in IO per second. --device-write-iops discarded.") |
|
129 |
+ warnings = append(warnings, "Windows does not support Block write limit in IO per second. Device write iops discarded.") |
|
130 |
+ logrus.Warn("Windows does not support Block I/O write limit in IO per second. Device write iops discarded.") |
|
131 | 131 |
resources.BlkioDeviceWriteIOps = []*pblkiodev.ThrottleDevice{} |
132 | 132 |
} |
133 | 133 |
return warnings, nil |
... | ... |
@@ -1267,7 +1267,7 @@ func (s *DockerSuite) TestPostContainersCreateShmSizeNegative(c *check.C) { |
1267 | 1267 |
status, body, err := sockRequest("POST", "/containers/create", config) |
1268 | 1268 |
c.Assert(err, check.IsNil) |
1269 | 1269 |
c.Assert(status, check.Equals, http.StatusInternalServerError) |
1270 |
- c.Assert(getErrorMessage(c, body), checker.Contains, "SHM size must be greater than 0") |
|
1270 |
+ c.Assert(getErrorMessage(c, body), checker.Contains, "SHM size can not be less than 0") |
|
1271 | 1271 |
} |
1272 | 1272 |
|
1273 | 1273 |
func (s *DockerSuite) TestPostContainersCreateShmSizeHostConfigOmitted(c *check.C) { |
... | ... |
@@ -687,7 +687,7 @@ func (s *DockerSuite) TestRunWithMemoryReservationInvalid(c *check.C) { |
687 | 687 |
testRequires(c, memoryReservationSupport) |
688 | 688 |
out, _, err := dockerCmdWithError("run", "-m", "500M", "--memory-reservation", "800M", "busybox", "true") |
689 | 689 |
c.Assert(err, check.NotNil) |
690 |
- expected := "Minimum memory limit should be larger than memory reservation limit" |
|
690 |
+ expected := "Minimum memory limit can not be less than memory reservation limit" |
|
691 | 691 |
c.Assert(strings.TrimSpace(out), checker.Contains, expected, check.Commentf("run container should fail with invalid memory reservation")) |
692 | 692 |
|
693 | 693 |
out, _, err = dockerCmdWithError("run", "--memory-reservation", "1k", "busybox", "true") |