Fallback to standard CDI modifier when creation of automatic CDI modifier fails

Signed-off-by: Christopher Desiniotis <cdesiniotis@nvidia.com>
This commit is contained in:
Christopher Desiniotis 2023-12-06 07:54:30 -08:00
parent 3158146946
commit 32c3bd1ded

View File

@ -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") 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 { 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( return cdi.New(