1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2024-12-14 11:57:51 +00:00

source/network: silence annoying/useless log message

However, log an error if something unexpected happens, i.e. the file to
read maximum number of vfs exists (sriov_totalvfs) but read fails.
This commit is contained in:
Markus Lehtonen 2021-09-10 16:18:33 +03:00
parent dc7bda0023
commit bd5ee9c616

View file

@ -20,6 +20,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
"os"
"strconv"
"strings"
@ -76,7 +77,9 @@ func (s Source) Discover() (source.Features, error) {
if flags&flagUp != 0 && flags&flagLoopback == 0 {
totalBytes, err := ioutil.ReadFile(source.SysfsDir.Path(sysfsBaseDir, name, "device/sriov_totalvfs"))
if err != nil {
klog.V(1).Infof("SR-IOV not supported for network interface: %s: %v", name, err)
if !os.IsNotExist(err) {
klog.Errorf("failed to determine SR-IOV support for network interface: %s: %v", name, err)
}
continue
}
total := bytes.TrimSpace(totalBytes)