Move libcontainer to linux pkg

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2015-12-01 12:00:11 -08:00
parent c24abdde1b
commit b823ce9149
4 changed files with 18 additions and 10 deletions

View File

@ -13,11 +13,9 @@ var (
ErrUnknownEvent = errors.New("containerd: unknown event type")
// Internal errors
errShutdown = errors.New("containerd: supervisor is shutdown")
errRootNotAbs = errors.New("containerd: rootfs path is not an absolute path")
errNoContainerForPid = errors.New("containerd: pid not registered for any container")
errInvalidContainerType = errors.New("containerd: invalid container type for runtime")
errNotChildProcess = errors.New("containerd: not a child process for container")
errShutdown = errors.New("containerd: supervisor is shutdown")
errRootNotAbs = errors.New("containerd: rootfs path is not an absolute path")
errNoContainerForPid = errors.New("containerd: pid not registered for any container")
// internal error where the handler will defer to another for the final response
//
// TODO: we could probably do a typed error with another error channel for this to make it

View File

@ -1,6 +1,6 @@
// +build libcontainer
package containerd
package linux
import (
"encoding/json"
@ -254,7 +254,7 @@ func (c *libcontainerContainer) Processes() ([]runtime.Process, error) {
func (c *libcontainerContainer) RemoveProcess(pid int) error {
if _, ok := c.additionalProcesses[pid]; !ok {
return errNotChildProcess
return runtime.ErrNotChildProcess
}
delete(c.additionalProcesses, pid)
return nil
@ -312,7 +312,7 @@ func (r *libcontainerRuntime) Create(id, bundlePath string, stdio *runtime.Stdio
func (r *libcontainerRuntime) StartProcess(ci runtime.Container, p specs.Process, stdio *runtime.Stdio) (runtime.Process, error) {
c, ok := ci.(*libcontainerContainer)
if !ok {
return nil, errInvalidContainerType
return nil, runtime.ErrInvalidContainerType
}
process, err := r.newProcess(p, stdio)
if err != nil {

View File

@ -1,6 +1,15 @@
package runtime
import "github.com/opencontainers/specs"
import (
"errors"
"github.com/opencontainers/specs"
)
var (
ErrNotChildProcess = errors.New("containerd: not a child process for container")
ErrInvalidContainerType = errors.New("containerd: invalid container type for runtime")
)
// runtime handles containers, containers handle their own actions.
type Runtime interface {

View File

@ -8,6 +8,7 @@ import (
"time"
"github.com/Sirupsen/logrus"
"github.com/docker/containerd/linux"
"github.com/docker/containerd/runtime"
"github.com/opencontainers/runc/libcontainer"
)
@ -18,7 +19,7 @@ func NewSupervisor(stateDir string, concurrency int) (*Supervisor, error) {
return nil, err
}
// register counters
r, err := NewRuntime(stateDir)
r, err := linux.NewRuntime(stateDir)
if err != nil {
return nil, err
}