|
@@ -5,9 +5,7 @@ import (
|
|
|
"fmt"
|
|
|
"github.com/dotcloud/docker/utils"
|
|
|
"io"
|
|
|
- "log"
|
|
|
"os"
|
|
|
- "runtime"
|
|
|
"sort"
|
|
|
"strings"
|
|
|
)
|
|
@@ -37,7 +35,6 @@ func unregister(name string) {
|
|
|
// It acts as a store for *containers*, and allows manipulation of these
|
|
|
// containers by executing *jobs*.
|
|
|
type Engine struct {
|
|
|
- root string
|
|
|
handlers map[string]Handler
|
|
|
hack Hack // data for temporary hackery (see hack.go)
|
|
|
id string
|
|
@@ -47,10 +44,6 @@ type Engine struct {
|
|
|
Logging bool
|
|
|
}
|
|
|
|
|
|
-func (eng *Engine) Root() string {
|
|
|
- return eng.root
|
|
|
-}
|
|
|
-
|
|
|
func (eng *Engine) Register(name string, handler Handler) error {
|
|
|
_, exists := eng.handlers[name]
|
|
|
if exists {
|
|
@@ -60,38 +53,9 @@ func (eng *Engine) Register(name string, handler Handler) error {
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
-// New initializes a new engine managing the directory specified at `root`.
|
|
|
-// `root` is used to store containers and any other state private to the engine.
|
|
|
-// Changing the contents of the root without executing a job will cause unspecified
|
|
|
-// behavior.
|
|
|
-func New(root string) (*Engine, error) {
|
|
|
- // Check for unsupported architectures
|
|
|
- if runtime.GOARCH != "amd64" {
|
|
|
- return nil, fmt.Errorf("The docker runtime currently only supports amd64 (not %s). This will change in the future. Aborting.", runtime.GOARCH)
|
|
|
- }
|
|
|
- // Check for unsupported kernel versions
|
|
|
- // FIXME: it would be cleaner to not test for specific versions, but rather
|
|
|
- // test for specific functionalities.
|
|
|
- // Unfortunately we can't test for the feature "does not cause a kernel panic"
|
|
|
- // without actually causing a kernel panic, so we need this workaround until
|
|
|
- // the circumstances of pre-3.8 crashes are clearer.
|
|
|
- // For details see http://github.com/dotcloud/docker/issues/407
|
|
|
- if k, err := utils.GetKernelVersion(); err != nil {
|
|
|
- log.Printf("WARNING: %s\n", err)
|
|
|
- } else {
|
|
|
- if utils.CompareKernelVersion(k, &utils.KernelVersionInfo{Kernel: 3, Major: 8, Minor: 0}) < 0 {
|
|
|
- if os.Getenv("DOCKER_NOWARN_KERNEL_VERSION") == "" {
|
|
|
- log.Printf("WARNING: You are running linux kernel version %s, which might be unstable running docker. Please upgrade your kernel to 3.8.0.", k.String())
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if err := os.MkdirAll(root, 0700); err != nil && !os.IsExist(err) {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
+// New initializes a new engine.
|
|
|
+func New() (*Engine, error) {
|
|
|
eng := &Engine{
|
|
|
- root: root,
|
|
|
handlers: make(map[string]Handler),
|
|
|
id: utils.RandomString(),
|
|
|
Stdout: os.Stdout,
|
|
@@ -113,7 +77,7 @@ func New(root string) (*Engine, error) {
|
|
|
}
|
|
|
|
|
|
func (eng *Engine) String() string {
|
|
|
- return fmt.Sprintf("%s|%s", eng.Root(), eng.id[:8])
|
|
|
+ return fmt.Sprintf("%s", eng.id[:8])
|
|
|
}
|
|
|
|
|
|
// Commands returns a list of all currently registered commands,
|