Implement checkpoint / restore for shim

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-02-01 15:07:02 -08:00
parent 835f3b6a97
commit 277cc920a4
8 changed files with 258 additions and 93 deletions

View file

@ -11,13 +11,25 @@ import (
"github.com/docker/containerd/util"
)
var fexec bool
var (
fexec bool
fcheckpoint string
)
func init() {
flag.BoolVar(&fexec, "exec", false, "exec a process instead of starting the init")
flag.StringVar(&fcheckpoint, "checkpoint", "", "start container from an existing checkpoint")
flag.Parse()
}
func setupLogger() {
f, err := os.OpenFile("/tmp/shim.log", os.O_CREATE|os.O_RDWR|os.O_APPEND, 0755)
if err != nil {
panic(err)
}
logrus.SetOutput(f)
}
// containerd-shim is a small shim that sits in front of a runc implementation
// that allows it to be repartented to init and handle reattach from the caller.
//
@ -38,7 +50,7 @@ func main() {
logrus.WithField("error", err).Fatal("shim: open exit pipe")
}
defer f.Close()
p, err := newProcess(flag.Arg(0), flag.Arg(1), fexec)
p, err := newProcess(flag.Arg(0), flag.Arg(1), fexec, fcheckpoint)
if err != nil {
logrus.WithField("error", err).Fatal("shim: create new process")
}