diff --git a/api/v1/server.go b/api/v1/server.go index 4a66c2f..36ac3b4 100644 --- a/api/v1/server.go +++ b/api/v1/server.go @@ -338,7 +338,7 @@ func (s *server) createCheckpoint(w http.ResponseWriter, r *http.Request) { e.Checkpoint = &runtime.Checkpoint{ Name: name, Path: cp.Path, - Running: cp.Running, + Exit: cp.Exit, Tcp: cp.Tcp, UnixSockets: cp.UnixSockets, Shell: cp.Shell, diff --git a/api/v1/types.go b/api/v1/types.go index a9f93ac..530bb16 100644 --- a/api/v1/types.go +++ b/api/v1/types.go @@ -59,7 +59,7 @@ type Event struct { type Checkpoint struct { Name string `json:"name,omitempty"` Path string `json:"path"` - Running bool `json:"running,omitempty"` + Exit bool `json:"exit,omitempty"` Tcp bool `json:"tcp"` UnixSockets bool `json:"unixSockets"` Shell bool `json:"shell"` diff --git a/linux/linux.go b/linux/linux.go index de84aec..35b0688 100644 --- a/linux/linux.go +++ b/linux/linux.go @@ -217,7 +217,7 @@ func (c *libcontainerContainer) Checkpoint(cp runtime.Checkpoint) error { func (c *libcontainerContainer) createCheckpointOpts(cp *runtime.Checkpoint) *libcontainer.CriuOpts { opts := libcontainer.CriuOpts{} - opts.LeaveRunning = cp.Running + opts.LeaveRunning = !cp.Exit opts.ShellJob = cp.Shell opts.TcpEstablished = cp.Tcp opts.ExternalUnixConnections = cp.UnixSockets diff --git a/runtime/container.go b/runtime/container.go index 379e3b5..c00d6db 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -30,13 +30,20 @@ type Stdio struct { } type Checkpoint struct { - Timestamp time.Time `json:"timestamp,omitempty"` - Path string `json:"path,omitempty"` - Name string `json:"name,omitempty"` - Tcp bool `json:"tcp"` - UnixSockets bool `json:"unixSockets"` - Shell bool `json:"shell"` - Running bool `json:"running,omitempty"` + // Timestamp is the time that checkpoint happened + Timestamp time.Time `json:"timestamp,omitempty"` + // Path is the custom path to the checkpoint, this is optional + Path string `json:"path,omitempty"` + // Name is the name of the checkpoint + Name string `json:"name,omitempty"` + // Tcp checkpoints open tcp connections + Tcp bool `json:"tcp"` + // UnixSockets persists unix sockets in the checkpoint + UnixSockets bool `json:"unixSockets"` + // Shell persists tty sessions in the checkpoint + Shell bool `json:"shell"` + // Exit exits the container after the checkpoint is finished + Exit bool `json:"exit,omitempty"` } type Container interface {