Skip to content

Commit a802cc4

Browse files
committed
Add update-nvidia-params hook to CDI spec
Signed-off-by: Evan Lezar <[email protected]>
1 parent b4b1dfa commit a802cc4

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Diff for: pkg/nvcdi/driver-nvml.go

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ func NewDriverLibraryDiscoverer(logger logger.Interface, driver *root.Driver, nv
106106
nvidiaCDIHookPath,
107107
),
108108
updateLDCache,
109+
discover.CreateNvidiaCDIHook(
110+
nvidiaCDIHookPath,
111+
"update-nvidia-params",
112+
),
109113
)
110114

111115
return d, nil

Diff for: tests/e2e/nvidia-container-toolkit_test.go

+20-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import (
2424
)
2525

2626
// Integration tests for Docker runtime
27-
var _ = Describe("docker", Ordered, func() {
27+
var _ = Describe("docker", Ordered, ContinueOnFailure, func() {
2828
var r Runner
2929

3030
// Install the NVIDIA Container Toolkit
@@ -166,4 +166,23 @@ var _ = Describe("docker", Ordered, func() {
166166
Expect(referenceOutput).To(Equal(out4))
167167
})
168168
})
169+
170+
Describe("Disabling device node creation", Ordered, func() {
171+
BeforeAll(func(ctx context.Context) {
172+
_, _, err := r.Run("docker pull ubuntu")
173+
Expect(err).ToNot(HaveOccurred())
174+
})
175+
176+
It("should work with nvidia-container-runtime-hook", func(ctx context.Context) {
177+
output, _, err := r.Run("docker run --rm -i --runtime=runc --gpus=all ubuntu bash -c \"grep ModifyDeviceFiles: /proc/driver/nvidia/params\"")
178+
Expect(err).ToNot(HaveOccurred())
179+
Expect(output).To(Equal("ModifyDeviceFiles: 0\n"))
180+
})
181+
182+
It("should work with automatic CDI spec generation", func(ctx context.Context) {
183+
output, _, err := r.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu bash -c \"grep ModifyDeviceFiles: /proc/driver/nvidia/params\"")
184+
Expect(err).ToNot(HaveOccurred())
185+
Expect(output).To(Equal("ModifyDeviceFiles: 0\n"))
186+
})
187+
})
169188
})

0 commit comments

Comments
 (0)