From c7c1edb662100f01f0f90fd54bc7c91dba1fd96f Mon Sep 17 00:00:00 2001 From: Andrea Panattoni Date: Tue, 25 Jun 2024 18:39:30 +0200 Subject: [PATCH] Fix `undefined: pciAddr` Merge issue coming from - https://github.com/k8snetworkplumbingwg/sriov-network-operator/pull/690 - https://github.com/k8snetworkplumbingwg/sriov-network-operator/pull/587 Signed-off-by: Andrea Panattoni --- pkg/host/internal/sriov/sriov.go | 2 +- pkg/host/internal/sriov/sriov_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/host/internal/sriov/sriov.go b/pkg/host/internal/sriov/sriov.go index b594e7f7c..1b8d99091 100644 --- a/pkg/host/internal/sriov/sriov.go +++ b/pkg/host/internal/sriov/sriov.go @@ -151,7 +151,7 @@ func (s *sriov) getVfInfo(vfAddr string, pfName string, eswitchMode string, devi vf.Mac = link.Attrs().HardwareAddr.String() } } - vf.GUID = s.networkHelper.GetNetDevNodeGUID(pciAddr) + vf.GUID = s.networkHelper.GetNetDevNodeGUID(vfAddr) for _, device := range devices { if vfAddr == device.Address { diff --git a/pkg/host/internal/sriov/sriov_test.go b/pkg/host/internal/sriov/sriov_test.go index d4c61b9e6..8c4e8ef6f 100644 --- a/pkg/host/internal/sriov/sriov_test.go +++ b/pkg/host/internal/sriov/sriov_test.go @@ -91,6 +91,8 @@ var _ = Describe("SRIOV", func() { EncapType: "ether", }).MinTimes(1) hostMock.EXPECT().GetNetDevLinkSpeed("enp216s0f0np0").Return("100000 Mb/s") + hostMock.EXPECT().GetNetDevLinkAdminState("enp216s0f0np0").Return("up") + hostMock.EXPECT().GetNetDevNodeGUID("0000:d8:00.2").Return("guid1") storeManagerMode.EXPECT().LoadPfsStatus("0000:d8:00.0").Return(nil, false, nil) dputilsLibMock.EXPECT().IsSriovPF("0000:d8:00.0").Return(true) @@ -130,6 +132,7 @@ var _ = Describe("SRIOV", func() { NumVfs: 1, LinkSpeed: "100000 Mb/s", LinkType: "ETH", + LinkAdminState: "up", EswitchMode: "switchdev", ExternallyManaged: false, TotalVfs: 1, @@ -143,6 +146,7 @@ var _ = Describe("SRIOV", func() { Mtu: 1500, VfID: 0, RepresentorName: "enp216s0f0np0_0", + GUID: "guid1", }}, })) })