67 lines
2.6 KiB
Diff
67 lines
2.6 KiB
Diff
From 347c81278ba63b6fe05476ad4dd9dd960b4b70a4 Mon Sep 17 00:00:00 2001
|
|
From: vegbir <yangjiaqi16@huawei.com>
|
|
Date: Tue, 20 Aug 2024 13:26:04 +0000
|
|
Subject: [PATCH 02/13] rubik-fix-weight-for-iocost-does-not-take-effect
|
|
|
|
---
|
|
pkg/services/iocost/iocost.go | 7 +------
|
|
pkg/services/iocost/iocost_origin.go | 8 ++++----
|
|
pkg/services/iocost/iocost_test.go | 2 +-
|
|
3 files changed, 6 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/pkg/services/iocost/iocost.go b/pkg/services/iocost/iocost.go
|
|
index c11ef60..0f77edc 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.Online() {
|
|
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 d37109f..5e9948f 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 95b6d97..3bdadad 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
|
|
--
|
|
2.41.0
|
|
|