Skip to content

Commit

Permalink
Merge pull request #468 from zeeke/improve-config-daemon-logging
Browse files Browse the repository at this point in the history
Reduce config-daemon logging verbosity
  • Loading branch information
adrianchiris authored Aug 8, 2023
2 parents 87d2860 + 9a500dd commit 3500926
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package utils

import (
"bytes"
"errors"
"fmt"
"io/ioutil"
"math/rand"
Expand Down Expand Up @@ -658,7 +659,7 @@ func unbindDriverIfNeeded(vfAddr string, isRdma bool) error {
}

func getLinkType(ifaceStatus sriovnetworkv1.InterfaceExt) string {
glog.Infof("getLinkType(): Device %s", ifaceStatus.PciAddress)
glog.V(2).Infof("getLinkType(): Device %s", ifaceStatus.PciAddress)
if ifaceStatus.Name != "" {
link, err := netlink.LinkByName(ifaceStatus.Name)
if err != nil {
Expand Down Expand Up @@ -712,10 +713,16 @@ func generateRandomGUID() net.HardwareAddr {

func GetNicSriovMode(pciAddress string) (string, error) {
glog.V(2).Infof("GetNicSriovMode(): device %s", pciAddress)

devLink, err := netlink.DevLinkGetDeviceByName("pci", pciAddress)
if err != nil {
if errors.Is(err, syscall.ENODEV) {
// the device doesn't support devlink
return "", nil
}
return "", err
}

return devLink.Attrs.Eswitch.Mode, nil
}

Expand Down

0 comments on commit 3500926

Please sign in to comment.