mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
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:
@@ -47,16 +47,17 @@ func run(argv []string) (rerr error) {
|
||||
logger.CloseFile()
|
||||
}()
|
||||
|
||||
r, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv)
|
||||
runtime, err := newNVIDIAContainerRuntime(logger.Logger, cfg, argv)
|
||||
if err != nil {
|
||||
return fmt.Errorf("error creating runtime: %v", err)
|
||||
}
|
||||
|
||||
return r.Exec(argv)
|
||||
return runtime.Exec(argv)
|
||||
}
|
||||
|
||||
type config struct {
|
||||
debugFilePath string
|
||||
Experimental bool
|
||||
}
|
||||
|
||||
// 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.Experimental = toml.GetDefault("nvidia-container-runtime.experimental", false).(bool)
|
||||
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
@@ -43,7 +43,11 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config, argv []string
|
||||
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
|
||||
r := runtime.NewModifyingRuntimeWrapper(
|
||||
|
||||
Reference in New Issue
Block a user