(ctx context.Context, sandboxID string, opts ...sandbox.StopOpt)
| 219 | } |
| 220 | |
| 221 | func (c *controllerLocal) Stop(ctx context.Context, sandboxID string, opts ...sandbox.StopOpt) error { |
| 222 | var soptions sandbox.StopOptions |
| 223 | for _, opt := range opts { |
| 224 | opt(&soptions) |
| 225 | } |
| 226 | req := &runtimeAPI.StopSandboxRequest{SandboxID: sandboxID} |
| 227 | if soptions.Timeout != nil { |
| 228 | req.TimeoutSecs = uint32(soptions.Timeout.Seconds()) |
| 229 | } |
| 230 | |
| 231 | svc, err := c.getSandbox(ctx, sandboxID) |
| 232 | if errdefs.IsNotFound(err) { |
| 233 | return nil |
| 234 | } |
| 235 | if err != nil { |
| 236 | return err |
| 237 | } |
| 238 | |
| 239 | if _, err := svc.StopSandbox(ctx, req); err != nil { |
| 240 | err = errgrpc.ToNative(err) |
| 241 | if !errdefs.IsNotFound(err) && !errdefs.IsUnavailable(err) { |
| 242 | return fmt.Errorf("failed to stop sandbox: %w", err) |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | return nil |
| 247 | } |
| 248 | |
| 249 | func (c *controllerLocal) Shutdown(ctx context.Context, sandboxID string) error { |
| 250 | svc, err := c.getSandbox(ctx, sandboxID) |
nothing calls this directly
no test coverage detected