diff --git a/pkg/services/iocost/iocost.go b/pkg/services/iocost/iocost.go index e5298b1265f0df84c2ec0300d6af7a46c1933053..34f508ae51398747ae17472e4a51cf5c5bd1953a 100644 --- a/pkg/services/iocost/iocost.go +++ b/pkg/services/iocost/iocost.go @@ -239,10 +239,5 @@ func (b *IOCost) configPodIOCostWeight(podInfo *typedef.PodInfo) error { if podInfo.Annotations[constant.PriorityAnnotationKey] == "false" { weight = onlineWeight } - for _, container := range podInfo.IDContainersMap { - if err := ConfigContainerIOCostWeight(container.Path, weight); err != nil { - return err - } - } - return nil + return ConfigPodIOCostWeight(podInfo.Path, weight) } diff --git a/pkg/services/iocost/iocost_origin.go b/pkg/services/iocost/iocost_origin.go index d37109f58bbfefe514c425f124b89e56c517f9ce..5e9948f7832ee80b461555029531518d0f9aea1f 100644 --- a/pkg/services/iocost/iocost_origin.go +++ b/pkg/services/iocost/iocost_origin.go @@ -63,14 +63,14 @@ func ConfigIOCostModel(devno string, p interface{}) error { return cgroup.WriteCgroupFile(paramStr, blkcgRootDir, iocostModelFile) } -// ConfigContainerIOCostWeight for config iocost weight +// ConfigPodIOCostWeight for config iocost weight // cgroup v1 iocost cannot be inherited. Therefore, only the container level can be configured. -func ConfigContainerIOCostWeight(containerRelativePath string, weight uint64) error { +func ConfigPodIOCostWeight(relativePath string, weight uint64) error { if err := cgroup.WriteCgroupFile(strconv.FormatUint(weight, scale), blkcgRootDir, - containerRelativePath, iocostWeightFile); err != nil { + relativePath, iocostWeightFile); err != nil { return err } - if err := bindMemcgBlkcg(containerRelativePath); err != nil { + if err := bindMemcgBlkcg(relativePath); err != nil { return err } return nil diff --git a/pkg/services/iocost/iocost_test.go b/pkg/services/iocost/iocost_test.go index 95b6d97632ea410e4501cb420d0687be17585154..3bdadad89d21c49745feaf6767d9a1dea5c9458c 100644 --- a/pkg/services/iocost/iocost_test.go +++ b/pkg/services/iocost/iocost_test.go @@ -334,7 +334,7 @@ func TestSetPodWeight(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - err := ConfigContainerIOCostWeight(tt.cgroupPath, uint64(tt.weight)) + err := ConfigPodIOCostWeight(tt.cgroupPath, uint64(tt.weight)) if tt.wantErr { assert.Contains(t, err.Error(), tt.errMsg) return