mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 07:14:22 +01:00
cgroups: Add systemd detection when creating cgroup manager
Look at the provided cgroup path to determine whether systemd is being used to manage the cgroups. With this, systemd cgroups are being detected and created appropriately for the sandbox. Fixes: #599 Signed-off-by: Eric Ernsteernst <eric@amperecomputing.com> (forward port of https://github.com/kata-containers/runtime/pull/2817) Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
This commit is contained in:
committed by
Francesco Giudici
parent
f659871f55
commit
d7cb3df0d2
@@ -22,8 +22,8 @@ func TestIsSystemdCgroup(t *testing.T) {
|
||||
path string
|
||||
expected bool
|
||||
}{
|
||||
{"slice:kata:afhts2e5d4g5s", true},
|
||||
{"slice.system:kata:afhts2e5d4g5s", true},
|
||||
{"foo.slice:kata:afhts2e5d4g5s", true},
|
||||
{"system.slice:kata:afhts2e5d4g5s", true},
|
||||
{"/kata/afhts2e5d4g5s", false},
|
||||
{"a:b:c:d", false},
|
||||
{":::", false},
|
||||
@@ -78,9 +78,9 @@ func TestValidCgroupPath(t *testing.T) {
|
||||
{":a:b", true, true},
|
||||
{"@:@:@", true, true},
|
||||
|
||||
// valid system paths
|
||||
{"slice:kata:55555", true, false},
|
||||
{"slice.system:kata:afhts2e5d4g5s", true, false},
|
||||
// valid systemd paths
|
||||
{"x.slice:kata:55555", true, false},
|
||||
{"system.slice:kata:afhts2e5d4g5s", true, false},
|
||||
} {
|
||||
path, err := ValidCgroupPath(t.path, t.systemdCgroup)
|
||||
if t.error {
|
||||
|
||||
Reference in New Issue
Block a user