Skip to content

Commit

Permalink
address review comment
Browse files Browse the repository at this point in the history
Signed-off-by: Tariq Ibrahim <tibrahim@nvidia.com>
  • Loading branch information
tariq1890 committed Oct 10, 2024
1 parent 6266ef3 commit 3e6c2b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 2 additions & 0 deletions tools/container/nvidia-toolkit/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ const (
)

var availableRuntimes = map[string]struct{}{"docker": {}, "crio": {}, "containerd": {}}
var defaultLowLevelRuntimes = []string{"docker-runc", "runc", "crun"}

var waitingForSignal = make(chan bool, 1)
var signalReceived = make(chan bool, 1)
Expand Down Expand Up @@ -161,6 +162,7 @@ func Run(c *cli.Context, o *options) error {
if err != nil {
return fmt.Errorf("unable to determine runtime options: %w", err)
}
lowlevelRuntimePaths = append(lowlevelRuntimePaths, defaultLowLevelRuntimes...)

o.toolkitOptions.ContainerRuntimeRuntimes = *cli.NewStringSlice(lowlevelRuntimePaths...)
}
Expand Down
18 changes: 1 addition & 17 deletions tools/container/toolkit/toolkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ func installToolkitConfig(c *cli.Context, toolkitConfigPath string, nvidiaContai
"nvidia-container-runtime-hook.skip-mode-detection": opts.ContainerRuntimeHookSkipModeDetection,
}

toolkitRuntimeList := getNvidiaContainerRuntimeList(cfg, opts.ContainerRuntimeRuntimes.Value())
toolkitRuntimeList := opts.ContainerRuntimeRuntimes.Value()
if len(toolkitRuntimeList) > 0 {
configValues["nvidia-container-runtime.runtimes"] = toolkitRuntimeList
}
Expand Down Expand Up @@ -790,19 +790,3 @@ func generateCDISpec(opts *Options, nvidiaCDIHookPath string) error {

return nil
}

// getNvidiaContainerRuntimeList returns a consolidated list of low-level runtimes to be used by the toolkit
func getNvidiaContainerRuntimeList(cfgToml *config.Toml, containerRuntimeBinaries []string) []string {
var ctkRuntimes []string
nvidiaCTKConfig, err := cfgToml.Config()
if err == nil {
if len(containerRuntimeBinaries) > 0 {
ctkRuntimes = append(ctkRuntimes, containerRuntimeBinaries...)
}
defaultCfgRuntimes := nvidiaCTKConfig.NVIDIAContainerRuntimeConfig.Runtimes
ctkRuntimes = append(ctkRuntimes, defaultCfgRuntimes...)
} else {
log.Warningf("could not get nvidia container toolkit config: %v", err)
}
return ctkRuntimes
}

0 comments on commit 3e6c2b7

Please sign in to comment.