mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Merge pull request #52990 from intelsdi-x/cm_htupdate
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Improve HT detection **What this PR does / why we need it**: Fix Cpu Manager e2e node tests that fail due to hard-coded `Thread(s) per core` char position. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #52988
This commit is contained in:
commit
49810fad04
@ -19,6 +19,8 @@ package e2e_node
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
"k8s.io/api/core/v1"
|
||||||
@ -115,11 +117,13 @@ func waitForContainerRemoval(ctnPartName string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isHTEnabled() bool {
|
func isHTEnabled() bool {
|
||||||
err := exec.Command("/bin/sh", "-c", "if [[ $(lscpu | grep \"Thread(s) per core:\" | cut -c24) != \"2\" ]]; then exit 1; fi").Run()
|
outData, err := exec.Command("/bin/sh", "-c", "lscpu | grep \"Thread(s) per core:\" | cut -d \":\" -f 2").Output()
|
||||||
if err != nil {
|
framework.ExpectNoError(err)
|
||||||
return false
|
|
||||||
}
|
threadsPerCore, err := strconv.Atoi(strings.TrimSpace(string(outData)))
|
||||||
return true
|
framework.ExpectNoError(err)
|
||||||
|
|
||||||
|
return threadsPerCore > 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCPUSiblingList(cpuRes int64) string {
|
func getCPUSiblingList(cpuRes int64) string {
|
||||||
|
Loading…
Reference in New Issue
Block a user