Skip to content

Commit fa0ec9d

Browse files
committed
Allow inclusion of persistenced socket in CDI specification
This change adds an include-persistenced-socket flag to the nvidia-ctk cdi generate command that ensures that a generated specification includes the nvidia-persistenced socket if present on the host. Note that for mangement mode, these sockets are always included if detected. Signed-off-by: Evan Lezar <[email protected]>
1 parent 854c815 commit fa0ec9d

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cmd/nvidia-ctk/cdi/generate/generate.go

+8
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ type options struct {
6060
files cli.StringSlice
6161
ignorePatterns cli.StringSlice
6262
}
63+
64+
includePersistencedSocket bool
6365
}
6466

6567
// NewCommand constructs a generate-cdi command with the specified logger
@@ -169,6 +171,11 @@ func (m command) build() *cli.Command {
169171
Usage: "Specify a pattern the CSV mount specifications.",
170172
Destination: &opts.csv.ignorePatterns,
171173
},
174+
&cli.BoolFlag{
175+
Name: "include-persistenced-socket",
176+
Usage: "Include the nvidia-persistenced socket in the generated CDI specification.",
177+
Destination: &opts.includePersistencedSocket,
178+
},
172179
}
173180

174181
return &c
@@ -273,6 +280,7 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
273280
nvcdi.WithLibrarySearchPaths(opts.librarySearchPaths.Value()),
274281
nvcdi.WithCSVFiles(opts.csv.files.Value()),
275282
nvcdi.WithCSVIgnorePatterns(opts.csv.ignorePatterns.Value()),
283+
nvcdi.WithOptInFeature("include-persistenced-socket", opts.includePersistencedSocket),
276284
)
277285
if err != nil {
278286
return nil, fmt.Errorf("failed to create CDI library: %v", err)

pkg/nvcdi/lib.go

+3
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ func New(opts ...Option) (Interface, error) {
132132
if l.vendor == "" {
133133
l.vendor = "management.nvidia.com"
134134
}
135+
// For management specifications we always allow the fabricmanager and
136+
// persistenced sockets.
137+
WithOptInFeature("include-persistenced-socket", true)(l)
135138
lib = (*managementlib)(l)
136139
case ModeNvml:
137140
lib = (*nvmllib)(l)

0 commit comments

Comments
 (0)