Merge pull request #7792 from mxpv/sb-shutdown

This commit is contained in:
Fu Wei
2022-12-15 13:37:35 +08:00
committed by GitHub
16 changed files with 448 additions and 259 deletions

View File

@@ -26,7 +26,7 @@ import (
"github.com/containerd/containerd/log"
)
func (c *Controller) Delete(ctx context.Context, sandboxID string) (*api.ControllerDeleteResponse, error) {
func (c *Controller) Shutdown(ctx context.Context, sandboxID string) (*api.ControllerShutdownResponse, error) {
sandbox, err := c.sandboxStore.Get(sandboxID)
if err != nil {
if !errdefs.IsNotFound(err) {
@@ -34,7 +34,7 @@ func (c *Controller) Delete(ctx context.Context, sandboxID string) (*api.Control
}
// Do not return error if the id doesn't exist.
log.G(ctx).Tracef("Sandbox controller Delete called for sandbox %q that does not exist", sandboxID)
return &api.ControllerDeleteResponse{}, nil
return &api.ControllerShutdownResponse{}, nil
}
// Cleanup the sandbox root directories.
@@ -58,5 +58,5 @@ func (c *Controller) Delete(ctx context.Context, sandboxID string) (*api.Control
}
}
return &api.ControllerDeleteResponse{}, nil
return &api.ControllerShutdownResponse{}, nil
}

View File

@@ -86,7 +86,7 @@ func (c *criService) RemovePodSandbox(ctx context.Context, r *runtime.RemovePodS
return nil, fmt.Errorf("failed to get sandbox controller: %w", err)
}
if _, err := controller.Delete(ctx, id); err != nil && !errdefs.IsNotFound(err) {
if _, err := controller.Shutdown(ctx, id); err != nil && !errdefs.IsNotFound(err) {
return nil, fmt.Errorf("failed to delete sandbox %q: %w", id, err)
}