Skip to content

Commit 1d24179

Browse files
committed
Update 'nvidia-ctk runtime configure' to use new EnableCDI() method from engine.Interface
Signed-off-by: Christopher Desiniotis <[email protected]>
1 parent f59ccee commit 1d24179

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

cmd/nvidia-ctk/runtime/configure/configure.go

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,8 @@ func (m command) configureConfigFile(c *cli.Context, config *config) error {
292292
return fmt.Errorf("unable to update config: %v", err)
293293
}
294294

295-
err = enableCDI(config, cfg)
296-
if err != nil {
297-
return fmt.Errorf("failed to enable CDI in %s: %w", config.runtime, err)
295+
if config.cdi.enabled {
296+
cfg.EnableCDI()
298297
}
299298

300299
outputPath := config.getOutputConfigPath()
@@ -354,19 +353,3 @@ func (m *command) configureOCIHook(c *cli.Context, config *config) error {
354353
}
355354
return nil
356355
}
357-
358-
// enableCDI enables the use of CDI in the corresponding container engine
359-
func enableCDI(config *config, cfg engine.Interface) error {
360-
if !config.cdi.enabled {
361-
return nil
362-
}
363-
switch config.runtime {
364-
case "containerd":
365-
cfg.Set("enable_cdi", true)
366-
case "docker":
367-
cfg.Set("features", map[string]bool{"cdi": true})
368-
default:
369-
return fmt.Errorf("enabling CDI in %s is not supported", config.runtime)
370-
}
371-
return nil
372-
}

0 commit comments

Comments
 (0)