mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-27 19:35:32 +00:00
gpu: Add CDI parsing for Sandbox as well
Extend the CDI parsing for pod_sandbox as well, only single_container was covered properly. Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
97f4bcb456
commit
6713db8990
@ -112,19 +112,16 @@ func create(ctx context.Context, s *service, r *taskAPI.CreateTaskRequest) (*con
|
|||||||
if s.sandbox != nil {
|
if s.sandbox != nil {
|
||||||
return nil, fmt.Errorf("cannot create another sandbox in sandbox: %s", s.sandbox.ID())
|
return nil, fmt.Errorf("cannot create another sandbox in sandbox: %s", s.sandbox.ID())
|
||||||
}
|
}
|
||||||
|
// Here we deal with CDI devices that are cold-plugged (k8s) and
|
||||||
|
// for the single_container (nerdctl, podman, ...) use-case.
|
||||||
// We can provide additional directories where to search for
|
// We can provide additional directories where to search for
|
||||||
// CDI specs if needed. immutable OS's only have specific
|
// CDI specs if needed. immutable OS's only have specific
|
||||||
// directories where applications can write too. For instance /opt/cdi
|
// directories where applications can write too. For instance /opt/cdi
|
||||||
//
|
//
|
||||||
// _, err = withCDI(ociSpec.Annotations, []string{"/opt/cdi"}, ociSpec)
|
// _, err = withCDI(ociSpec.Annotations, []string{"/opt/cdi"}, ociSpec)
|
||||||
//
|
_, err = config.WithCDI(ociSpec.Annotations, []string{}, ociSpec)
|
||||||
// Only inject CDI devices if single_container we do not want
|
if err != nil {
|
||||||
// CDI devices in the pod_sandbox
|
return nil, fmt.Errorf("adding CDI devices failed: %w", err)
|
||||||
if containerType == vc.SingleContainer {
|
|
||||||
_, err = config.WithCDI(ociSpec.Annotations, []string{}, ociSpec)
|
|
||||||
if err != nil {
|
|
||||||
return nil, fmt.Errorf("adding CDI devices failed: %w", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s.config = runtimeConfig
|
s.config = runtimeConfig
|
||||||
|
Loading…
Reference in New Issue
Block a user