From 5d55813fb85fa3f5727e456e741c873df048093b Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Wed, 21 Aug 2024 11:10:18 +0200 Subject: [PATCH] Add --allow-additional-gids to cdi generate command Signed-off-by: Evan Lezar --- cmd/nvidia-ctk/cdi/generate/generate.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/nvidia-ctk/cdi/generate/generate.go b/cmd/nvidia-ctk/cdi/generate/generate.go index 9f9e994b..2507bccf 100644 --- a/cmd/nvidia-ctk/cdi/generate/generate.go +++ b/cmd/nvidia-ctk/cdi/generate/generate.go @@ -60,6 +60,11 @@ type options struct { files cli.StringSlice ignorePatterns cli.StringSlice } + + // spec represents the CDI spec options. + spec struct { + allowAdditionalGIDs bool + } } // NewCommand constructs a generate-cdi command with the specified logger @@ -169,6 +174,11 @@ func (m command) build() *cli.Command { Usage: "Specify a pattern the CSV mount specifications.", Destination: &opts.csv.ignorePatterns, }, + &cli.BoolFlag{ + Name: "--allow-additional-gids", + Usage: "Allow the use of the additionalGIDs field for generated CDI specifications. Note this will generate a v0.7.0 CDI specification.", + Destination: &opts.spec.allowAdditionalGIDs, + }, } return &c @@ -273,6 +283,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) { nvcdi.WithLibrarySearchPaths(opts.librarySearchPaths.Value()), nvcdi.WithCSVFiles(opts.csv.files.Value()), nvcdi.WithCSVIgnorePatterns(opts.csv.ignorePatterns.Value()), + nvcdi.WithAllowAdditionalGIDs(opts.spec.allowAdditionalGIDs), ) if err != nil { return nil, fmt.Errorf("failed to create CDI library: %v", err)