Skip to content

Commit

Permalink
Add --allow-additional-gids to cdi generate command
Browse files Browse the repository at this point in the history
Signed-off-by: Evan Lezar <[email protected]>
  • Loading branch information
elezar committed Aug 22, 2024
1 parent a1a40c9 commit fab0c6d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/nvidia-ctk/cdi/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fab0c6d

Please sign in to comment.