diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 628b1ee7e..966da4bc3 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -214,10 +214,13 @@ func (dn *Daemon) tryCreateUdevRuleWrapper() error { } } - // update udev rule and if update succeeds - err := tryCreateNMUdevRule() - if err != nil { - return err + // update udev rule only if we are on a BM environment + // for virtual environments we don't disable the vfs as they may be used by the platform/host + if dn.platform != utils.VirtualOpenStack { + err := tryCreateNMUdevRule() + if err != nil { + return err + } } return nil diff --git a/pkg/daemon/writer.go b/pkg/daemon/writer.go index b3ad2d393..cc40e329e 100644 --- a/pkg/daemon/writer.go +++ b/pkg/daemon/writer.go @@ -44,7 +44,7 @@ func NewNodeStateStatusWriter(c snclientset.Interface, n string, f func(), devMo // RunOnce initial the interface status for both baremetal and virtual environments func (writer *NodeStateStatusWriter) RunOnce(destDir string, platformType utils.PlatformType) error { - glog.V(0).Infof("RunOnce(): start writer") + glog.V(0).Infof("RunOnce()") msg := Message{} if platformType == utils.VirtualOpenStack { @@ -53,26 +53,22 @@ func (writer *NodeStateStatusWriter) RunOnce(destDir string, platformType utils. return err } - metaData, networkData, err := utils.GetOpenstackData() - if err != nil { - glog.Errorf("RunOnce(): failed to read OpenStack data: %v", err) - } - if ns == nil { + metaData, networkData, err := utils.GetOpenstackData() + if err != nil { + glog.Errorf("RunOnce(): failed to read OpenStack data: %v", err) + } + writer.openStackDevicesInfo, err = utils.CreateOpenstackDevicesInfo(metaData, networkData) if err != nil { return err } } else { - devicesInfo := make(utils.OSPDevicesInfo) - for _, iface := range ns.Status.Interfaces { - devicesInfo[iface.PciAddress] = &utils.OSPDeviceInfo{MacAddress: iface.Mac, NetworkID: iface.NetFilter} - } - writer.openStackDevicesInfo = devicesInfo + writer.openStackDevicesInfo = utils.CreateOpenstackDevicesInfoFromNodeStatus(ns) } } - glog.V(0).Info("RunOnce(): once") + glog.V(0).Info("RunOnce(): first poll for nic status") if err := writer.pollNicStatus(platformType); err != nil { glog.Errorf("RunOnce(): first poll failed: %v", err) } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index f0376ae50..3edd0e638 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -459,7 +459,7 @@ func getNetdevMTU(pciAddr string) int { } func getNetDevMac(ifaceName string) string { - glog.Infof("getNetDevMac(): get Mac for device %s", ifaceName) + glog.V(2).Infof("getNetDevMac(): get Mac for device %s", ifaceName) macFilePath := filepath.Join(sysClassNet, ifaceName, "address") data, err := ioutil.ReadFile(macFilePath) if err != nil { diff --git a/pkg/utils/utils_virtual.go b/pkg/utils/utils_virtual.go index 6a1eaa5bb..ecf1085f1 100644 --- a/pkg/utils/utils_virtual.go +++ b/pkg/utils/utils_virtual.go @@ -345,6 +345,15 @@ func DiscoverSriovDevicesVirtual(devicesInfo OSPDevicesInfo) ([]sriovnetworkv1.I return pfList, nil } +func CreateOpenstackDevicesInfoFromNodeStatus(networkState *sriovnetworkv1.SriovNetworkNodeState) OSPDevicesInfo { + devicesInfo := make(OSPDevicesInfo) + for _, iface := range networkState.Status.Interfaces { + devicesInfo[iface.PciAddress] = &OSPDeviceInfo{MacAddress: iface.Mac, NetworkID: iface.NetFilter} + } + + return devicesInfo +} + // tryToGetVirtualInterfaceName get the interface name of a virtio interface func tryToGetVirtualInterfaceName(pciAddr string) string { glog.Infof("tryToGetVirtualInterfaceName() get interface name for device %s", pciAddr)