diff --git a/executor/oci/spec_linux.go b/executor/oci/spec_linux.go index 44025f9ae081..85ed53513d9d 100644 --- a/executor/oci/spec_linux.go +++ b/executor/oci/spec_linux.go @@ -14,7 +14,6 @@ import ( "github.com/containerd/containerd/v2/pkg/oci" cdseccomp "github.com/containerd/containerd/v2/pkg/seccomp" "github.com/containerd/continuity/fs" - "github.com/containerd/log" "github.com/docker/docker/pkg/idtools" "github.com/docker/docker/profiles/seccomp" "github.com/moby/buildkit/snapshot" @@ -191,31 +190,9 @@ func generateCDIOpts(ctx context.Context, devices []*pb.CDIDevice) ([]oci.SpecOp } } - // withCDIDevices injects the requested CDI devices into the OCI specification. - // FIXME: Use oci.WithCDIDevices once we switch to containerd 2.0. - withCDIDevices := func(devices ...string) oci.SpecOpts { - return func(ctx context.Context, _ oci.Client, c *containers.Container, s *specs.Spec) error { - if len(devices) == 0 { - return nil - } - if err := cdi.Refresh(); err != nil { - log.G(ctx).Warnf("CDI registry refresh failed: %v", err) - } - bklog.G(ctx).Debugf("Injecting CDI devices %v", devices) - if _, err := cdi.InjectDevices(s, devices...); err != nil { - return errors.Wrapf(err, "CDI device injection failed") - } - // 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 - // OCI Spec fields are reset up in the call stack once we return. - return nil - } - } - return []oci.SpecOpts{ withStaticCDIRegistry(), - withCDIDevices(dd...), + oci.WithCDIDevices(dd...), }, nil }