Browse code

Only show global warnings once

Upon each container create I'm seeing these warning **every** time in the
daemon output:
```
WARN[0002] Your kernel does not support swap memory limit
WARN[0002] Your kernel does not support cgroup rt period
WARN[0002] Your kernel does not support cgroup rt runtime
```
Showing them for each container.create() fills up the logs and encourages
people to ignore the output being generated - which means its less likely
they'll see real issues when they happen. In short, I don't think we
need to show these warnings more than once, so let's only show these
warnings at daemon start-up time.

Signed-off-by: Doug Davis <dug@us.ibm.com>

Doug Davis authored on 2016/11/30 00:38:07
Showing 2 changed files
... ...
@@ -1255,7 +1255,7 @@ func (daemon *Daemon) initCgroupsPath(path string) error {
1255 1255
 	}
1256 1256
 
1257 1257
 	path = filepath.Join(root, path)
1258
-	sysinfo := sysinfo.New(false)
1258
+	sysinfo := sysinfo.New(true)
1259 1259
 	if err := os.MkdirAll(path, 0755); err != nil && !os.IsExist(err) {
1260 1260
 		return err
1261 1261
 	}
... ...
@@ -82,23 +82,23 @@ func checkCgroupMem(cgMounts map[string]string, quiet bool) cgroupMemInfo {
82 82
 
83 83
 	swapLimit := cgroupEnabled(mountPoint, "memory.memsw.limit_in_bytes")
84 84
 	if !quiet && !swapLimit {
85
-		logrus.Warn("Your kernel does not support swap memory limit.")
85
+		logrus.Warn("Your kernel does not support swap memory limit")
86 86
 	}
87 87
 	memoryReservation := cgroupEnabled(mountPoint, "memory.soft_limit_in_bytes")
88 88
 	if !quiet && !memoryReservation {
89
-		logrus.Warn("Your kernel does not support memory reservation.")
89
+		logrus.Warn("Your kernel does not support memory reservation")
90 90
 	}
91 91
 	oomKillDisable := cgroupEnabled(mountPoint, "memory.oom_control")
92 92
 	if !quiet && !oomKillDisable {
93
-		logrus.Warn("Your kernel does not support oom control.")
93
+		logrus.Warn("Your kernel does not support oom control")
94 94
 	}
95 95
 	memorySwappiness := cgroupEnabled(mountPoint, "memory.swappiness")
96 96
 	if !quiet && !memorySwappiness {
97
-		logrus.Warn("Your kernel does not support memory swappiness.")
97
+		logrus.Warn("Your kernel does not support memory swappiness")
98 98
 	}
99 99
 	kernelMemory := cgroupEnabled(mountPoint, "memory.kmem.limit_in_bytes")
100 100
 	if !quiet && !kernelMemory {
101
-		logrus.Warn("Your kernel does not support kernel memory limit.")
101
+		logrus.Warn("Your kernel does not support kernel memory limit")
102 102
 	}
103 103
 
104 104
 	return cgroupMemInfo{