From 21fc1f24e443623df4133d0bb0194b18fc60d7f8 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Fri, 15 Dec 2023 13:36:38 +0100 Subject: [PATCH] Use devRoot to resolve MIG device nodes Signed-off-by: Evan Lezar --- CHANGELOG.md | 1 + pkg/nvcdi/mig-device-nvml.go | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cd820a36..b11930be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Log explicitly requested runtime mode. * Remove package dependency on libseccomp. * Added detection of libnvdxgdmal.so.1 on WSL2 +* Use devRoot to resolve MIG device nodes. ## v1.15.0-rc.1 * Skip update of ldcache in containers without ldconfig. The .so.SONAME symlinks are still created. diff --git a/pkg/nvcdi/mig-device-nvml.go b/pkg/nvcdi/mig-device-nvml.go index aa51a0f7..a96ad9f7 100644 --- a/pkg/nvcdi/mig-device-nvml.go +++ b/pkg/nvcdi/mig-device-nvml.go @@ -67,7 +67,7 @@ func (l *nvmllib) GetMIGDeviceEdits(parent device.Device, mig device.MigDevice) return nil, fmt.Errorf("error getting Compute Instance ID: %v", ret) } - editsForDevice, err := GetEditsForComputeInstance(l.logger, l.driverRoot, gpu, gi, ci) + editsForDevice, err := l.GetEditsForComputeInstance(gpu, gi, ci) if err != nil { return nil, fmt.Errorf("failed to create container edits for MIG device: %v", err) } @@ -76,8 +76,8 @@ func (l *nvmllib) GetMIGDeviceEdits(parent device.Device, mig device.MigDevice) } // GetEditsForComputeInstance returns the CDI edits for a particular compute instance defined by the (gpu, gi, ci) tuple -func GetEditsForComputeInstance(logger logger.Interface, driverRoot string, gpu int, gi int, ci int) (*cdi.ContainerEdits, error) { - computeInstance, err := newComputeInstanceDiscoverer(logger, driverRoot, gpu, gi, ci) +func (l *nvmllib) GetEditsForComputeInstance(gpu int, gi int, ci int) (*cdi.ContainerEdits, error) { + computeInstance, err := newComputeInstanceDiscoverer(l.logger, l.devRoot, gpu, gi, ci) if err != nil { return nil, fmt.Errorf("failed to create discoverer for Compute Instance: %v", err) } @@ -91,7 +91,7 @@ func GetEditsForComputeInstance(logger logger.Interface, driverRoot string, gpu } // newComputeInstanceDiscoverer returns a discoverer for the specified compute instance -func newComputeInstanceDiscoverer(logger logger.Interface, driverRoot string, gpu int, gi int, ci int) (discover.Discover, error) { +func newComputeInstanceDiscoverer(logger logger.Interface, devRoot string, gpu int, gi int, ci int) (discover.Discover, error) { parentPath := fmt.Sprintf("/dev/nvidia%d", gpu) migCaps, err := nvcaps.NewMigCaps() @@ -113,7 +113,7 @@ func newComputeInstanceDiscoverer(logger logger.Interface, driverRoot string, gp deviceNodes := discover.NewCharDeviceDiscoverer( logger, - driverRoot, + devRoot, []string{ parentPath, giCapDevicePath,