server: container_create: fix cgroupfs scopes naming

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2017-08-29 17:52:05 +02:00
parent 662e80492c
commit dd2b4a8907
No known key found for this signature in database
GPG key ID: B2BEAD150DE936B9

View file

@ -471,14 +471,22 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
specgen.SetProcessOOMScoreAdj(int(oomScoreAdj))
}
if sb.CgroupParent() != "" {
if s.config.CgroupManager == "systemd" {
cgPath := sb.CgroupParent() + ":" + "crio" + ":" + containerID
specgen.SetLinuxCgroupsPath(cgPath)
} else {
specgen.SetLinuxCgroupsPath(sb.CgroupParent() + "/" + containerID)
}
var cgPath string
scopePrefix := "crio"
parent := "/crio"
useSystemd := s.config.CgroupManager == "systemd"
if useSystemd {
parent = "system.slice"
}
if sb.CgroupParent() != "" {
parent = sb.CgroupParent()
}
if useSystemd {
cgPath = parent + ":" + scopePrefix + ":" + containerID
} else {
cgPath = filepath.Join(parent, scopePrefix+"-"+containerID)
}
specgen.SetLinuxCgroupsPath(cgPath)
capabilities := linux.GetSecurityContext().GetCapabilities()
toCAPPrefixed := func(cap string) string {