mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-01-30 05:52:15 +00:00
gpu: Remove CDI annotations for outer runtime
After the outer runtime has processed the CDI annotation from the spec we can delete them since they were converted into Linux devices in the OCI spec. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
@@ -697,7 +697,14 @@ func WithCDI(annotations map[string]string, cdiSpecDirs []string, spec *specs.Sp
|
||||
if _, err := registry.InjectDevices(spec, devsFromAnnotations...); err != nil {
|
||||
return nil, fmt.Errorf("CDI device injection failed: %w", err)
|
||||
}
|
||||
|
||||
// Once we injected the device into the ociSpec we do not need to CDI
|
||||
// device annotation from the outer runtime. The runtime will create the
|
||||
// appropriate inner runtime CDI annotation dependent on the device.
|
||||
for key := range spec.Annotations {
|
||||
if strings.HasPrefix(key, cdi.AnnotationPrefix) {
|
||||
delete(spec.Annotations, key)
|
||||
}
|
||||
}
|
||||
// One crucial thing to keep in mind is that CDI device injection
|
||||
// might add OCI Spec environment variables, hooks, and mounts as
|
||||
// well. Therefore it is important that none of the corresponding
|
||||
|
||||
Reference in New Issue
Block a user