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)) specgen.SetProcessOOMScoreAdj(int(oomScoreAdj))
} }
if sb.CgroupParent() != "" { var cgPath string
if s.config.CgroupManager == "systemd" { scopePrefix := "crio"
cgPath := sb.CgroupParent() + ":" + "crio" + ":" + containerID parent := "/crio"
specgen.SetLinuxCgroupsPath(cgPath) useSystemd := s.config.CgroupManager == "systemd"
} else { if useSystemd {
specgen.SetLinuxCgroupsPath(sb.CgroupParent() + "/" + containerID) 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() capabilities := linux.GetSecurityContext().GetCapabilities()
toCAPPrefixed := func(cap string) string { toCAPPrefixed := func(cap string) string {