From 711a9869e54743b05fc3478be5adce31d45cefe5 Mon Sep 17 00:00:00 2001 From: Brielle Broder Date: Tue, 12 Jun 2018 13:24:22 -0700 Subject: Runsc checkpoint works. This is the first iteration of checkpoint that actually saves to a file. Tests for checkpoint are included. Ran into an issue when private unix sockets are enabled. An error message was added for this case and the mutex state was set. PiperOrigin-RevId: 200269470 Change-Id: I28d29a9f92c44bf73dc4a4b12ae0509ee4070e93 --- runsc/sandbox/sandbox.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'runsc/sandbox') diff --git a/runsc/sandbox/sandbox.go b/runsc/sandbox/sandbox.go index 48388aa7f..c1efab7f5 100644 --- a/runsc/sandbox/sandbox.go +++ b/runsc/sandbox/sandbox.go @@ -441,7 +441,8 @@ func (s *Sandbox) Signal(cid string, sig syscall.Signal) error { } // Checkpoint sends the checkpoint call for a container in the sandbox. -func (s *Sandbox) Checkpoint(cid string) error { +// The statefile will be written to f. +func (s *Sandbox) Checkpoint(cid string, f *os.File) error { log.Debugf("Checkpoint sandbox %q", s.ID) conn, err := s.connect() if err != nil { @@ -449,7 +450,13 @@ func (s *Sandbox) Checkpoint(cid string) error { } defer conn.Close() - if err := conn.Call(boot.ContainerCheckpoint, nil, nil); err != nil { + opt := control.SaveOpts{ + FilePayload: urpc.FilePayload{ + Files: []*os.File{f}, + }, + } + + if err := conn.Call(boot.ContainerCheckpoint, &opt, nil); err != nil { return fmt.Errorf("err checkpointing container %q: %v", cid, err) } return nil -- cgit v1.2.3