From 0786707cd94b8feffaeb083077eccaf10873e682 Mon Sep 17 00:00:00 2001 From: Justine Olshan Date: Fri, 15 Jun 2018 16:08:20 -0700 Subject: Added code for a pause command for a container process. Like runc, the pause command will pause the processes of the given container. It will set that container's status to "paused." A resume command will be be added to unpause and continue running the process. PiperOrigin-RevId: 200789624 Change-Id: I72a5d7813d90ecfc4d01cc252d6018855016b1ea --- runsc/sandbox/sandbox.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'runsc/sandbox') diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 1c0d23161..f9129a179 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -464,6 +464,21 @@ func (s *Sandbox) Checkpoint(cid string, f *os.File) error { return nil } +// Pause sends the pause call for a container in the sandbox. +func (s *Sandbox) Pause(cid string) error { + log.Debugf("Pause sandbox %q", s.ID) + conn, err := s.connect() + if err != nil { + return err + } + defer conn.Close() + + if err := conn.Call(boot.ContainerPause, nil, nil); err != nil { + return fmt.Errorf("err pausing 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 { -- cgit v1.2.3