Change c/r leaverunning to exit

This allows the default checkpoint functionality to leave the container
running after it has been checkpointed.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2015-12-04 13:35:03 -08:00
parent c10b3cde9f
commit e21364603e
4 changed files with 17 additions and 10 deletions

View file

@ -338,7 +338,7 @@ func (s *server) createCheckpoint(w http.ResponseWriter, r *http.Request) {
e.Checkpoint = &runtime.Checkpoint{ e.Checkpoint = &runtime.Checkpoint{
Name: name, Name: name,
Path: cp.Path, Path: cp.Path,
Running: cp.Running, Exit: cp.Exit,
Tcp: cp.Tcp, Tcp: cp.Tcp,
UnixSockets: cp.UnixSockets, UnixSockets: cp.UnixSockets,
Shell: cp.Shell, Shell: cp.Shell,

View file

@ -59,7 +59,7 @@ type Event struct {
type Checkpoint struct { type Checkpoint struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Path string `json:"path"` Path string `json:"path"`
Running bool `json:"running,omitempty"` Exit bool `json:"exit,omitempty"`
Tcp bool `json:"tcp"` Tcp bool `json:"tcp"`
UnixSockets bool `json:"unixSockets"` UnixSockets bool `json:"unixSockets"`
Shell bool `json:"shell"` Shell bool `json:"shell"`

View file

@ -217,7 +217,7 @@ func (c *libcontainerContainer) Checkpoint(cp runtime.Checkpoint) error {
func (c *libcontainerContainer) createCheckpointOpts(cp *runtime.Checkpoint) *libcontainer.CriuOpts { func (c *libcontainerContainer) createCheckpointOpts(cp *runtime.Checkpoint) *libcontainer.CriuOpts {
opts := libcontainer.CriuOpts{} opts := libcontainer.CriuOpts{}
opts.LeaveRunning = cp.Running opts.LeaveRunning = !cp.Exit
opts.ShellJob = cp.Shell opts.ShellJob = cp.Shell
opts.TcpEstablished = cp.Tcp opts.TcpEstablished = cp.Tcp
opts.ExternalUnixConnections = cp.UnixSockets opts.ExternalUnixConnections = cp.UnixSockets

View file

@ -30,13 +30,20 @@ type Stdio struct {
} }
type Checkpoint struct { type Checkpoint struct {
Timestamp time.Time `json:"timestamp,omitempty"` // Timestamp is the time that checkpoint happened
Path string `json:"path,omitempty"` Timestamp time.Time `json:"timestamp,omitempty"`
Name string `json:"name,omitempty"` // Path is the custom path to the checkpoint, this is optional
Tcp bool `json:"tcp"` Path string `json:"path,omitempty"`
UnixSockets bool `json:"unixSockets"` // Name is the name of the checkpoint
Shell bool `json:"shell"` Name string `json:"name,omitempty"`
Running bool `json:"running,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 { type Container interface {