Add WithInfoLib option to CDI package

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2024-05-28 13:30:31 +02:00
parent ef57c07199
commit 8fc4b9c742

View File

@ -18,6 +18,7 @@ package nvcdi
import ( import (
"github.com/NVIDIA/go-nvlib/pkg/nvlib/device" "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/go-nvml/pkg/nvml"
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger" "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 // WithDeviceNamers sets the device namer for the library
func WithDeviceNamers(namers ...DeviceNamer) Option { func WithDeviceNamers(namers ...DeviceNamer) Option {
return func(l *nvcdilib) { return func(l *nvcdilib) {