Skip to content

Commit

Permalink
add comments for pool-related functions
Browse files Browse the repository at this point in the history
  • Loading branch information
waynepeking348 committed Dec 12, 2023
1 parent 55d6a6d commit b414c26
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ func GetPoolType(poolName string) string {
}
}

// GetSpecifiedPoolName todo: this function (along with pool-name consts) should be moved to generic qos conf
func GetSpecifiedPoolName(qosLevel, cpusetEnhancementValue string) string {
switch qosLevel {
case apiconsts.PodAnnotationQoSLevelSharedCores:
Expand Down
4 changes: 3 additions & 1 deletion pkg/agent/qrm-plugins/cpu/dynamicpolicy/state/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,13 @@ func TestGenerateCPUMachineStateByPodEntries(t *testing.T) {

as.Equalf(tc.expectedMachineState, machineState, "failed in test case: %s", tc.description)

os.RemoveAll(tmpDir)
_ = os.RemoveAll(tmpDir)
}
}

func TestGetSpecifiedPoolName(t *testing.T) {
t.Parallel()

type args struct {
qosLevel string
cpusetEnhancementValue string
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/generic/qos.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,12 @@ func (c *QoSConfiguration) GetSpecifiedPoolNameForPod(pod *v1.Pod) (string, erro
// GetSpecifiedPoolName returns the specified cpuset pool name for given enhancements and annotations;
func (c *QoSConfiguration) GetSpecifiedPoolName(enhancements, annotations map[string]string) (string, error) {
qosLevel, err := c.GetQoSLevel(annotations)

if err != nil {
return "", fmt.Errorf("GetQoSLevel failed with error: %v", err)
}

enhancementKVs := helper.ParseKatalystQOSEnhancement(enhancements, annotations,
apiconsts.PodAnnotationCPUEnhancementKey)

return state.GetSpecifiedPoolName(qosLevel, enhancementKVs[apiconsts.PodAnnotationCPUEnhancementCPUSet]), nil
}

Expand Down

0 comments on commit b414c26

Please sign in to comment.