From 3f03a71afdef6296da794bea07ea492f611de7fb Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Mon, 5 Jun 2023 15:01:58 +0200 Subject: [PATCH] Skip additional modifications in CDI mode Signed-off-by: Evan Lezar --- internal/runtime/runtime_factory.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/internal/runtime/runtime_factory.go b/internal/runtime/runtime_factory.go index 80f94abc..a417907e 100644 --- a/internal/runtime/runtime_factory.go +++ b/internal/runtime/runtime_factory.go @@ -61,10 +61,15 @@ func newNVIDIAContainerRuntime(logger *logrus.Logger, cfg *config.Config, argv [ // newSpecModifier is a factory method that creates constructs an OCI spec modifer based on the provided config. func newSpecModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec, argv []string) (oci.SpecModifier, error) { - modeModifier, err := newModeModifier(logger, cfg, ociSpec, argv) + mode := info.ResolveAutoMode(logger, cfg.NVIDIAContainerRuntimeConfig.Mode) + modeModifier, err := newModeModifier(logger, mode, cfg, ociSpec, argv) if err != nil { return nil, err } + // For CDI mode we make no additional modifications. + if mode == "cdi" { + return modeModifier, nil + } graphicsModifier, err := modifier.NewGraphicsModifier(logger, cfg, ociSpec) if err != nil { @@ -90,8 +95,8 @@ func newSpecModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec return modifiers, nil } -func newModeModifier(logger *logrus.Logger, cfg *config.Config, ociSpec oci.Spec, argv []string) (oci.SpecModifier, error) { - switch info.ResolveAutoMode(logger, cfg.NVIDIAContainerRuntimeConfig.Mode) { +func newModeModifier(logger *logrus.Logger, mode string, cfg *config.Config, ociSpec oci.Spec, argv []string) (oci.SpecModifier, error) { + switch mode { case "legacy": return modifier.NewStableRuntimeModifier(logger, cfg.NVIDIAContainerRuntimeHookConfig.Path), nil case "csv":