Fix compilation for all tags

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
Alexander Morozov 2015-12-07 12:38:31 -08:00
parent 59093a22d0
commit 18d01f19e4
4 changed files with 39 additions and 5 deletions

View File

@ -63,7 +63,7 @@ var StartCommand = cli.Command{
fatal("container id cannot be empty", 1)
}
c := v1.NewClient(context.GlobalString("addr"))
if err := c.Start(id, path); err != nil {
if err := c.Start(id, path, ""); err != nil {
fatal(err.Error(), 1)
}
},
@ -89,7 +89,7 @@ var KillCommand = cli.Command{
fatal("container id cannot be empty", 1)
}
c := v1.NewClient(context.GlobalString("addr"))
if err := c.Signal(id, context.Int("pid"), context.Int("signal")); err != nil {
if err := c.SignalProcess(id, context.Int("pid"), context.Int("signal")); err != nil {
fatal(err.Error(), 1)
}
},

View File

@ -4,6 +4,7 @@ package runc
import (
"encoding/json"
"errors"
"io/ioutil"
"os"
"os/exec"
@ -86,6 +87,26 @@ func (c *runcContainer) Pause() error {
return c.newCommand("pause").Run()
}
// TODO: pass arguments
func (c *runcContainer) Checkpoint(runtime.Checkpoint) error {
return c.newCommand("checkpoint").Run()
}
// TODO: pass arguments
func (c *runcContainer) Restore(cp string) error {
return c.newCommand("restore").Run()
}
// TODO: pass arguments
func (c *runcContainer) DeleteCheckpoint(cp string) error {
return errors.New("not implemented")
}
// TODO: implement in runc
func (c *runcContainer) Checkpoints() ([]runtime.Checkpoint, error) {
return nil, errors.New("not implemented")
}
func (c *runcContainer) newCommand(args ...string) *exec.Cmd {
cmd := exec.Command("runc", append([]string{"--root", c.stateDir, "--id", c.id}, args...)...)
cmd.Dir = c.path

12
supervisor_runc.go Normal file
View File

@ -0,0 +1,12 @@
// +build runc
package containerd
import (
"github.com/docker/containerd/runc"
"github.com/docker/containerd/runtime"
)
func newRuntime(stateDir string) (runtime.Runtime, error) {
return runc.NewRuntime(stateDir)
}

View File

@ -1,12 +1,13 @@
// +build !libcontainer
// +build !libcontainer,!runc
package containerd
import (
"github.com/docker/containerd/runc"
"errors"
"github.com/docker/containerd/runtime"
)
func newRuntime(stateDir string) (runtime.Runtime, error) {
return runc.NewRuntime(stateDir)
return nil, errors.New("unsupported platform")
}