From 9ee53be986134db358a485a0866e8060bcbce867 Mon Sep 17 00:00:00 2001 From: ZeroMagic Date: Thu, 9 Aug 2018 10:31:58 +0800 Subject: [PATCH] containerd-shim-kata-v2: add the service Resume support Add the Resume api support to resume a paused container. Signed-off-by: ZeroMagic --- containerd-shim-v2/service.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/containerd-shim-v2/service.go b/containerd-shim-v2/service.go index 8737e51762..3d2a292e6e 100644 --- a/containerd-shim-v2/service.go +++ b/containerd-shim-v2/service.go @@ -523,7 +523,26 @@ func (s *service) Pause(ctx context.Context, r *taskAPI.PauseRequest) (*ptypes.E // Resume the container func (s *service) Resume(ctx context.Context, r *taskAPI.ResumeRequest) (*ptypes.Empty, error) { - return nil, errdefs.ErrNotImplemented + s.Lock() + defer s.Unlock() + + c, err := s.getContainer(r.ID) + if err != nil { + return nil, err + } + + err = s.sandbox.ResumeContainer(c.id) + if err == nil { + c.status = task.StatusRunning + return empty, nil + } + + c.status, err = s.getContainerStatus(c.id) + if err != nil { + c.status = task.StatusUnknown + } + + return empty, err } // Kill a process with the provided signal