Skip to content

Commit 16fa177

Browse files
committed
fix container id conflict resolution (cgroup v2)
1 parent 2a6e771 commit 16fa177

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cgroup/cgroup.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ type Cgroup struct {
7373
}
7474

7575
func (cg *Cgroup) CreatedAt() time.Time {
76-
fi, err := os.Stat(path.Join(cgRoot, "cpu", cg.subsystems["cpu"]))
76+
p := path.Join(cgRoot, cg.subsystems[""]) //v2
77+
if cg.Version == V1 {
78+
p = path.Join(cgRoot, "cpu", cg.subsystems["cpu"])
79+
}
80+
fi, err := os.Stat(p)
7781
if err != nil {
7882
if !common.IsNotExist(err) {
7983
klog.Errorln(err)

0 commit comments

Comments
 (0)