Skip to content

Commit

Permalink
debug DNM
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Panattoni <[email protected]>
  • Loading branch information
zeeke committed Aug 14, 2024
1 parent 9c0f0ff commit b946c7e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions test/conformance/tests/test_sriov_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1701,22 +1701,31 @@ func findMainSriovDevice(executorPod *corev1.Pod, sriovDevices []*sriovv1.Interf
Expect(err).ToNot(HaveOccurred())
routes := strings.Split(stdout, "\n")

fmt.Printf("Debug: routes %+v\n", routes)

for _, device := range sriovDevices {
fmt.Printf("Debug: device %+v\n", device)

if isDefaultRouteInterface(device.Name, routes) {
fmt.Println("Chosen ", device.Name, " as it is the default gw")
return device
}
stdout, _, err = pod.ExecCommand(clients, executorPod, "ip", "link", "show", device.Name)
Expect(err).ToNot(HaveOccurred())
Expect(len(stdout)).Should(Not(Equal(0)), "Unable to query link state")

fmt.Printf("Debug: device %+v: %s\n", device.Name, stdout)

if strings.Contains(stdout, "state DOWN") {
fmt.Printf("Debug: DOWN %+v\n", device.Name)
continue // The interface is not active
}
if strings.Contains(stdout, "master ovs-system") {
fmt.Println("Chosen ", device.Name, " as it is used by ovs")
return device
}
}

return nil
}

Expand Down
3 changes: 2 additions & 1 deletion test/conformance/tests/test_switchdev.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package tests

import (
"context"
"fmt"
"time"

Check failure on line 7 in test/conformance/tests/test_switchdev.go

View workflow job for this annotation

GitHub Actions / Golangci-lint

File is not `goimports`-ed with -local github.com/k8snetworkplumbingwg/sriov-network-operator (goimports)
sriovv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
Expand Down Expand Up @@ -40,7 +41,7 @@ var _ = Describe("[sriov] Switchdev", Ordered, func() {
testNode, interfaces, err := sriovInfos.FindSriovDevicesAndNode()
Expect(err).ToNot(HaveOccurred())

By("Testing on node " + testNode)
By(fmt.Sprintf("Testing on node %s, %d devices found", testNode, len(interfaces)))

mainDevice := findMainSriovDevice(getConfigDaemonPod(testNode), interfaces)
Expect(mainDevice).ToNot(BeNil())
Expand Down

0 comments on commit b946c7e

Please sign in to comment.