Clean up repeated package import

Signed-off-by: Zechun Chen <zechun.chen@daocloud.io>
This commit is contained in:
Zechun Chen
2023-02-10 16:21:55 +08:00
parent a6f3cbe0ad
commit b944b108df
9 changed files with 30 additions and 40 deletions

View File

@@ -39,7 +39,6 @@ import (
customopts "github.com/containerd/containerd/pkg/cri/opts"
containerstore "github.com/containerd/containerd/pkg/cri/store/container"
"github.com/containerd/containerd/pkg/cri/util"
ctrdutil "github.com/containerd/containerd/pkg/cri/util"
)
func init() {
@@ -255,7 +254,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
defer func() {
if retErr != nil {
deferCtx, deferCancel := ctrdutil.DeferContext()
deferCtx, deferCancel := util.DeferContext()
defer deferCancel()
c.nri.undoCreateContainer(deferCtx, &sandbox, id, spec)
}
@@ -268,7 +267,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
}
defer func() {
if retErr != nil {
deferCtx, deferCancel := ctrdutil.DeferContext()
deferCtx, deferCancel := util.DeferContext()
defer deferCancel()
if err := cntr.Delete(deferCtx, containerd.WithSnapshotCleanup); err != nil {
log.G(ctx).WithError(err).Errorf("Failed to delete containerd container %q", id)
@@ -344,7 +343,7 @@ func (c *criService) volumeMounts(containerRootDir string, criMounts []*runtime.
// runtimeSpec returns a default runtime spec used in cri-containerd.
func (c *criService) runtimeSpec(id string, baseSpecFile string, opts ...oci.SpecOpts) (*runtimespec.Spec, error) {
// GenerateSpec needs namespace.
ctx := ctrdutil.NamespacedContext()
ctx := util.NamespacedContext()
container := &containers.Container{ID: id}
if baseSpecFile != "" {