Add library-search-path option to cdi generate

This change renames the csv.library-search-path option to
library-search-path so as to be more generally applicable in
future. Note that the option is still only applied in csv mode.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2023-08-09 21:46:05 +02:00
parent 99923b57b8
commit 86df7c6696
2 changed files with 11 additions and 8 deletions

View File

@ -5,6 +5,8 @@
* Remove installation of OCI hook JSON from RPM package.
* Refactored config for `nvidia-container-runtime-hook`.
* 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
* 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
class string
librarySearchPaths cli.StringSlice
csv struct {
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.",
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{
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.",
@ -135,11 +141,6 @@ func (m command) build() *cli.Command {
Value: cli.NewStringSlice(csv.DefaultFileList()...),
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
@ -233,7 +234,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
nvcdi.WithDeviceNamer(deviceNamer),
nvcdi.WithMode(string(opts.mode)),
nvcdi.WithCSVFiles(opts.csv.files.Value()),
nvcdi.WithLibrarySearchPaths(opts.csv.librarySearchPaths.Value()),
nvcdi.WithLibrarySearchPaths(opts.librarySearchPaths.Value()),
)
if err != nil {
return nil, fmt.Errorf("failed to create CDI library: %v", err)