Add checkpoint and restore
Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Update go-runc to 49b2a02ec1ed3e4ae52d30b54a291b75 Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Add shim to restore creation Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Keep checkpoint path in service Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Add C/R to non-shim build Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Checkpoint rw and image Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Pause container on bind checkpoints Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Return dump.log in error on checkpoint failure Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Pause container for checkpoint Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Update runc to 639454475cb9c8b861cc599f8bcd5c8c790ae402 For checkpoint into to work you need runc version 639454475cb9c8b861cc599f8bcd5c8c790ae402 + and criu 3.0 as this is what I have been testing with. Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Move restore behind create calls This remove the restore RPCs in favor of providing the checkpoint information to the `Create` calls of a container. If provided, the container will be created/restored from the checkpoint instead of an existing container. Signed-off-by: Michael Crosby <crosbymichael@gmail.com> Regen protos after rebase Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -9,7 +9,6 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/log"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/windows/hcs"
|
||||
@@ -22,7 +21,7 @@ var (
|
||||
ErrLoadedContainer = errors.New("loaded container can only be terminated")
|
||||
)
|
||||
|
||||
type eventCallback func(id string, evType containerd.EventType, pid, exitStatus uint32, exitedAt time.Time)
|
||||
type eventCallback func(id string, evType plugin.EventType, pid, exitStatus uint32, exitedAt time.Time)
|
||||
|
||||
func loadContainers(ctx context.Context, h *hcs.HCS, sendEvent eventCallback) ([]*container, error) {
|
||||
hCtr, err := h.LoadContainers(ctx)
|
||||
@@ -52,7 +51,7 @@ func newContainer(ctx context.Context, h *hcs.HCS, id string, spec RuntimeSpec,
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sendEvent(id, containerd.CreateEvent, hcsCtr.Pid(), 0, time.Time{})
|
||||
sendEvent(id, plugin.CreateEvent, hcsCtr.Pid(), 0, time.Time{})
|
||||
|
||||
return &container{
|
||||
ctr: hcsCtr,
|
||||
@@ -87,7 +86,7 @@ func (c *container) Start(ctx context.Context) error {
|
||||
}
|
||||
|
||||
c.setStatus(plugin.RunningStatus)
|
||||
c.sendEvent(c.ctr.ID(), containerd.StartEvent, c.ctr.Pid(), 0, time.Time{})
|
||||
c.sendEvent(c.ctr.ID(), plugin.StartEvent, c.ctr.Pid(), 0, time.Time{})
|
||||
|
||||
// Wait for our process to terminate
|
||||
go func() {
|
||||
@@ -96,7 +95,7 @@ func (c *container) Start(ctx context.Context) error {
|
||||
log.G(ctx).Debug(err)
|
||||
}
|
||||
c.setStatus(plugin.StoppedStatus)
|
||||
c.sendEvent(c.ctr.ID(), containerd.ExitEvent, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt())
|
||||
c.sendEvent(c.ctr.ID(), plugin.ExitEvent, c.ctr.Pid(), ec, c.ctr.Processes()[0].ExitedAt())
|
||||
}()
|
||||
|
||||
return nil
|
||||
@@ -152,7 +151,7 @@ func (c *container) Exec(ctx context.Context, opts plugin.ExecOpts) (plugin.Proc
|
||||
if err != nil {
|
||||
log.G(ctx).Debug(err)
|
||||
}
|
||||
c.sendEvent(c.ctr.ID(), containerd.ExitEvent, p.Pid(), ec, p.ExitedAt())
|
||||
c.sendEvent(c.ctr.ID(), plugin.ExitEvent, p.Pid(), ec, p.ExitedAt())
|
||||
}()
|
||||
|
||||
return &process{p}, nil
|
||||
@@ -188,6 +187,10 @@ func (c *container) Processes(ctx context.Context) ([]uint32, error) {
|
||||
return pids, nil
|
||||
}
|
||||
|
||||
func (c *container) Checkpoint(ctx context.Context, opts plugin.CheckpointOpts) error {
|
||||
return fmt.Errorf("Windows containers do not support checkpoint")
|
||||
}
|
||||
|
||||
func (c *container) setStatus(status plugin.Status) {
|
||||
c.Lock()
|
||||
c.status = status
|
||||
|
Reference in New Issue
Block a user