From 826c468f2c8b3ce93c69f60f41f81f96bdb66ab0 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Thu, 6 Aug 2015 13:54:48 +0200 Subject: [PATCH] Move sysinfo out of daemon struct sysinfo struct was initialized at daemon startup to make sure kernel configs such as device cgroup are present and error out if not. The struct was embedded in daemon struct making impossible to detect if some system config is changed at daemon runtime (i.e. someone umount the memory cgroup). This leads to container's starts failure if some config is changed at daemon runtime. This patch moves sysinfo out of daemon and initilize and check it when needed (daemon startup, containers creation, contaienrs startup for now). Signed-off-by: Antonio Murdaca (cherry picked from commit 472b6f66e03f9a85fe8d23098dac6f55a87456d8) --- sysinfo/sysinfo_linux.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sysinfo/sysinfo_linux.go b/sysinfo/sysinfo_linux.go index 2994d67..e2f6970 100644 --- a/sysinfo/sysinfo_linux.go +++ b/sysinfo/sysinfo_linux.go @@ -10,7 +10,9 @@ import ( "github.com/opencontainers/runc/libcontainer/cgroups" ) -// New returns a new SysInfo, using the filesystem to detect which features the kernel supports. +// New returns a new SysInfo, using the filesystem to detect which features +// the kernel supports. If `quiet` is `false` warnings are printed in logs +// whenever an error occurs or misconfigurations are present. func New(quiet bool) *SysInfo { sysInfo := &SysInfo{} sysInfo.cgroupMemInfo = checkCgroupMem(quiet)