From 86df7c6696bf2768783a364401f7efe2aca1946c Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 9 Aug 2023 21:46:05 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 2 ++ cmd/nvidia-ctk/cdi/generate/generate.go | 17 +++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d64605dc..aa52deba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/cmd/nvidia-ctk/cdi/generate/generate.go b/cmd/nvidia-ctk/cdi/generate/generate.go index 8a6f061b..1afb7550 100644 --- a/cmd/nvidia-ctk/cdi/generate/generate.go +++ b/cmd/nvidia-ctk/cdi/generate/generate.go @@ -50,9 +50,10 @@ type options struct { vendor string class string + librarySearchPaths cli.StringSlice + csv struct { - files cli.StringSlice - librarySearchPaths cli.StringSlice + files 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)