From ea4504a916209aa97614cae16e1d3d55afaa4b63 Mon Sep 17 00:00:00 2001 From: mantramantra12 <72497574+mantramantra12@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:20:43 +0000 Subject: [PATCH] Prevent `nfd-worker` erroring when reading attributes from paravirtual devices (#1557) * prevent erroring on paravirtual devices * Use `errors.Is()` for error checking Co-authored-by: Markus Lehtonen * add imports --------- Co-authored-by: Markus Lehtonen --- source/network/network.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/network/network.go b/source/network/network.go index 5dc5f0203..a6cd71f1f 100644 --- a/source/network/network.go +++ b/source/network/network.go @@ -17,11 +17,13 @@ limitations under the License. package network import ( + "errors" "fmt" "os" "path/filepath" "strconv" "strings" + "syscall" "k8s.io/klog/v2" @@ -148,7 +150,7 @@ func readIfaceInfo(path string, attrFiles []string) nfdv1alpha1.InstanceFeature for _, attrFile := range attrFiles { data, err := os.ReadFile(filepath.Join(path, attrFile)) if err != nil { - if !os.IsNotExist(err) { + if !os.IsNotExist(err) && !errors.Is(err, syscall.EINVAL) { klog.ErrorS(err, "failed to read net iface attribute", "attributeName", attrFile) } continue