From cff73c4950c6bc0031e9896a87507029857c0737 Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Tue, 4 Jul 2023 14:33:26 +0200 Subject: [PATCH 1/2] Avoid logging `devlink` warning Devlink mode is not supported by every SR-IOV NIC model. Signed-off-by: Andrea Panattoni --- pkg/utils/utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 37888e4b1..49cf27a00 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -2,6 +2,7 @@ package utils import ( "bytes" + "errors" "fmt" "io/ioutil" "math/rand" @@ -720,10 +721,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 } From 9a500dd9c869d562848265e914298c66b1146060 Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Tue, 4 Jul 2023 14:35:00 +0200 Subject: [PATCH 2/2] Reduce vebosity of config-damon Log `getLinkType(): ...` only if LogLevel == 2 Signed-off-by: Andrea Panattoni --- pkg/utils/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 49cf27a00..0daf90a78 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -667,7 +667,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 {