Add disabled-device-node-modification hook to CDI spec
Some checks failed
CI Pipeline / code-scanning (push) Has been cancelled
CI Pipeline / variables (push) Has been cancelled
CI Pipeline / golang (push) Has been cancelled
CI Pipeline / image (push) Has been cancelled
CI Pipeline / e2e-test (push) Has been cancelled

This hook is not added to management specs.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2025-02-13 15:15:32 +01:00
parent 49aa5d764b
commit 9c3086de9f
5 changed files with 38 additions and 0 deletions

View File

@@ -44,4 +44,7 @@ const (
// HookEnableCudaCompat refers to the hook used to enable CUDA Forward Compatibility.
// This was added with v1.17.5 of the NVIDIA Container Toolkit.
HookEnableCudaCompat = HookName("enable-cuda-compat")
// HookDisableDeviceNodeModification refers to the hook used to ensure that device nodes
// are not created by nvidia-smi in a container.
HookDisableDeviceNodeModification = HookName("disable-device-node-modification")
)

View File

@@ -115,6 +115,14 @@ func (l *nvcdilib) NewDriverLibraryDiscoverer(version string) (discover.Discover
updateLDCache, _ := discover.NewLDCacheUpdateHook(l.logger, libraries, l.nvidiaCDIHookPath, l.ldconfigPath)
discoverers = append(discoverers, updateLDCache)
if l.HookIsSupported(HookDisableDeviceNodeModification) {
updateNvidiaParams := discover.CreateNvidiaCDIHook(
l.nvidiaCDIHookPath,
"disable-device-node-modification",
)
discoverers = append(discoverers, updateNvidiaParams)
}
d := discover.Merge(discoverers...)
return d, nil

View File

@@ -146,6 +146,9 @@ func New(opts ...Option) (Interface, error) {
}
// Management containers in general do not require CUDA Forward compatibility.
l.disabledHooks[HookEnableCudaCompat] = true
// For Management containers we allow device node creation:
l.disabledHooks[HookDisableDeviceNodeModification] = true
lib = (*managementlib)(l)
case ModeNvml:
lib = (*nvmllib)(l)