mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Add devRoot option to CDI api
A driverRoot defines both the driver library root and the root for device nodes. In the case of preinstalled drivers or the driver container, these are equal, but in cases such as GKE they do not match. In this case, drivers are extracted to a folder and devices exist at the root /. The changes here add a devRoot option to the nvcdi API that allows the parent of /dev to be specified explicitly. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -29,6 +29,7 @@ type tegraOptions struct {
|
||||
logger logger.Interface
|
||||
csvFiles []string
|
||||
driverRoot string
|
||||
devRoot string
|
||||
nvidiaCTKPath string
|
||||
librarySearchPaths []string
|
||||
ignorePatterns ignoreMountSpecPatterns
|
||||
@@ -50,6 +51,10 @@ func New(opts ...Option) (discover.Discover, error) {
|
||||
opt(o)
|
||||
}
|
||||
|
||||
if o.devRoot == "" {
|
||||
o.devRoot = o.driverRoot
|
||||
}
|
||||
|
||||
if o.symlinkLocator == nil {
|
||||
o.symlinkLocator = lookup.NewSymlinkLocator(
|
||||
lookup.WithLogger(o.logger),
|
||||
@@ -112,6 +117,14 @@ func WithDriverRoot(driverRoot string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// WithDevRoot sets the /dev root.
|
||||
// If this is unset, the driver root is assumed.
|
||||
func WithDevRoot(driverRoot string) Option {
|
||||
return func(o *tegraOptions) {
|
||||
o.driverRoot = driverRoot
|
||||
}
|
||||
}
|
||||
|
||||
// WithCSVFiles sets the CSV files for the discoverer.
|
||||
func WithCSVFiles(csvFiles []string) Option {
|
||||
return func(o *tegraOptions) {
|
||||
|
||||
Reference in New Issue
Block a user