diff --git a/pkg/accelerator/accelDevice_test.go b/pkg/accelerator/accelDevice_test.go index f8ae5922b..2a8613757 100644 --- a/pkg/accelerator/accelDevice_test.go +++ b/pkg/accelerator/accelDevice_test.go @@ -56,7 +56,6 @@ var _ = Describe("Accelerator", func() { Expect(out.GetEnvVal()).To(Equal("0000:00:00.1")) Expect(out.GetDeviceSpecs()).To(HaveLen(2)) // /dev/vfio/vfio0 and default /dev/vfio/vfio Expect(out.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) - Expect(out.GetNumaInfo()).To(Equal("0")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to negative numa_node", func() { @@ -82,7 +81,6 @@ var _ = Describe("Accelerator", func() { out, err := accelerator.NewAccelDevice(in, f, config) Expect(out.GetAPIDevice().Topology).To(BeNil()) - Expect(out.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to missing numa_node", func() { @@ -107,7 +105,6 @@ var _ = Describe("Accelerator", func() { out, err := accelerator.NewAccelDevice(in, f, config) Expect(out.GetAPIDevice().Topology).To(BeNil()) - Expect(out.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to config excluding topology being set", func() { @@ -133,7 +130,6 @@ var _ = Describe("Accelerator", func() { out, err := accelerator.NewAccelDevice(in, f, config) Expect(out.GetAPIDevice().Topology).To(BeNil()) - Expect(out.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) }) diff --git a/pkg/netdevice/pciNetDevice_test.go b/pkg/netdevice/pciNetDevice_test.go index 2c28f9ef8..41c84dce5 100644 --- a/pkg/netdevice/pciNetDevice_test.go +++ b/pkg/netdevice/pciNetDevice_test.go @@ -69,7 +69,6 @@ var _ = Describe("PciNetDevice", func() { Expect(dev.GetRdmaSpec().GetRdmaDeviceSpec()).To(HaveLen(0)) Expect(dev.GetLinkType()).To(Equal("fakeLinkType")) Expect(dev.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) - Expect(dev.GetNumaInfo()).To(Equal("0")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to negative numa_node", func() { @@ -95,7 +94,6 @@ var _ = Describe("PciNetDevice", func() { dev, err := netdevice.NewPciNetDevice(in, f, rc) Expect(dev.GetAPIDevice().Topology).To(BeNil()) - Expect(dev.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to missing numa_node", func() { @@ -120,7 +118,6 @@ var _ = Describe("PciNetDevice", func() { dev, err := netdevice.NewPciNetDevice(in, f, rc) Expect(dev.GetAPIDevice().Topology).To(BeNil()) - Expect(dev.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) It("should not populate topology due to config option being set", func() { @@ -146,7 +143,6 @@ var _ = Describe("PciNetDevice", func() { dev, err := netdevice.NewPciNetDevice(in, f, rc) Expect(dev.GetAPIDevice().Topology).To(BeNil()) - Expect(dev.GetNumaInfo()).To(Equal("")) Expect(err).NotTo(HaveOccurred()) }) }) @@ -218,7 +214,6 @@ var _ = Describe("PciNetDevice", func() { Expect(dev.GetDeviceSpecs()).To(HaveLen(2)) // 2x Rdma devs Expect(dev.GetMounts()).To(HaveLen(0)) Expect(dev.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) - Expect(dev.GetNumaInfo()).To(Equal("0")) Expect(err).NotTo(HaveOccurred()) mockInfo1.AssertExpectations(t) }) @@ -234,7 +229,6 @@ var _ = Describe("PciNetDevice", func() { Expect(dev.GetMounts()).To(HaveLen(0)) Expect(dev.GetLinkType()).To(Equal("fakeLinkType")) Expect(dev.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) - Expect(dev.GetNumaInfo()).To(Equal("0")) Expect(err).NotTo(HaveOccurred()) mockInfo2.AssertExpectations(t) }) @@ -278,7 +272,6 @@ var _ = Describe("PciNetDevice", func() { Expect(dev.GetRdmaSpec().GetRdmaDeviceSpec()).To(HaveLen(0)) Expect(dev.GetLinkType()).To(Equal("")) Expect(dev.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) - Expect(dev.GetNumaInfo()).To(Equal("0")) Expect(err).NotTo(HaveOccurred()) }) }) @@ -409,7 +402,6 @@ var _ = Describe("PciNetDevice", func() { }})) Expect(dev1.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) Expect(dev1.GetVdpaDevice()).To(Equal(fakeVdpaVhost)) - Expect(dev1.GetNumaInfo()).To(Equal("0")) Expect(err1).NotTo(HaveOccurred()) Expect(dev2.GetDriver()).To(Equal("ifcvf")) @@ -417,7 +409,6 @@ var _ = Describe("PciNetDevice", func() { Expect(dev2.GetDeviceSpecs()).To(HaveLen(0)) Expect(dev2.GetAPIDevice().Topology.Nodes[0].ID).To(Equal(int64(0))) Expect(dev2.GetVdpaDevice()).To(Equal(fakeVdpaVirtio)) - Expect(dev2.GetNumaInfo()).To(Equal("0")) Expect(err2).NotTo(HaveOccurred()) }) It("should generate empty deviceSpecs if ResourceConfig type does not match vdpa driver", func() { @@ -429,11 +420,9 @@ var _ = Describe("PciNetDevice", func() { Expect(dev1.GetEnvVal()).To(Equal("0000:00:00.1")) Expect(dev1.GetDeviceSpecs()).To(HaveLen(0)) - Expect(dev1.GetNumaInfo()).To(Equal("0")) Expect(err1).NotTo(HaveOccurred()) Expect(dev2.GetEnvVal()).To(Equal("0000:00:00.2")) Expect(dev2.GetDeviceSpecs()).To(HaveLen(0)) - Expect(dev2.GetNumaInfo()).To(Equal("0")) Expect(err2).NotTo(HaveOccurred()) }) }) diff --git a/pkg/resources/pciDevice.go b/pkg/resources/pciDevice.go index 4f990804c..0fbc5e375 100644 --- a/pkg/resources/pciDevice.go +++ b/pkg/resources/pciDevice.go @@ -15,8 +15,6 @@ package resources import ( - "strconv" - "github.com/k8snetworkplumbingwg/sriov-network-device-plugin/pkg/types" "github.com/k8snetworkplumbingwg/sriov-network-device-plugin/pkg/utils" @@ -29,20 +27,10 @@ type pciDevice struct { pfAddr string driver string vfID int - numa string apiDevice *pluginapi.Device infoProviders []types.DeviceInfoProvider } -// Convert NUMA node number to string. -// A node of -1 represents "unknown" and is converted to the empty string. -func nodeToStr(nodeNum int) string { - if nodeNum >= 0 { - return strconv.Itoa(nodeNum) - } - return "" -} - // NewPciDevice returns an instance of PciDevice interface // A list of DeviceInfoProviders can be set externally. // If empty, the default driver-based selection provided by ResourceFactory will be used @@ -97,7 +85,6 @@ func NewPciDevice(dev *ghw.PCIDevice, rFactory types.ResourceFactory, rc *types. vfID: vfID, apiDevice: apiDevice, infoProviders: infoProviders, - numa: nodeToStr(nodeNum), }, nil } @@ -125,10 +112,6 @@ func (pd *pciDevice) IsSriovPF() bool { return false } -func (pd *pciDevice) GetSubClass() string { - return pd.basePciDevice.Subclass.ID -} - func (pd *pciDevice) GetDeviceSpecs() []*pluginapi.DeviceSpec { dSpecs := make([]*pluginapi.DeviceSpec, 0) for _, infoProvider := range pd.infoProviders { @@ -160,7 +143,3 @@ func (pd *pciDevice) GetAPIDevice() *pluginapi.Device { func (pd *pciDevice) GetVFID() int { return pd.vfID } - -func (pd *pciDevice) GetNumaInfo() string { - return pd.numa -} diff --git a/pkg/types/mocks/AccelDevice.go b/pkg/types/mocks/AccelDevice.go index 54c729edb..f91bb154c 100644 --- a/pkg/types/mocks/AccelDevice.go +++ b/pkg/types/mocks/AccelDevice.go @@ -103,20 +103,6 @@ func (_m *AccelDevice) GetMounts() []*v1beta1.Mount { return r0 } -// GetNumaInfo provides a mock function with given fields: -func (_m *AccelDevice) GetNumaInfo() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetPciAddr provides a mock function with given fields: func (_m *AccelDevice) GetPciAddr() string { ret := _m.Called() @@ -145,20 +131,6 @@ func (_m *AccelDevice) GetPfPciAddr() string { return r0 } -// GetSubClass provides a mock function with given fields: -func (_m *AccelDevice) GetSubClass() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetVFID provides a mock function with given fields: func (_m *AccelDevice) GetVFID() int { ret := _m.Called() diff --git a/pkg/types/mocks/PciDevice.go b/pkg/types/mocks/PciDevice.go index 10439ce41..9b64110f4 100644 --- a/pkg/types/mocks/PciDevice.go +++ b/pkg/types/mocks/PciDevice.go @@ -103,20 +103,6 @@ func (_m *PciDevice) GetMounts() []*v1beta1.Mount { return r0 } -// GetNumaInfo provides a mock function with given fields: -func (_m *PciDevice) GetNumaInfo() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetPciAddr provides a mock function with given fields: func (_m *PciDevice) GetPciAddr() string { ret := _m.Called() @@ -145,20 +131,6 @@ func (_m *PciDevice) GetPfPciAddr() string { return r0 } -// GetSubClass provides a mock function with given fields: -func (_m *PciDevice) GetSubClass() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetVFID provides a mock function with given fields: func (_m *PciDevice) GetVFID() int { ret := _m.Called() diff --git a/pkg/types/mocks/PciNetDevice.go b/pkg/types/mocks/PciNetDevice.go index 64cb7e6ad..345ffe36e 100644 --- a/pkg/types/mocks/PciNetDevice.go +++ b/pkg/types/mocks/PciNetDevice.go @@ -159,20 +159,6 @@ func (_m *PciNetDevice) GetNetName() string { return r0 } -// GetNumaInfo provides a mock function with given fields: -func (_m *PciNetDevice) GetNumaInfo() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetPFName provides a mock function with given fields: func (_m *PciNetDevice) GetPFName() string { ret := _m.Called() @@ -231,20 +217,6 @@ func (_m *PciNetDevice) GetRdmaSpec() types.RdmaSpec { return r0 } -// GetSubClass provides a mock function with given fields: -func (_m *PciNetDevice) GetSubClass() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // GetVFID provides a mock function with given fields: func (_m *PciNetDevice) GetVFID() int { ret := _m.Called() diff --git a/pkg/types/types.go b/pkg/types/types.go index aa15e5f4d..d4553b8e9 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -185,13 +185,11 @@ type PciDevice interface { GetPciAddr() string GetPfPciAddr() string IsSriovPF() bool - GetSubClass() string GetDeviceSpecs() []*pluginapi.DeviceSpec GetEnvVal() string GetMounts() []*pluginapi.Mount GetAPIDevice() *pluginapi.Device GetVFID() int - GetNumaInfo() string } // PciNetDevice extends PciDevice interface