Skip to content

Commit

Permalink
cnf-tests: Improve NUMA cpuset retrieval
Browse files Browse the repository at this point in the history
Guaranteed workload pod can be in a different cgroup
if on the node there have been applied a PerformanceProfile.

The Cluster Node Tuning Operator configures the cpuset
cgroup on specific condition and it doesn't come back to
the original configuration when the node is moved to a differenent
MachineConfigPool.

Refs:
https://github.com/openshift/cluster-node-tuning-operator/blob/a4c70abb71036341dfaf0cac30dab0d166e55cbd/assets/performanceprofile/scripts/cpuset-configure.sh#L9
Signed-off-by: Andrea Panattoni <[email protected]>
  • Loading branch information
zeeke committed Aug 24, 2023
1 parent 8859899 commit af2a47c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cnf-tests/testsuites/e2esuite/dpdk/dpdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ func findNUMAForCPUs(pod *corev1.Pod, cpuList []string) (int, error) {
}

if !findCPUOnSameNuma {
return numaNode, fmt.Errorf("not all the cpus are in the same numa node")
return numaNode, fmt.Errorf("not all the cpus are in the same numa node. cpuList[%v] lscpu[%s]", cpuList, buff.String())
}

return numaNode, nil
Expand Down
8 changes: 6 additions & 2 deletions cnf-tests/testsuites/e2esuite/dpdk/numa_node_sriov.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,12 @@ func findDevicesOnNUMANode(node *corev1.Node, devices []*sriovv1.InterfaceExt, n
}

func expectPodCPUsAreOnNUMANode(pod *corev1.Pod, expectedCPUsNUMA int) {

buff, err := pods.ExecCommand(client.Client, *pod, []string{"cat", "/sys/fs/cgroup/cpuset.cpus"})
// Guaranteed workload pod can be in a different cgroup
// if on the node there have ever been applied a PerformanceProfile, no matter if it's not active at the moment.
//
// https://github.com/openshift/cluster-node-tuning-operator/blob/a4c70abb71036341dfaf0cac30dab0d166e55cbd/assets/performanceprofile/scripts/cpuset-configure.sh#L9
buff, err := pods.ExecCommand(client.Client, *pod, []string{"sh", "-c",
"cat /sys/fs/cgroup/cpuset/cpuset.cpus 2>/dev/null || cat /sys/fs/cgroup/cpuset.cpus 2>/dev/null"})
ExpectWithOffset(1, err).ToNot(HaveOccurred())

cpuList, err := getCpuSet(buff.String())
Expand Down

0 comments on commit af2a47c

Please sign in to comment.