Skip to content

Commit 7019e1d

Browse files
fix systemd slice expansion so that it could be consumed by cAdvisor
Signed-off-by: ravisantoshgudimetla <[email protected]>
1 parent d223e2a commit 7019e1d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

libcontainer/cgroups/systemd/apply_systemd.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ func joinCgroups(c *configs.Cgroup, pid int) error {
390390

391391
// systemd represents slice hierarchy using `-`, so we need to follow suit when
392392
// generating the path of slice. Essentially, test-a-b.slice becomes
393-
// test.slice/test-a.slice/test-a-b.slice.
393+
// /test.slice/test-a.slice/test-a-b.slice.
394394
func ExpandSlice(slice string) (string, error) {
395395
suffix := ".slice"
396396
// Name has to end with ".slice", but can't be just ".slice".
@@ -416,10 +416,9 @@ func ExpandSlice(slice string) (string, error) {
416416
}
417417

418418
// Append the component to the path and to the prefix.
419-
path += prefix + component + suffix + "/"
419+
path += "/" + prefix + component + suffix
420420
prefix += component + "-"
421421
}
422-
423422
return path, nil
424423
}
425424

0 commit comments

Comments
 (0)