From f005c7b00b08ecd2ab49cf939dd3bdc1e9bd89e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Apr 2026 02:59:17 +0000 Subject: [PATCH] build(deps): Bump github.com/NVIDIA/go-nvlib Bumps [github.com/NVIDIA/go-nvlib](https://github.com/NVIDIA/go-nvlib) from 0.9.1-0.20251202135446-d0f42ba016dd to 0.10.0. - [Release notes](https://github.com/NVIDIA/go-nvlib/releases) - [Commits](https://github.com/NVIDIA/go-nvlib/commits/v0.10.0) --- updated-dependencies: - dependency-name: github.com/NVIDIA/go-nvlib dependency-version: 0.10.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- .../NVIDIA/go-nvlib/pkg/nvpci/nvpci.go | 27 ++++++-- .../NVIDIA/go-nvlib/pkg/nvpci/nvpci_mock.go | 64 ++++++++++++++++--- vendor/modules.txt | 2 +- 5 files changed, 79 insertions(+), 20 deletions(-) diff --git a/go.mod b/go.mod index 3b19e555f..bab19880f 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25.7 require ( github.com/Masterminds/sprig/v3 v3.3.0 - github.com/NVIDIA/go-nvlib v0.9.1-0.20251202135446-d0f42ba016dd + github.com/NVIDIA/go-nvlib v0.10.0 github.com/NVIDIA/k8s-kata-manager v0.2.3 github.com/NVIDIA/k8s-operator-libs v0.0.0-20260215183545-a0a0256b9c5e github.com/NVIDIA/nvidia-container-toolkit v1.19.0 diff --git a/go.sum b/go.sum index 2075d5e62..5fc03a7b7 100644 --- a/go.sum +++ b/go.sum @@ -12,8 +12,8 @@ github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/Mellanox/maintenance-operator/api v0.3.0 h1:TX+QflSZSOzinodbFdDK+2avEE5OAreajLbB33hubjg= github.com/Mellanox/maintenance-operator/api v0.3.0/go.mod h1:hJ+3RfMK82wT9BstT81bWA+6ZUy/zG6UzO5VzmkQfXg= -github.com/NVIDIA/go-nvlib v0.9.1-0.20251202135446-d0f42ba016dd h1:MC1w/VYuo9Zt0se4SSx9BVid4a46ai+voN3knRvVWjE= -github.com/NVIDIA/go-nvlib v0.9.1-0.20251202135446-d0f42ba016dd/go.mod h1:7mzx9FSdO9fXWP9NKuZmWkCwhkEcSWQFe2tmFwtLb9c= +github.com/NVIDIA/go-nvlib v0.10.0 h1:2jbAFmvLBntIc/4iUChI9DzxyYNI92pohXU4kFuNrg0= +github.com/NVIDIA/go-nvlib v0.10.0/go.mod h1:7mzx9FSdO9fXWP9NKuZmWkCwhkEcSWQFe2tmFwtLb9c= github.com/NVIDIA/k8s-kata-manager v0.2.3 h1:d5+gRFqU5el/fKMXhHUaPY7haj+dbHL4nDsO/q05LBo= github.com/NVIDIA/k8s-kata-manager v0.2.3/go.mod h1:xx5OUiMsHyKbyX0JjKHqAftvqS8vx00LFn/5EaMdtB4= github.com/NVIDIA/k8s-operator-libs v0.0.0-20260215183545-a0a0256b9c5e h1:UFtf0yFPZgUpXpniVBLSBZCsIrCg11QzpegDTKflfAI= diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go index f41d0f246..a322ea26d 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci.go @@ -56,6 +56,7 @@ type Interface interface { GetGPUs() ([]*NvidiaPCIDevice, error) GetGPUByIndex(int) (*NvidiaPCIDevice, error) GetGPUByPciBusID(string) (*NvidiaPCIDevice, error) + GetNvidiaDeviceByPciBusID(string) (*NvidiaPCIDevice, error) GetNetworkControllers() ([]*NvidiaPCIDevice, error) GetPciBridges() ([]*NvidiaPCIDevice, error) GetDPUs() ([]*NvidiaPCIDevice, error) @@ -211,7 +212,7 @@ func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) { cache := make(map[string]*NvidiaPCIDevice) for _, deviceDir := range deviceDirs { deviceAddress := deviceDir.Name() - nvdevice, err := p.getGPUByPciBusID(deviceAddress, cache) + nvdevice, err := p.getNvidiaDeviceByPciBusID(deviceAddress, cache) if err != nil { return nil, fmt.Errorf("error constructing NVIDIA PCI device %s: %v", deviceAddress, err) } @@ -235,13 +236,27 @@ func (p *nvpci) GetAllDevices() ([]*NvidiaPCIDevice, error) { return nvdevices, nil } -// GetGPUByPciBusID constructs an NvidiaPCIDevice for the specified address (PCI Bus ID). +// GetGPUByPciBusID returns an NvidiaPCIDevice for the specified address (PCI Bus ID) +// only if the device is a GPU. Returns nil if the device exists but is not a GPU. func (p *nvpci) GetGPUByPciBusID(address string) (*NvidiaPCIDevice, error) { - // Pass nil as to force reading device information from sysfs. - return p.getGPUByPciBusID(address, nil) + dev, err := p.GetNvidiaDeviceByPciBusID(address) + if err != nil { + return nil, err + } + if dev == nil || !dev.IsGPU() { + return nil, nil + } + return dev, nil +} + +// GetNvidiaDeviceByPciBusID constructs an NvidiaPCIDevice for the specified +// address (PCI Bus ID). This returns any NVIDIA PCI device at the given +// address, including GPUs, NVSwitches, and other NVIDIA devices. +func (p *nvpci) GetNvidiaDeviceByPciBusID(address string) (*NvidiaPCIDevice, error) { + return p.getNvidiaDeviceByPciBusID(address, nil) } -func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevice) (*NvidiaPCIDevice, error) { +func (p *nvpci) getNvidiaDeviceByPciBusID(address string, cache map[string]*NvidiaPCIDevice) (*NvidiaPCIDevice, error) { if cache != nil { if pciDevice, exists := cache[address]; exists { return pciDevice, nil @@ -357,7 +372,7 @@ func (p *nvpci) getGPUByPciBusID(address string, cache map[string]*NvidiaPCIDevi physFnAddress, err := filepath.EvalSymlinks(path.Join(devicePath, "physfn")) switch { case err == nil: - physFn, err := p.getGPUByPciBusID(filepath.Base(physFnAddress), cache) + physFn, err := p.getNvidiaDeviceByPciBusID(filepath.Base(physFnAddress), cache) if err != nil { return nil, fmt.Errorf("unable to detect physfn for %s: %v", address, err) } diff --git a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci_mock.go b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci_mock.go index 04ab56b88..ef9030e5c 100644 --- a/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci_mock.go +++ b/vendor/github.com/NVIDIA/go-nvlib/pkg/nvpci/nvpci_mock.go @@ -41,6 +41,9 @@ var _ Interface = &InterfaceMock{} // GetNetworkControllersFunc: func() ([]*NvidiaPCIDevice, error) { // panic("mock out the GetNetworkControllers method") // }, +// GetNvidiaDeviceByPciBusIDFunc: func(s string) (*NvidiaPCIDevice, error) { +// panic("mock out the GetNvidiaDeviceByPciBusID method") +// }, // GetPciBridgesFunc: func() ([]*NvidiaPCIDevice, error) { // panic("mock out the GetPciBridges method") // }, @@ -78,6 +81,9 @@ type InterfaceMock struct { // GetNetworkControllersFunc mocks the GetNetworkControllers method. GetNetworkControllersFunc func() ([]*NvidiaPCIDevice, error) + // GetNvidiaDeviceByPciBusIDFunc mocks the GetNvidiaDeviceByPciBusID method. + GetNvidiaDeviceByPciBusIDFunc func(s string) (*NvidiaPCIDevice, error) + // GetPciBridgesFunc mocks the GetPciBridges method. GetPciBridgesFunc func() ([]*NvidiaPCIDevice, error) @@ -114,6 +120,11 @@ type InterfaceMock struct { // GetNetworkControllers holds details about calls to the GetNetworkControllers method. GetNetworkControllers []struct { } + // GetNvidiaDeviceByPciBusID holds details about calls to the GetNvidiaDeviceByPciBusID method. + GetNvidiaDeviceByPciBusID []struct { + // S is the s argument value. + S string + } // GetPciBridges holds details about calls to the GetPciBridges method. GetPciBridges []struct { } @@ -121,16 +132,17 @@ type InterfaceMock struct { GetVGAControllers []struct { } } - lockGet3DControllers sync.RWMutex - lockGetAllDevices sync.RWMutex - lockGetDPUs sync.RWMutex - lockGetGPUByIndex sync.RWMutex - lockGetGPUByPciBusID sync.RWMutex - lockGetGPUs sync.RWMutex - lockGetNVSwitches sync.RWMutex - lockGetNetworkControllers sync.RWMutex - lockGetPciBridges sync.RWMutex - lockGetVGAControllers sync.RWMutex + lockGet3DControllers sync.RWMutex + lockGetAllDevices sync.RWMutex + lockGetDPUs sync.RWMutex + lockGetGPUByIndex sync.RWMutex + lockGetGPUByPciBusID sync.RWMutex + lockGetGPUs sync.RWMutex + lockGetNVSwitches sync.RWMutex + lockGetNetworkControllers sync.RWMutex + lockGetNvidiaDeviceByPciBusID sync.RWMutex + lockGetPciBridges sync.RWMutex + lockGetVGAControllers sync.RWMutex } // Get3DControllers calls Get3DControllersFunc. @@ -359,6 +371,38 @@ func (mock *InterfaceMock) GetNetworkControllersCalls() []struct { return calls } +// GetNvidiaDeviceByPciBusID calls GetNvidiaDeviceByPciBusIDFunc. +func (mock *InterfaceMock) GetNvidiaDeviceByPciBusID(s string) (*NvidiaPCIDevice, error) { + if mock.GetNvidiaDeviceByPciBusIDFunc == nil { + panic("InterfaceMock.GetNvidiaDeviceByPciBusIDFunc: method is nil but Interface.GetNvidiaDeviceByPciBusID was just called") + } + callInfo := struct { + S string + }{ + S: s, + } + mock.lockGetNvidiaDeviceByPciBusID.Lock() + mock.calls.GetNvidiaDeviceByPciBusID = append(mock.calls.GetNvidiaDeviceByPciBusID, callInfo) + mock.lockGetNvidiaDeviceByPciBusID.Unlock() + return mock.GetNvidiaDeviceByPciBusIDFunc(s) +} + +// GetNvidiaDeviceByPciBusIDCalls gets all the calls that were made to GetNvidiaDeviceByPciBusID. +// Check the length with: +// +// len(mockedInterface.GetNvidiaDeviceByPciBusIDCalls()) +func (mock *InterfaceMock) GetNvidiaDeviceByPciBusIDCalls() []struct { + S string +} { + var calls []struct { + S string + } + mock.lockGetNvidiaDeviceByPciBusID.RLock() + calls = mock.calls.GetNvidiaDeviceByPciBusID + mock.lockGetNvidiaDeviceByPciBusID.RUnlock() + return calls +} + // GetPciBridges calls GetPciBridgesFunc. func (mock *InterfaceMock) GetPciBridges() ([]*NvidiaPCIDevice, error) { if mock.GetPciBridgesFunc == nil { diff --git a/vendor/modules.txt b/vendor/modules.txt index e692a2fea..a87389238 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -20,7 +20,7 @@ github.com/Masterminds/sprig/v3 # github.com/Mellanox/maintenance-operator/api v0.3.0 ## explicit; go 1.24.11 github.com/Mellanox/maintenance-operator/api/v1alpha1 -# github.com/NVIDIA/go-nvlib v0.9.1-0.20251202135446-d0f42ba016dd +# github.com/NVIDIA/go-nvlib v0.10.0 ## explicit; go 1.20 github.com/NVIDIA/go-nvlib/pkg/nvmdev github.com/NVIDIA/go-nvlib/pkg/nvpci