From 8fc4b9c742f894ef83e02efcae5caf490414d24e Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 28 May 2024 13:30:31 +0200 Subject: [PATCH] Add WithInfoLib option to CDI package Signed-off-by: Evan Lezar --- pkg/nvcdi/options.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/nvcdi/options.go b/pkg/nvcdi/options.go index 5a490619..417687b9 100644 --- a/pkg/nvcdi/options.go +++ b/pkg/nvcdi/options.go @@ -18,6 +18,7 @@ package nvcdi import ( "github.com/NVIDIA/go-nvlib/pkg/nvlib/device" + "github.com/NVIDIA/go-nvlib/pkg/nvlib/info" "github.com/NVIDIA/go-nvml/pkg/nvml" "github.com/NVIDIA/nvidia-container-toolkit/internal/logger" @@ -34,6 +35,13 @@ func WithDeviceLib(devicelib device.Interface) Option { } } +// WithInfoLib sets the info library for CDI spec generation. +func WithInfoLib(infolib info.Interface) Option { + return func(l *nvcdilib) { + l.infolib = infolib + } +} + // WithDeviceNamers sets the device namer for the library func WithDeviceNamers(namers ...DeviceNamer) Option { return func(l *nvcdilib) {