Skip to content

Commit bc1dcbd

Browse files
[no-relnote] devel commit
Signed-off-by: Carlos Eduardo Arango Gutierrez <[email protected]>
1 parent fcb18b5 commit bc1dcbd

File tree

12 files changed

+290
-325
lines changed

12 files changed

+290
-325
lines changed

cmd/nvidia-ctk-installer/toolkit/toolkit_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ devices:
8484
hostPath: /host/driver/root/dev/nvidia-caps-imex-channels/channel1
8585
- path: /dev/nvidia-caps-imex-channels/channel2047
8686
hostPath: /host/driver/root/dev/nvidia-caps-imex-channels/channel2047
87+
- path: /dev/nvidia-caps/nvidia-cap1
88+
hostPath: /host/driver/root/dev/nvidia-caps/nvidia-cap1
8789
containerEdits:
8890
env:
8991
- NVIDIA_CTK_LIBCUDA_DIR=/lib/x86_64-linux-gnu

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ type options struct {
6262
configSearchPaths []string
6363
librarySearchPaths []string
6464
disabledHooks []string
65-
enableChmodHook bool
65+
enabledHooks []string
6666

6767
csv struct {
6868
files []string
@@ -215,11 +215,12 @@ func (m command) build() *cli.Command {
215215
Destination: &opts.disabledHooks,
216216
Sources: cli.EnvVars("NVIDIA_CTK_CDI_GENERATE_DISABLED_HOOKS"),
217217
},
218-
&cli.BoolFlag{
219-
Name: "enable-chmod-hook",
220-
Usage: "Enable the chmod hook for device folder permissions. This hook is disabled by default.",
221-
Destination: &opts.enableChmodHook,
222-
Sources: cli.EnvVars("NVIDIA_CTK_CDI_GENERATE_ENABLE_CHMOD_HOOK"),
218+
&cli.StringSliceFlag{
219+
Name: "enable-hook",
220+
Aliases: []string{"enable-hooks"},
221+
Usage: "Explicitly enable a hook in the generated CDI specification. This overrides disabled hooks. This can be specified multiple times.",
222+
Destination: &opts.enabledHooks,
223+
Sources: cli.EnvVars("NVIDIA_CTK_CDI_GENERATE_ENABLED_HOOKS"),
223224
},
224225
},
225226
}
@@ -328,8 +329,8 @@ func (m command) generateSpec(opts *options) (spec.Interface, error) {
328329
cdiOptions = append(cdiOptions, nvcdi.WithDisabledHook(hook))
329330
}
330331

331-
if opts.enableChmodHook {
332-
cdiOptions = append(cdiOptions, nvcdi.WithEnableChmodHook(true))
332+
for _, hook := range opts.enabledHooks {
333+
cdiOptions = append(cdiOptions, nvcdi.WithEnabledHook(hook))
333334
}
334335

335336
cdilib, err := nvcdi.New(cdiOptions...)

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

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -364,43 +364,59 @@ containerEdits:
364364
{
365365
description: "enableChmodHook",
366366
options: options{
367-
format: "yaml",
368-
mode: "nvml",
369-
vendor: "example.com",
370-
class: "device",
371-
driverRoot: driverRoot,
372-
enableChmodHook: true,
367+
format: "yaml",
368+
mode: "management",
369+
vendor: "example.com",
370+
class: "device",
371+
driverRoot: driverRoot,
372+
enabledHooks: []string{"chmod"},
373+
disabledHooks: []string{"enable-cuda-compat", "update-ldcache", "disable-device-node-modification"},
373374
},
374375
expectedOptions: options{
375376
format: "yaml",
376-
mode: "nvml",
377+
mode: "management",
377378
vendor: "example.com",
378379
class: "device",
379380
nvidiaCDIHookPath: "/usr/bin/nvidia-cdi-hook",
380381
driverRoot: driverRoot,
381-
enableChmodHook: true,
382+
enabledHooks: []string{"chmod"},
383+
disabledHooks: []string{"enable-cuda-compat", "update-ldcache", "disable-device-node-modification"},
382384
},
383385
expectedSpec: `---
384386
cdiVersion: 0.5.0
385387
kind: example.com/device
386388
devices:
387-
- name: "0"
388-
containerEdits:
389-
deviceNodes:
390-
- path: /dev/nvidia0
391-
hostPath: {{ .driverRoot }}/dev/nvidia0
392389
- name: all
393390
containerEdits:
394391
deviceNodes:
395392
- path: /dev/nvidia0
396393
hostPath: {{ .driverRoot }}/dev/nvidia0
394+
- path: /dev/nvidiactl
395+
hostPath: {{ .driverRoot }}/dev/nvidiactl
396+
- path: /dev/nvidia-caps-imex-channels/channel0
397+
hostPath: {{ .driverRoot }}/dev/nvidia-caps-imex-channels/channel0
398+
- path: /dev/nvidia-caps-imex-channels/channel1
399+
hostPath: {{ .driverRoot }}/dev/nvidia-caps-imex-channels/channel1
400+
- path: /dev/nvidia-caps-imex-channels/channel2047
401+
hostPath: {{ .driverRoot }}/dev/nvidia-caps-imex-channels/channel2047
402+
- path: /dev/nvidia-caps/nvidia-cap1
403+
hostPath: {{ .driverRoot }}/dev/nvidia-caps/nvidia-cap1
404+
hooks:
405+
- hookName: createContainer
406+
path: /usr/bin/nvidia-cdi-hook
407+
args:
408+
- nvidia-cdi-hook
409+
- chmod
410+
- --mode
411+
- "755"
412+
- --path
413+
- /dev/nvidia-caps
414+
env:
415+
- NVIDIA_CTK_DEBUG=false
397416
containerEdits:
398417
env:
399418
- NVIDIA_CTK_LIBCUDA_DIR=/lib/x86_64-linux-gnu
400419
- NVIDIA_VISIBLE_DEVICES=void
401-
deviceNodes:
402-
- path: /dev/nvidiactl
403-
hostPath: {{ .driverRoot }}/dev/nvidiactl
404420
hooks:
405421
- hookName: createContainer
406422
path: /usr/bin/nvidia-cdi-hook
@@ -411,30 +427,6 @@ containerEdits:
411427
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
412428
env:
413429
- NVIDIA_CTK_DEBUG=false
414-
- hookName: createContainer
415-
path: /usr/bin/nvidia-cdi-hook
416-
args:
417-
- nvidia-cdi-hook
418-
- enable-cuda-compat
419-
- --host-driver-version=999.88.77
420-
env:
421-
- NVIDIA_CTK_DEBUG=false
422-
- hookName: createContainer
423-
path: /usr/bin/nvidia-cdi-hook
424-
args:
425-
- nvidia-cdi-hook
426-
- update-ldcache
427-
- --folder
428-
- /lib/x86_64-linux-gnu
429-
env:
430-
- NVIDIA_CTK_DEBUG=false
431-
- hookName: createContainer
432-
path: /usr/bin/nvidia-cdi-hook
433-
args:
434-
- nvidia-cdi-hook
435-
- disable-device-node-modification
436-
env:
437-
- NVIDIA_CTK_DEBUG=false
438430
mounts:
439431
- hostPath: {{ .driverRoot }}/lib/x86_64-linux-gnu/libcuda.so.999.88.77
440432
containerPath: /lib/x86_64-linux-gnu/libcuda.so.999.88.77
@@ -444,6 +436,14 @@ containerEdits:
444436
- nodev
445437
- rbind
446438
- rprivate
439+
- hostPath: {{ .driverRoot }}/lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.999.88.77
440+
containerPath: /lib/x86_64-linux-gnu/vdpau/libvdpau_nvidia.so.999.88.77
441+
options:
442+
- ro
443+
- nosuid
444+
- nodev
445+
- rbind
446+
- rprivate
447447
`,
448448
},
449449
}

internal/config/features.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ type features struct {
4242
// possibly bypassing other checks by an orchestration system such as
4343
// kubernetes.
4444
IgnoreImexChannelRequests *feature `toml:"ignore-imex-channel-requests,omitempty"`
45-
// EnableChmodHook allows the chmod hook to be injected for device folder permissions.
46-
// This hook was originally added as a workaround for a specific crun issue with device
47-
// nodes in subdirectories of /dev (e.g., /dev/dri/*, /dev/nvidia-caps/*).
48-
// Since this issue has been resolved in newer versions of crun, this hook is disabled
49-
// by default. Users who still require this functionality can explicitly enable it.
50-
EnableChmodHook *feature `toml:"enable-chmod-hook,omitempty"`
5145
}
5246

5347
type feature bool

internal/config/features_test.go

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)