Add experimental option to NVIDIA Container Runtime config

This change adds an experimental option to the NVIDIA Container Runtime config. To
simplify the extension of this experimental mode in future an error is raised if
this is enabled.

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar 2022-03-24 13:45:03 +02:00
parent 3bb539a5f7
commit 0c7eb93d62
4 changed files with 11 additions and 5 deletions

View File

@ -47,16 +47,17 @@ func run(argv []string) (rerr error) {
logger.CloseFile() logger.CloseFile()
}() }()
r, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv) runtime, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv)
if err != nil { if err != nil {
return fmt.Errorf("error creating runtime: %v", err) return fmt.Errorf("error creating runtime: %v", err)
} }
return r.Exec(argv) return runtime.Exec(argv)
} }
type config struct { type config struct {
debugFilePath string debugFilePath string
Experimental bool
} }
// getConfig sets up the config struct. Values are read from a toml file // getConfig sets up the config struct. Values are read from a toml file
@ -81,6 +82,7 @@ func getConfig() (*config, error) {
} }
cfg.debugFilePath = toml.GetDefault("nvidia-container-runtime.debug", "/dev/null").(string) cfg.debugFilePath = toml.GetDefault("nvidia-container-runtime.debug", "/dev/null").(string)
cfg.Experimental = toml.GetDefault("nvidia-container-runtime.experimental", false).(bool)
return cfg, nil return cfg, nil
} }

View File

@ -43,7 +43,11 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config, argv []string
return nil, fmt.Errorf("error constructing low-level runtime: %v", err) return nil, fmt.Errorf("error constructing low-level runtime: %v", err)
} }
specModifier := modifier.NewStableRuntimeModifier(logger) var specModifier oci.SpecModifier
if cfg.Experimental {
return nil, fmt.Errorf("experimental mode is not supported")
}
specModifier = modifier.NewStableRuntimeModifier(logger)
// Create the wrapping runtime with the specified modifier // Create the wrapping runtime with the specified modifier
r := runtime.NewModifyingRuntimeWrapper( r := runtime.NewModifyingRuntimeWrapper(

View File

@ -1,6 +1,6 @@
nvidia-container-toolkit (1.10.0~rc.1-1) experimental; urgency=medium nvidia-container-toolkit (1.10.0~rc.1-1) experimental; urgency=medium
* Dummy entry * Add experimental option to NVIDIA Container Runtime
-- NVIDIA CORPORATION <cudatools@nvidia.com> Thu, 24 Mar 2022 13:22:24 +0200 -- NVIDIA CORPORATION <cudatools@nvidia.com> Thu, 24 Mar 2022 13:22:24 +0200

View File

@ -65,7 +65,7 @@ rm -f %{_bindir}/nvidia-container-runtime-hook
%changelog %changelog
* Thu Mar 24 2022 NVIDIA CORPORATION <cudatools@nvidia.com> 1.10.0-0.1.rc.1 * Thu Mar 24 2022 NVIDIA CORPORATION <cudatools@nvidia.com> 1.10.0-0.1.rc.1
- Dummy entry - Add experimental option to NVIDIA Container Runtime
* Fri Mar 18 2022 NVIDIA CORPORATION <cudatools@nvidia.com> 1.9.0-1 * Fri Mar 18 2022 NVIDIA CORPORATION <cudatools@nvidia.com> 1.9.0-1
- [libnvidia-container] Add additional check for Tegra in /sys/.../family file in CLI - [libnvidia-container] Add additional check for Tegra in /sys/.../family file in CLI