summaryrefslogtreecommitdiffhomepage
path: root/runsc/sandbox/sandbox.go
diff options
context:
space:
mode:
authorBrielle Broder <bbroder@google.com>2018-06-12 13:24:22 -0700
committerShentubot <shentubot@google.com>2018-06-12 13:25:23 -0700
commit711a9869e54743b05fc3478be5adce31d45cefe5 (patch)
tree7e0b61d5b8a075f96dc868a7c548252b231101ed /runsc/sandbox/sandbox.go
parent7a10df454b1c12b207f479cdda7338fff2875d5f (diff)
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
Diffstat (limited to 'runsc/sandbox/sandbox.go')
-rw-r--r--runsc/sandbox/sandbox.go11
1 files changed, 9 insertions, 2 deletions
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