diff options
author | Justine Olshan <justineolshan@google.com> | 2018-06-19 15:22:23 -0700 |
---|---|---|
committer | Shentubot <shentubot@google.com> | 2018-06-19 15:23:36 -0700 |
commit | a6dbef045ff684e92f472280eb6f7f688b9bc87a (patch) | |
tree | 35aad9e3d975e0c217f12adec007d9a35521fc3d /runsc/sandbox/sandbox.go | |
parent | bda2a1ed3503699b8cb814bb3cc7ad0b9694155b (diff) |
Added a resume command to unpause a paused container.
Resume checks the status of the container and unpauses the kernel
if its status is paused. Otherwise nothing happens.
Tests were added to ensure that the process is in the correct state
after various commands.
PiperOrigin-RevId: 201251234
Change-Id: Ifd11b336c33b654fea6238738f864fcf2bf81e19
Diffstat (limited to 'runsc/sandbox/sandbox.go')
-rw-r--r-- | runsc/sandbox/sandbox.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index b008eba1e..0181dc9d4 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -477,6 +477,21 @@ func (s *Sandbox) Pause(cid string) error { return nil } +// Resume sends the resume call for a container in the sandbox. +func (s *Sandbox) Resume(cid string) error { + log.Debugf("Resume sandbox %q", s.ID) + conn, err := s.connect() + if err != nil { + return err + } + defer conn.Close() + + if err := conn.Call(boot.ContainerResume, nil, nil); err != nil { + return fmt.Errorf("err resuming container %q: %v", cid, err) + } + return nil +} + // IsRunning returns true if the sandbox or gofer process is running. func (s *Sandbox) IsRunning() bool { if s.Pid != 0 { |