Skip to content

Commit cac0a0d

Browse files
authored
Merge pull request #629 from q384566678/cgroups-v1-fix
cgroups_v1: Correction parameters
2 parents ba17f13 + f7dd673 commit cac0a0d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

cgroups/cgroups_v1.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func (cg *CgroupV1) GetBlockIOData(pid int, cgPath string) (*rspec.LinuxBlockIO,
4141
if err != nil {
4242
return nil, err
4343
}
44-
if !strings.Contains(subPath, RelCgroupPath) {
44+
if !strings.Contains(subPath, cgPath) {
4545
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "blkio")
4646
}
4747
filePath = filepath.Join(cg.MountPath, "blkio", subPath, fileName)
@@ -203,7 +203,7 @@ func (cg *CgroupV1) GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error)
203203
if err != nil {
204204
return nil, err
205205
}
206-
if !strings.Contains(subPath, RelCgroupPath) {
206+
if !strings.Contains(subPath, cgPath) {
207207
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpu")
208208
}
209209
filePath = filepath.Join(cg.MountPath, "cpu", subPath, fileName)
@@ -266,7 +266,7 @@ func (cg *CgroupV1) GetCPUData(pid int, cgPath string) (*rspec.LinuxCPU, error)
266266
if err != nil {
267267
return nil, err
268268
}
269-
if !strings.Contains(subPath, RelCgroupPath) {
269+
if !strings.Contains(subPath, cgPath) {
270270
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "cpuset")
271271
}
272272
filePath = filepath.Join(cg.MountPath, "cpuset", subPath, fileName)
@@ -362,7 +362,7 @@ func (cg *CgroupV1) GetHugepageLimitData(pid int, cgPath string) ([]rspec.LinuxH
362362
if err != nil {
363363
return lh, err
364364
}
365-
if !strings.Contains(subPath, RelCgroupPath) {
365+
if !strings.Contains(subPath, cgPath) {
366366
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "hugetlb")
367367
}
368368
filePath = filepath.Join(cg.MountPath, "hugetlb", subPath, maxUsage)
@@ -396,7 +396,7 @@ func (cg *CgroupV1) GetMemoryData(pid int, cgPath string) (*rspec.LinuxMemory, e
396396
if err != nil {
397397
return nil, err
398398
}
399-
if !strings.Contains(subPath, RelCgroupPath) {
399+
if !strings.Contains(subPath, cgPath) {
400400
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "memory")
401401
}
402402
filePath = filepath.Join(cg.MountPath, "memory", subPath, fileName)
@@ -476,7 +476,7 @@ func (cg *CgroupV1) GetNetworkData(pid int, cgPath string) (*rspec.LinuxNetwork,
476476
if err != nil {
477477
return nil, err
478478
}
479-
if !strings.Contains(subPath, RelCgroupPath) {
479+
if !strings.Contains(subPath, cgPath) {
480480
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "net_cls")
481481
}
482482
filePath = filepath.Join(cg.MountPath, "net_cls", subPath, fileName)
@@ -499,7 +499,7 @@ func (cg *CgroupV1) GetNetworkData(pid int, cgPath string) (*rspec.LinuxNetwork,
499499
if err != nil {
500500
return nil, err
501501
}
502-
if !strings.Contains(subPath, RelCgroupPath) {
502+
if !strings.Contains(subPath, cgPath) {
503503
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "net_prio")
504504
}
505505
filePath = filepath.Join(cg.MountPath, "net_prio", subPath, fileName)
@@ -534,7 +534,7 @@ func (cg *CgroupV1) GetPidsData(pid int, cgPath string) (*rspec.LinuxPids, error
534534
if err != nil {
535535
return nil, err
536536
}
537-
if !strings.Contains(subPath, RelCgroupPath) {
537+
if !strings.Contains(subPath, cgPath) {
538538
return nil, fmt.Errorf("cgroup subsystem %s is not mounted as expected", "pids")
539539
}
540540
filePath = filepath.Join(cg.MountPath, "pids", subPath, fileName)

0 commit comments

Comments
 (0)