Skip to content

Commit

Permalink
Update DiscoverSriovDevices to list only pfs with networking devices
Browse files Browse the repository at this point in the history
Currently DiscoverSriovDevices creates a list of interfaces,
by scanning /sys/devices/pci.
Some of them might not have a networking devices.
The interfaces without networking devices won't be available,
but would still be reset, as they won't be part of the node policy.

Updating DiscoverSriovDevices to list only networking devices,
will support namespace isolation,
as /sys/class/net entries are network-namespaced.

Fixes: #2

Signed-off-by: Or Shoval <[email protected]>
  • Loading branch information
oshoval committed Jan 6, 2021
1 parent 75a091f commit 092394b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@ func DiscoverSriovDevices() ([]sriovnetworkv1.InterfaceExt, error) {
glog.Warningf("DiscoverSriovDevices(): unable to parse device driver for device %+v %q", device, err)
continue
}

deviceNames, err := dputils.GetNetNames(device.Address)
if err != nil {
glog.Warningf("DiscoverSriovDevices(): unable to get device names for device %+v %q", device, err)
continue
}

if len(deviceNames) == 0 {
// no network devices found, skipping device
continue
}

iface := sriovnetworkv1.InterfaceExt{
PciAddress: device.Address,
Driver: driver,
Expand Down

0 comments on commit 092394b

Please sign in to comment.