@@ -14,7 +14,6 @@ import (
14
14
"github.com/containerd/containerd/v2/pkg/oci"
15
15
cdseccomp "github.com/containerd/containerd/v2/pkg/seccomp"
16
16
"github.com/containerd/continuity/fs"
17
- "github.com/containerd/log"
18
17
"github.com/docker/docker/pkg/idtools"
19
18
"github.com/docker/docker/profiles/seccomp"
20
19
"github.com/moby/buildkit/snapshot"
@@ -191,31 +190,9 @@ func generateCDIOpts(ctx context.Context, devices []*pb.CDIDevice) ([]oci.SpecOp
191
190
}
192
191
}
193
192
194
- // withCDIDevices injects the requested CDI devices into the OCI specification.
195
- // FIXME: Use oci.WithCDIDevices once we switch to containerd 2.0.
196
- withCDIDevices := func (devices ... string ) oci.SpecOpts {
197
- return func (ctx context.Context , _ oci.Client , c * containers.Container , s * specs.Spec ) error {
198
- if len (devices ) == 0 {
199
- return nil
200
- }
201
- if err := cdi .Refresh (); err != nil {
202
- log .G (ctx ).Warnf ("CDI registry refresh failed: %v" , err )
203
- }
204
- bklog .G (ctx ).Debugf ("Injecting CDI devices %v" , devices )
205
- if _ , err := cdi .InjectDevices (s , devices ... ); err != nil {
206
- return errors .Wrapf (err , "CDI device injection failed" )
207
- }
208
- // One crucial thing to keep in mind is that CDI device injection
209
- // might add OCI Spec environment variables, hooks, and mounts as
210
- // well. Therefore, it is important that none of the corresponding
211
- // OCI Spec fields are reset up in the call stack once we return.
212
- return nil
213
- }
214
- }
215
-
216
193
return []oci.SpecOpts {
217
194
withStaticCDIRegistry (),
218
- withCDIDevices (dd ... ),
195
+ oci . WithCDIDevices (dd ... ),
219
196
}, nil
220
197
}
221
198
0 commit comments