Merge branch 'log-unresolved-devices' into 'main'

add a warning statement listing unresolved CDI devices

See merge request nvidia/container-toolkit/container-toolkit!461
This commit is contained in:
Tariq Ibrahim 2023-08-14 17:22:36 +00:00
commit f904ec41eb

View File

@ -35,14 +35,17 @@ type fromRegistry struct {
var _ oci.SpecModifier = (*fromRegistry)(nil)
// Modify applies the mofiications defined by the CDI registry to the incomming OCI spec.
// Modify applies the modifications defined by the CDI registry to the incoming OCI spec.
func (m fromRegistry) Modify(spec *specs.Spec) error {
if err := m.registry.Refresh(); err != nil {
m.logger.Debugf("The following error was triggered when refreshing the CDI registry: %v", err)
}
m.logger.Debugf("Injecting devices using CDI: %v", m.devices)
_, err := m.registry.InjectDevices(spec, m.devices...)
unresolvedDevices, err := m.registry.InjectDevices(spec, m.devices...)
if unresolvedDevices != nil {
m.logger.Warningf("could not resolve CDI devices: %v", unresolvedDevices)
}
if err != nil {
var refreshErrors []error
for _, rerrs := range m.registry.GetErrors() {