summaryrefslogtreecommitdiffhomepage
path: root/pkg/shim/service.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/shim/service.go')
-rw-r--r--pkg/shim/service.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/pkg/shim/service.go b/pkg/shim/service.go
index 844210abb..eff55df53 100644
--- a/pkg/shim/service.go
+++ b/pkg/shim/service.go
@@ -612,15 +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)
+ 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)
- return empty, err
+ 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)
+ 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)
- return empty, err
+ if err != nil {
+ return nil, err
+ }
+ return empty, nil
}
// Kill a process with the provided signal.