Skip to content

Commit

Permalink
Add more logs for rdma selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Mmduh-483 committed Apr 20, 2020
1 parent 8a1d53f commit 93f730d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/factory/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package factory
import (
"encoding/json"
"fmt"
"os"

"github.com/golang/glog"
"github.com/intel/sriov-network-device-plugin/pkg/accelerator"
Expand Down Expand Up @@ -114,6 +115,13 @@ func (rf *resourceFactory) GetResourcePool(rc *types.ResourceConfig, filteredDev
if len(filteredDevice) > 0 {
if _, ok := filteredDevice[0].(types.PciNetDevice); ok {
rPool = netdevice.NewNetResourcePool(rc, apiDevices, devicePool)
// check /dev/infiniband exist if rdma is required
selector, _ := rc.SelectorObj.(*types.NetDeviceSelectors)
if selector.IsRdma {
if _, err := os.Stat("/dev/infiniband"); err != nil {
glog.Warningf("%s requires rdma, but \"/dev/infiniband\" is not found", rc.ResourceName)
}
}
} else {
err = fmt.Errorf("invalid device list for NetDeviceType")
}
Expand Down Expand Up @@ -158,13 +166,17 @@ func (rf *resourceFactory) GetDeviceFilter(rc *types.ResourceConfig) (interface{
if err := json.Unmarshal(*rc.Selectors, netDeviceSelector); err != nil {
return nil, fmt.Errorf("error unmarshalling NetDevice selector bytes %v", err)
}

glog.Infof("net device selector for resource %s is %+v", rc.ResourceName, netDeviceSelector)
return netDeviceSelector, nil
case types.AcceleratorType:
accelDeviceSelector := &types.AccelDeviceSelectors{}

if err := json.Unmarshal(*rc.Selectors, accelDeviceSelector); err != nil {
return nil, fmt.Errorf("error unmarshalling Accelerator selector bytes %v", err)
}

glog.Infof("accelerator device selector for resource %s is %+v", rc.ResourceName, accelDeviceSelector)
return accelDeviceSelector, nil
default:
return nil, fmt.Errorf("unable to get deviceFilter, invalid deviceType %s", rc.DeviceType)
Expand Down

0 comments on commit 93f730d

Please sign in to comment.