Skip to content

Commit 595bea0

Browse files
Merge pull request #1722 from ravisantoshgudimetla/fix-systemd-path
fix systemd slice expansion so that it could be consumed by cAdvisor
2 parents 6988afe + 7019e1d commit 595bea0

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
@@ -395,7 +395,7 @@ func joinCgroups(c *configs.Cgroup, pid int) error {
395395

396396
// systemd represents slice hierarchy using `-`, so we need to follow suit when
397397
// generating the path of slice. Essentially, test-a-b.slice becomes
398-
// test.slice/test-a.slice/test-a-b.slice.
398+
// /test.slice/test-a.slice/test-a-b.slice.
399399
func ExpandSlice(slice string) (string, error) {
400400
suffix := ".slice"
401401
// Name has to end with ".slice", but can't be just ".slice".
@@ -421,10 +421,9 @@ func ExpandSlice(slice string) (string, error) {
421421
}
422422

423423
// Append the component to the path and to the prefix.
424-
path += prefix + component + suffix + "/"
424+
path += "/" + prefix + component + suffix
425425
prefix += component + "-"
426426
}
427-
428427
return path, nil
429428
}
430429

0 commit comments

Comments
 (0)