Skip to content

Commit cf7573b

Browse files
authored
Merge pull request #896 from zeeke/us/CNF-18073
e2e: Filter devices in `FindOneMellanoxSriovDevice`
2 parents 30873f3 + 088ebd0 commit cf7573b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/util/cluster/cluster.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,24 +247,24 @@ func (n *EnabledNodes) FindOneVfioSriovDevice() (string, sriovv1.InterfaceExt) {
247247

248248
// FindOneMellanoxSriovDevice retrieves a valid sriov device for the given node.
249249
func (n *EnabledNodes) FindOneMellanoxSriovDevice(node string) (*sriovv1.InterfaceExt, error) {
250-
s, ok := n.States[node]
251-
if !ok {
252-
return nil, fmt.Errorf("node %s not found", node)
253-
}
254-
255250
// return error here as mlx interfaces are not supported when secure boot is enabled
256251
// TODO: remove this when mlx support secure boot/lockdown mode
257252
if n.IsSecureBootEnabled[node] {
258253
return nil, fmt.Errorf("secure boot is enabled on the node mellanox cards are not supported")
259254
}
260255

261-
for _, itf := range s.Status.Interfaces {
262-
if itf.Vendor == mlxVendorID && sriovv1.IsSupportedModel(itf.Vendor, itf.DeviceID) {
263-
return &itf, nil
256+
devices, err := n.FindSriovDevices(node)
257+
if err != nil {
258+
return nil, fmt.Errorf("unable to find a mellanox sriov devices in node %s: %w", node, err)
259+
}
260+
261+
for _, nic := range devices {
262+
if nic.Vendor == mlxVendorID && sriovv1.IsSupportedModel(nic.Vendor, nic.DeviceID) {
263+
return nic, nil
264264
}
265265
}
266266

267-
return nil, fmt.Errorf("unable to find a mellanox sriov devices in node %s", node)
267+
return nil, fmt.Errorf("no Mellanox devices found in node %s. Available devices [%+v]", node, devices)
268268
}
269269

270270
// SriovStable tells if all the node states are in sync (and the cluster is ready for another round of tests)

0 commit comments

Comments
 (0)