Skip to content

Commit

Permalink
Merge pull request #58 from zshi-redhat/vfi-pci-link-type
Browse files Browse the repository at this point in the history
Skip adding linkType selector for vfio-pci devices
  • Loading branch information
moshe010 authored Feb 10, 2021
2 parents 9176d19 + bfde7c6 commit d78c86e
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions controllers/sriovnetworknodepolicy_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,16 @@ func (r *SriovNetworkNodePolicyReconciler) renderDevicePluginConfigData(pl *srio
if len(p.Spec.NicSelector.PfNames) > 0 {
netDeviceSelectors.PfNames = sriovnetworkv1.UniqueAppend(netDeviceSelectors.PfNames, p.Spec.NicSelector.PfNames...)
}
if p.Spec.LinkType != "" {
linkType := linkTypeEthernet
if strings.ToLower(p.Spec.LinkType) == "ib" {
linkType = linkTypeInfiniband
}

if !sriovnetworkv1.StringInArray(linkType, netDeviceSelectors.LinkTypes) {
netDeviceSelectors.LinkTypes = sriovnetworkv1.UniqueAppend(netDeviceSelectors.LinkTypes, linkType)
// vfio-pci device link type is not detectable
if p.Spec.DeviceType != "vfio-pci" {
if p.Spec.LinkType != "" {
linkType := linkTypeEthernet
if strings.ToLower(p.Spec.LinkType) == "ib" {
linkType = linkTypeInfiniband
}
if !sriovnetworkv1.StringInArray(linkType, netDeviceSelectors.LinkTypes) {
netDeviceSelectors.LinkTypes = sriovnetworkv1.UniqueAppend(netDeviceSelectors.LinkTypes, linkType)
}
}
}
if len(p.Spec.NicSelector.RootDevices) > 0 {
Expand Down Expand Up @@ -622,12 +624,15 @@ func (r *SriovNetworkNodePolicyReconciler) renderDevicePluginConfigData(pl *srio
if len(p.Spec.NicSelector.PfNames) > 0 {
netDeviceSelectors.PfNames = append(netDeviceSelectors.PfNames, p.Spec.NicSelector.PfNames...)
}
if p.Spec.LinkType != "" {
linkType := linkTypeEthernet
if strings.ToLower(p.Spec.LinkType) == "ib" {
linkType = linkTypeInfiniband
// vfio-pci device link type is not detectable
if p.Spec.DeviceType != "vfio-pci" {
if p.Spec.LinkType != "" {
linkType := linkTypeEthernet
if strings.ToLower(p.Spec.LinkType) == "ib" {
linkType = linkTypeInfiniband
}
netDeviceSelectors.LinkTypes = sriovnetworkv1.UniqueAppend(netDeviceSelectors.LinkTypes, linkType)
}
netDeviceSelectors.LinkTypes = sriovnetworkv1.UniqueAppend(netDeviceSelectors.LinkTypes, linkType)
}
if len(p.Spec.NicSelector.RootDevices) > 0 {
netDeviceSelectors.RootDevices = append(netDeviceSelectors.RootDevices, p.Spec.NicSelector.RootDevices...)
Expand Down

0 comments on commit d78c86e

Please sign in to comment.