Support sandboxed shims shutdown

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2022-12-14 18:22:52 -08:00
parent d65269fda0
commit a4d5c3e5cb
9 changed files with 39 additions and 20 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)
}