-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved functions for executing commands on nodes to node inspector.
The node inspector should be used to run commands on nodes. Therefore, I have moved this logic there. The reason for this is that it is clear that we are using the node inspector to executing commands, and it should be running. Furthermore, I have renamed these functions to better reflect their purposes. Signed-off-by: Ronny Baturov <[email protected]>
- Loading branch information
Showing
20 changed files
with
190 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ import ( | |
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/events" | ||
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/images" | ||
testlog "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/log" | ||
nodeInspector "github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/node_inspector" | ||
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/nodes" | ||
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/pods" | ||
"github.com/openshift/cluster-node-tuning-operator/test/e2e/performanceprofile/functests/utils/profiles" | ||
|
@@ -117,7 +118,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
It("[test_id:37862][crit:high][vendor:[email protected]][level:acceptance] Verify CPU affinity mask, CPU reservation and CPU isolation on worker node", func() { | ||
By("checking isolated CPU") | ||
cmd := []string{"cat", "/sys/devices/system/cpu/isolated"} | ||
sysIsolatedCpus, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
sysIsolatedCpus, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
if balanceIsolated { | ||
Expect(sysIsolatedCpus).To(BeEmpty()) | ||
|
@@ -127,14 +128,14 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
|
||
By("checking reserved CPU in kubelet config file") | ||
cmd = []string{"cat", "/rootfs/etc/kubernetes/kubelet.conf"} | ||
conf, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
conf, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred(), "failed to cat kubelet.conf") | ||
// kubelet.conf changed formatting, there is a space after colons atm. Let's deal with both cases with a regex | ||
Expect(conf).To(MatchRegexp(fmt.Sprintf(`"reservedSystemCPUs": ?"%s"`, reservedCPU))) | ||
|
||
By("checking CPU affinity mask for kernel scheduler") | ||
cmd = []string{"/bin/bash", "-c", "taskset -pc 1"} | ||
sched, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
sched, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred(), "failed to execute taskset") | ||
mask := strings.SplitAfter(sched, " ") | ||
maskSet, err := cpuset.Parse(mask[len(mask)-1]) | ||
|
@@ -146,7 +147,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
It("[test_id:34358] Verify rcu_nocbs kernel argument on the node", func() { | ||
By("checking that cmdline contains rcu_nocbs with right value") | ||
cmd := []string{"cat", "/proc/cmdline"} | ||
cmdline, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
cmdline, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
re := regexp.MustCompile(`rcu_nocbs=\S+`) | ||
rcuNocbsArgument := re.FindString(cmdline) | ||
|
@@ -156,12 +157,12 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
|
||
By("checking that new rcuo processes are running on non_isolated cpu") | ||
cmd = []string{"pgrep", "rcuo"} | ||
rcuoList, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
rcuoList, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
for _, rcuo := range strings.Split(rcuoList, "\n") { | ||
// check cpu affinity mask | ||
cmd = []string{"/bin/bash", "-c", fmt.Sprintf("taskset -pc %s", rcuo)} | ||
taskset, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
taskset, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
mask := strings.SplitAfter(taskset, " ") | ||
maskSet, err := cpuset.Parse(mask[len(mask)-1]) | ||
|
@@ -239,7 +240,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
"unexpected QoS Class for %s/%s: %s (looking for %s)", | ||
updatedPod.Namespace, updatedPod.Name, updatedPod.Status.QOSClass, expectedQos) | ||
|
||
output, err := nodes.ExecCommandOnNode(ctx, | ||
output, err := nodeInspector.ExecCommandOnNodeToString(ctx, | ||
[]string{"/bin/bash", "-c", "ps -o psr $(pgrep -n stress) | tail -1"}, | ||
workerRTNode, | ||
) | ||
|
@@ -314,7 +315,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
// It may takes some time for the system to reschedule active IRQs | ||
Eventually(func() bool { | ||
getActiveIrq := []string{"/bin/bash", "-c", "for n in $(find /proc/irq/ -name smp_affinity_list); do echo $(cat $n); done"} | ||
activeIrq, err := nodes.ExecCommandOnNode(context.TODO(), getActiveIrq, workerRTNode) | ||
activeIrq, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), getActiveIrq, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
Expect(activeIrq).ToNot(BeEmpty()) | ||
for _, irq := range strings.Split(activeIrq, "\n") { | ||
|
@@ -368,7 +369,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
|
||
Eventually(func() string { | ||
cmd := []string{"/bin/bash", "-c", fmt.Sprintf("find %s -name *%s*", cpusetPath, podUID)} | ||
podCgroup, err = nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
podCgroup, err = nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return podCgroup | ||
}, cluster.ComputeTestTimeout(30*time.Second, RunningOnSingleNode), 5*time.Second).ShouldNot(BeEmpty(), | ||
|
@@ -377,7 +378,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
containersCgroups := "" | ||
Eventually(func() string { | ||
cmd := []string{"/bin/bash", "-c", fmt.Sprintf("find %s -name crio-*", podCgroup)} | ||
containersCgroups, err = nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
containersCgroups, err = nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
return containersCgroups | ||
}, cluster.ComputeTestTimeout(30*time.Second, RunningOnSingleNode), 5*time.Second).ShouldNot(BeEmpty(), | ||
|
@@ -398,7 +399,7 @@ var _ = Describe("[rfe_id:27363][performance] CPU Management", Ordered, func() { | |
|
||
By("Checking what CPU the infra container is using") | ||
cmd := []string{"/bin/bash", "-c", fmt.Sprintf("cat %s/cpuset.cpus", dir)} | ||
output, err := nodes.ExecCommandOnNode(context.TODO(), cmd, workerRTNode) | ||
output, err := nodeInspector.ExecCommandOnNodeToString(context.TODO(), cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred()) | ||
|
||
cpus, err := cpuset.Parse(output) | ||
|
@@ -673,7 +674,7 @@ func checkForWorkloadPartitioning(ctx context.Context) bool { | |
"-c", | ||
"echo CHECK ; /bin/grep -rEo 'activation_annotation.*target\\.workload\\.openshift\\.io/management.*' /etc/crio/crio.conf.d/ || true", | ||
} | ||
output, err := nodes.ExecCommandOnNode(ctx, cmd, workerRTNode) | ||
output, err := nodeInspector.ExecCommandOnNodeToString(ctx, cmd, workerRTNode) | ||
Expect(err).ToNot(HaveOccurred(), "Unable to check cluster for Workload Partitioning enabled") | ||
re := regexp.MustCompile(`activation_annotation.*target\.workload\.openshift\.io/management.*`) | ||
return re.MatchString(fmt.Sprint(output)) | ||
|
@@ -694,7 +695,7 @@ func checkPodHTSiblings(ctx context.Context, testpod *corev1.Pod) bool { | |
node, err := nodes.GetByName(testpod.Spec.NodeName) | ||
Expect(err).ToNot(HaveOccurred(), "failed to get node %q", testpod.Spec.NodeName) | ||
Expect(testpod.Spec.NodeName).ToNot(BeEmpty(), "testpod %s/%s still pending - no nodeName set", testpod.Namespace, testpod.Name) | ||
output, err := nodes.ExecCommandOnNode(ctx, cmd, node) | ||
output, err := nodeInspector.ExecCommandOnNodeToString(ctx, cmd, node) | ||
Expect(err).ToNot(HaveOccurred(), "Unable to crictl inspect containerID %q", containerID) | ||
|
||
podcpus, err := cpuset.Parse(strings.Trim(output, "\n")) | ||
|
@@ -718,7 +719,7 @@ func checkPodHTSiblings(ctx context.Context, testpod *corev1.Pod) bool { | |
"-c", | ||
fmt.Sprintf("/bin/cat %s | /bin/sort -u", hostHTSiblingPaths.String()), | ||
} | ||
output, err = nodes.ExecCommandOnNode(ctx, cmd, workerRTNode) | ||
output, err = nodeInspector.ExecCommandOnNodeToString(ctx, cmd, workerRTNode) | ||
Expect(err).ToNot( | ||
HaveOccurred(), | ||
"Unable to read host thread_siblings_list files", | ||
|
@@ -899,7 +900,7 @@ func logEventsForPod(testPod *corev1.Pod) { | |
// getCPUswithLoadBalanceDisabled Return cpus which are not in any scheduling domain | ||
func getCPUswithLoadBalanceDisabled(ctx context.Context, targetNode *corev1.Node) ([]string, error) { | ||
cmd := []string{"/bin/bash", "-c", "cat /proc/schedstat"} | ||
schedstatData, err := nodes.ExecCommandOnNode(ctx, cmd, targetNode) | ||
schedstatData, err := nodeInspector.ExecCommandOnNodeToString(ctx, cmd, targetNode) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.