mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Merge commit from fork
Add `NVIDIA_CTK_DEBUG=false` to hook envs
This commit is contained in:
commit
d6f610790f
@ -3,6 +3,7 @@
|
|||||||
## v1.17.8
|
## v1.17.8
|
||||||
|
|
||||||
- Updated the ordering of Mounts in CDI to have a deterministic output. This makes testing more consistent.
|
- Updated the ordering of Mounts in CDI to have a deterministic output. This makes testing more consistent.
|
||||||
|
- Added NVIDIA_CTK_DEBUG envvar to hooks.
|
||||||
|
|
||||||
### Changes in libnvidia-container
|
### Changes in libnvidia-container
|
||||||
|
|
||||||
|
|||||||
@ -58,13 +58,15 @@ func main() {
|
|||||||
Aliases: []string{"d"},
|
Aliases: []string{"d"},
|
||||||
Usage: "Enable debug-level logging",
|
Usage: "Enable debug-level logging",
|
||||||
Destination: &opts.Debug,
|
Destination: &opts.Debug,
|
||||||
EnvVars: []string{"NVIDIA_CDI_DEBUG"},
|
// TODO: Support for NVIDIA_CDI_DEBUG is deprecated and NVIDIA_CTK_DEBUG should be used instead.
|
||||||
|
EnvVars: []string{"NVIDIA_CTK_DEBUG", "NVIDIA_CDI_DEBUG"},
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "quiet",
|
Name: "quiet",
|
||||||
Usage: "Suppress all output except for errors; overrides --debug",
|
Usage: "Suppress all output except for errors; overrides --debug",
|
||||||
Destination: &opts.Quiet,
|
Destination: &opts.Quiet,
|
||||||
EnvVars: []string{"NVIDIA_CDI_QUIET"},
|
// TODO: Support for NVIDIA_CDI_QUIET is deprecated and NVIDIA_CTK_QUIET should be used instead.
|
||||||
|
EnvVars: []string{"NVDIA_CTK_QUIET", "NVIDIA_CDI_QUIET"},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ type Hook struct {
|
|||||||
Lifecycle string
|
Lifecycle string
|
||||||
Path string
|
Path string
|
||||||
Args []string
|
Args []string
|
||||||
|
Env []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discover defines an interface for discovering the devices, mounts, and hooks available on a system
|
// Discover defines an interface for discovering the devices, mounts, and hooks available on a system
|
||||||
|
|||||||
@ -70,6 +70,7 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
|
|||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
||||||
"--link", "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so",
|
"--link", "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -97,6 +98,7 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
|
|||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
||||||
"--link", "libnvidia-vulkan-producer.so.123.45.67::/usr/lib64/libnvidia-vulkan-producer.so",
|
"--link", "libnvidia-vulkan-producer.so.123.45.67::/usr/lib64/libnvidia-vulkan-producer.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -128,6 +130,7 @@ func TestGraphicsLibrariesDiscoverer(t *testing.T) {
|
|||||||
"--link", "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so",
|
"--link", "../libnvidia-allocator.so.1::/usr/lib64/gbm/nvidia-drm_gbm.so",
|
||||||
"--link", "libnvidia-vulkan-producer.so.123.45.67::/usr/lib64/libnvidia-vulkan-producer.so",
|
"--link", "libnvidia-vulkan-producer.so.123.45.67::/usr/lib64/libnvidia-vulkan-producer.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
package discover
|
package discover
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"tags.cncf.io/container-device-interface/pkg/cdi"
|
"tags.cncf.io/container-device-interface/pkg/cdi"
|
||||||
@ -69,6 +70,7 @@ func (c cdiHook) Create(name string, args ...string) Hook {
|
|||||||
Lifecycle: cdi.CreateContainerHook,
|
Lifecycle: cdi.CreateContainerHook,
|
||||||
Path: string(c),
|
Path: string(c),
|
||||||
Args: append(c.requiredArgs(name), args...),
|
Args: append(c.requiredArgs(name), args...),
|
||||||
|
Env: []string{fmt.Sprintf("NVIDIA_CTK_DEBUG=%v", false)},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (c cdiHook) requiredArgs(name string) []string {
|
func (c cdiHook) requiredArgs(name string) []string {
|
||||||
|
|||||||
@ -95,6 +95,7 @@ func TestLDCacheUpdateHook(t *testing.T) {
|
|||||||
Path: testNvidiaCDIHookPath,
|
Path: testNvidiaCDIHookPath,
|
||||||
Args: tc.expectedArgs,
|
Args: tc.expectedArgs,
|
||||||
Lifecycle: "createContainer",
|
Lifecycle: "createContainer",
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
}
|
}
|
||||||
|
|
||||||
d, err := NewLDCacheUpdateHook(logger, mountMock, testNvidiaCDIHookPath, tc.ldconfigPath)
|
d, err := NewLDCacheUpdateHook(logger, mountMock, testNvidiaCDIHookPath, tc.ldconfigPath)
|
||||||
|
|||||||
@ -115,6 +115,7 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
|||||||
Lifecycle: "createContainer",
|
Lifecycle: "createContainer",
|
||||||
Path: "/path/to/nvidia-cdi-hook",
|
Path: "/path/to/nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -147,6 +148,7 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
|||||||
Lifecycle: "createContainer",
|
Lifecycle: "createContainer",
|
||||||
Path: "/path/to/nvidia-cdi-hook",
|
Path: "/path/to/nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -178,6 +180,7 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
|||||||
Lifecycle: "createContainer",
|
Lifecycle: "createContainer",
|
||||||
Path: "/path/to/nvidia-cdi-hook",
|
Path: "/path/to/nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -247,6 +250,7 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
|||||||
Lifecycle: "createContainer",
|
Lifecycle: "createContainer",
|
||||||
Path: "/path/to/nvidia-cdi-hook",
|
Path: "/path/to/nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
Args: []string{"nvidia-cdi-hook", "create-symlinks", "--link", "libcuda.so.1::/usr/lib/libcuda.so"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -301,6 +305,7 @@ func TestWithWithDriverDotSoSymlinks(t *testing.T) {
|
|||||||
"--link", "libGLX_nvidia.so.1.2.3::/usr/lib/libGLX_indirect.so.0",
|
"--link", "libGLX_nvidia.so.1.2.3::/usr/lib/libGLX_indirect.so.0",
|
||||||
"--link", "libnvidia-opticalflow.so.1::/usr/lib/libnvidia-opticalflow.so",
|
"--link", "libnvidia-opticalflow.so.1::/usr/lib/libnvidia-opticalflow.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -38,10 +38,15 @@ func (d hook) toEdits() *cdi.ContainerEdits {
|
|||||||
// toSpec converts a discovered Hook to a CDI Spec Hook. Note
|
// toSpec converts a discovered Hook to a CDI Spec Hook. Note
|
||||||
// that missing info is filled in when edits are applied by querying the Hook node.
|
// that missing info is filled in when edits are applied by querying the Hook node.
|
||||||
func (d hook) toSpec() *specs.Hook {
|
func (d hook) toSpec() *specs.Hook {
|
||||||
|
env := d.Env
|
||||||
|
if env == nil {
|
||||||
|
env = []string{"NVIDIA_CTK_DEBUG=false"}
|
||||||
|
}
|
||||||
s := specs.Hook{
|
s := specs.Hook{
|
||||||
HookName: d.Lifecycle,
|
HookName: d.Lifecycle,
|
||||||
Path: d.Path,
|
Path: d.Path,
|
||||||
Args: d.Args,
|
Args: d.Args,
|
||||||
|
Env: env,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &s
|
return &s
|
||||||
|
|||||||
@ -97,6 +97,7 @@ func TestDiscovererFromCSVFiles(t *testing.T) {
|
|||||||
"--link",
|
"--link",
|
||||||
"/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so::/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvargus.so",
|
"/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so::/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvargus.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -153,6 +154,7 @@ func TestDiscovererFromCSVFiles(t *testing.T) {
|
|||||||
"--link",
|
"--link",
|
||||||
"/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so::/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvargus.so",
|
"/usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so::/usr/lib/aarch64-linux-gnu/libv4l/plugins/nv/libv4l2_nvargus.so",
|
||||||
},
|
},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -95,6 +95,7 @@ func TestNvidiaSMISymlinkHook(t *testing.T) {
|
|||||||
Path: "nvidia-cdi-hook",
|
Path: "nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
||||||
"--link", "nvidia-smi::/usr/bin/nvidia-smi"},
|
"--link", "nvidia-smi::/usr/bin/nvidia-smi"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -115,6 +116,7 @@ func TestNvidiaSMISymlinkHook(t *testing.T) {
|
|||||||
Path: "nvidia-cdi-hook",
|
Path: "nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
||||||
"--link", "/some/path/nvidia-smi::/usr/bin/nvidia-smi"},
|
"--link", "/some/path/nvidia-smi::/usr/bin/nvidia-smi"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -135,6 +137,7 @@ func TestNvidiaSMISymlinkHook(t *testing.T) {
|
|||||||
Path: "nvidia-cdi-hook",
|
Path: "nvidia-cdi-hook",
|
||||||
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
Args: []string{"nvidia-cdi-hook", "create-symlinks",
|
||||||
"--link", "/some/path/nvidia-smi::/usr/bin/nvidia-smi"},
|
"--link", "/some/path/nvidia-smi::/usr/bin/nvidia-smi"},
|
||||||
|
Env: []string{"NVIDIA_CTK_DEBUG=false"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user