From 32c3bd1ded8872c4c5078e7bffb96dcf0a719eed Mon Sep 17 00:00:00 2001 From: Christopher Desiniotis Date: Wed, 6 Dec 2023 07:54:30 -0800 Subject: [PATCH] Fallback to standard CDI modifier when creation of automatic CDI modifier fails Signed-off-by: Christopher Desiniotis --- internal/modifier/cdi.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/modifier/cdi.go b/internal/modifier/cdi.go index 4a1079ac..c53cb996 100644 --- a/internal/modifier/cdi.go +++ b/internal/modifier/cdi.go @@ -50,7 +50,12 @@ func NewCDIModifier(logger logger.Interface, cfg *config.Config, ociSpec oci.Spe return nil, fmt.Errorf("requesting a CDI device with vendor 'runtime.nvidia.com' is not supported when requesting other CDI devices") } if len(automaticDevices) > 0 { - return newAutomaticCDISpecModifier(logger, cfg, automaticDevices) + automaticModifier, err := newAutomaticCDISpecModifier(logger, cfg, automaticDevices) + if err == nil { + return automaticModifier, nil + } + logger.Warningf("Failed to create the automatic CDI modifier: %w", err) + logger.Debugf("Falling back to the standard CDI modifier") } return cdi.New(