Merge branch 'rename-library-search-path' into 'main'

Add library-search-path option to cdi generate

See merge request nvidia/container-toolkit/container-toolkit!468
This commit is contained in:
Evan Lezar 2023-08-14 13:49:26 +00:00
commit e7ae0f183c
2 changed files with 11 additions and 8 deletions

View File

@ -5,6 +5,8 @@
* Remove installation of OCI hook JSON from RPM package. * Remove installation of OCI hook JSON from RPM package.
* Refactored config for `nvidia-container-runtime-hook`. * Refactored config for `nvidia-container-runtime-hook`.
* Added a `nvidia-ctk config` command which supports setting config options using a `--set` flag. * Added a `nvidia-ctk config` command which supports setting config options using a `--set` flag.
* Added `--library-search-path` option to `nvidia-ctk cdi generate` command in `csv` mode. This allows folders where
libraries are located to be specified explicitly.
## v1.14.0-rc.2 ## v1.14.0-rc.2
* Fix bug causing incorrect nvidia-smi symlink to be created on WSL2 systems with multiple driver roots. * Fix bug causing incorrect nvidia-smi symlink to be created on WSL2 systems with multiple driver roots.

View File

@ -50,9 +50,10 @@ type options struct {
vendor string vendor string
class string class string
librarySearchPaths cli.StringSlice
csv struct { csv struct {
files cli.StringSlice files cli.StringSlice
librarySearchPaths cli.StringSlice
} }
} }
@ -110,6 +111,11 @@ func (m command) build() *cli.Command {
Usage: "Specify the NVIDIA GPU driver root to use when discovering the entities that should be included in the CDI specification.", Usage: "Specify the NVIDIA GPU driver root to use when discovering the entities that should be included in the CDI specification.",
Destination: &opts.driverRoot, Destination: &opts.driverRoot,
}, },
&cli.StringSliceFlag{
Name: "library-search-path",
Usage: "Specify the path to search for libraries when discovering the entities that should be included in the CDI specification.\n\tNote: This option only applies to CSV mode.",
Destination: &opts.librarySearchPaths,
},
&cli.StringFlag{ &cli.StringFlag{
Name: "nvidia-ctk-path", Name: "nvidia-ctk-path",
Usage: "Specify the path to use for the nvidia-ctk in the generated CDI specification. If this is left empty, the path will be searched.", Usage: "Specify the path to use for the nvidia-ctk in the generated CDI specification. If this is left empty, the path will be searched.",
@ -135,11 +141,6 @@ func (m command) build() *cli.Command {
Value: cli.NewStringSlice(csv.DefaultFileList()...), Value: cli.NewStringSlice(csv.DefaultFileList()...),
Destination: &opts.csv.files, Destination: &opts.csv.files,
}, },
&cli.StringSliceFlag{
Name: "csv.library-search-path",
Usage: "Specify the path to search for libraries when discovering the entities that should be included in the CDI specification. This currently only affects CDI mode",
Destination: &opts.csv.librarySearchPaths,
},
} }
return &c return &c
@ -233,7 +234,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
nvcdi.WithDeviceNamer(deviceNamer), nvcdi.WithDeviceNamer(deviceNamer),
nvcdi.WithMode(string(opts.mode)), nvcdi.WithMode(string(opts.mode)),
nvcdi.WithCSVFiles(opts.csv.files.Value()), nvcdi.WithCSVFiles(opts.csv.files.Value()),
nvcdi.WithLibrarySearchPaths(opts.csv.librarySearchPaths.Value()), nvcdi.WithLibrarySearchPaths(opts.librarySearchPaths.Value()),
) )
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to create CDI library: %v", err) return nil, fmt.Errorf("failed to create CDI library: %v", err)