diff options
author | gVisor bot <gvisor-bot@google.com> | 2021-01-15 10:09:43 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-01-15 10:09:43 -0800 |
commit | 714a020ab5cc56f61f92f407212209628f43c46b (patch) | |
tree | ab3da366043a8c5dd28ccf770fa9d28b9a6a4590 /pkg/shim/service.go | |
parent | e57ebcd37a7b9f98d80e594f2c0baf2220d7b830 (diff) | |
parent | a88d6caf533e11d3171232e415f106475e5b3f08 (diff) |
Merge pull request #5237 from travigd:add-containerd-pause
PiperOrigin-RevId: 352032380
Diffstat (limited to 'pkg/shim/service.go')
-rw-r--r-- | pkg/shim/service.go | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/pkg/shim/service.go b/pkg/shim/service.go index 9aba26ac7..eff55df53 100644 --- a/pkg/shim/service.go +++ b/pkg/shim/service.go @@ -612,13 +612,29 @@ func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (*taskAPI. // Pause the container. func (s *service) Pause(ctx context.Context, r *taskAPI.PauseRequest) (*types.Empty, error) { log.L.Debugf("Pause, id: %s", r.ID) - return empty, errdefs.ToGRPC(errdefs.ErrNotImplemented) + if s.task == nil { + log.L.Debugf("Pause error, id: %s: container not created", r.ID) + return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") + } + err := s.task.Runtime().Pause(ctx, r.ID) + if err != nil { + return nil, err + } + return empty, nil } // Resume the container. func (s *service) Resume(ctx context.Context, r *taskAPI.ResumeRequest) (*types.Empty, error) { log.L.Debugf("Resume, id: %s", r.ID) - return empty, errdefs.ToGRPC(errdefs.ErrNotImplemented) + if s.task == nil { + log.L.Debugf("Resume error, id: %s: container not created", r.ID) + return nil, errdefs.ToGRPCf(errdefs.ErrFailedPrecondition, "container must be created") + } + err := s.task.Runtime().Resume(ctx, r.ID) + if err != nil { + return nil, err + } + return empty, nil } // Kill a process with the provided signal. |