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 <runcom@linux.com>
(cherry picked from commit 472b6f66e03f9a85fe8d23098dac6f55a87456d8)
This commit is contained in:
Antonio Murdaca 2015-08-06 13:54:48 +02:00 committed by David Calavera
parent ef9b1b6b70
commit 826c468f2c

View file

@ -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)