Skip to content

Commit

Permalink
fix pfNames selector to skip device with no PF name
Browse files Browse the repository at this point in the history
Current behaviour of pfName selector adds devices that do not have
PF names available. For instance, if there is a PF attached to
igb_uio driver and VFs are created under that PF, those VFs will
have no PF name information. If a resource config prvides the
"pfName" selector any VFs under that PF(igb_uio driver) will
wrongly be added to that pool. This happens because this selector
matchrd PF name with string.HasPrefix() method and providing ""
for PF name results in true.

Fix: skip devices that do not have PF names when "pfNames" selector
is used.

Change-Id: I1ddd49743ef2e8f25718285e80c16dfcef4c90f5
Signed-off-by: Abdul Halim <abdul.halim@intel.com>
  • Loading branch information
ahalimx86 committed May 25, 2020
1 parent 4c3e645 commit a6ba00e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/resources/deviceSelectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ func (s *pfNameSelector) Filter(inDevices []types.PciDevice) []types.PciDevice {
filteredList := make([]types.PciDevice, 0)
for _, dev := range inDevices {
pfName := dev.(types.PciNetDevice).GetPFName()
if pfName == "" {
// Exclude devices that doesn't have a PF name
continue
}
selector := getItem(s.pfNames, pfName)
if selector != "" {
if strings.Contains(selector, "#") {
Expand Down

0 comments on commit a6ba00e

Please sign in to comment.