mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
nvsandboxutils: Add usage of GetGpuResource and GetFileContent APIs
This change adds a new discoverer for Sandboxutils to report the file system paths and associated symbolic links using GetGpuResource and GetFileContent APIs. Both GPU and MIG devices are supported. If the Sandboxutils discoverer fails, the NVML discoverer is used to report the file system information. Signed-off-by: Evan Lezar <elezar@nvidia.com> Signed-off-by: Huy Nguyen <huyn@nvidia.com> Signed-off-by: Sananya Majumder <sananyam@nvidia.com>
This commit is contained in:
@@ -19,6 +19,7 @@ package dgpu
|
||||
import (
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/logger"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvcaps"
|
||||
"github.com/NVIDIA/nvidia-container-toolkit/internal/nvsandboxutils"
|
||||
)
|
||||
|
||||
type options struct {
|
||||
@@ -26,10 +27,13 @@ type options struct {
|
||||
devRoot string
|
||||
nvidiaCDIHookPath string
|
||||
|
||||
isMigDevice bool
|
||||
// migCaps stores the MIG capabilities for the system.
|
||||
// If MIG is not available, this is nil.
|
||||
migCaps nvcaps.MigCaps
|
||||
migCapsError error
|
||||
|
||||
nvsandboxutilslib nvsandboxutils.Interface
|
||||
}
|
||||
|
||||
type Option func(*options)
|
||||
@@ -61,3 +65,10 @@ func WithMIGCaps(migCaps nvcaps.MigCaps) Option {
|
||||
l.migCaps = migCaps
|
||||
}
|
||||
}
|
||||
|
||||
// WithNvsandboxuitilsLib sets the nvsandboxutils library implementation.
|
||||
func WithNvsandboxuitilsLib(nvsandboxutilslib nvsandboxutils.Interface) Option {
|
||||
return func(l *options) {
|
||||
l.nvsandboxutilslib = nvsandboxutilslib
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user