Cleanup: move image depth checks in image/

Signed-off-by: Solomon Hykes <solomon@docker.com>
This commit is contained in:
Solomon Hykes
2014-08-15 00:43:12 +00:00
parent 5a1e4a1092
commit 2a39635d30
3 changed files with 22 additions and 19 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ func (daemon *Daemon) Create(config *runconfig.Config, name string) (*Container,
if err != nil {
return nil, nil, err
}
if err := daemon.checkImageDepth(img); err != nil {
if err := img.CheckDepth(); err != nil {
return nil, nil, err
}
if warnings, err = daemon.mergeAndVerifyConfig(config, img); err != nil {
-18
View File
@@ -39,11 +39,6 @@ import (
"github.com/docker/docker/utils"
)
// Set the max depth to the aufs default that most
// kernels are compiled with
// For more information see: http://sourceforge.net/p/aufs/aufs3-standalone/ci/aufs3.12/tree/config.mk
const MaxImageDepth = 127
var (
DefaultDns = []string{"8.8.8.8", "8.8.4.4"}
validContainerNameChars = `[a-zA-Z0-9_.-]`
@@ -388,19 +383,6 @@ func (daemon *Daemon) restore() error {
return nil
}
func (daemon *Daemon) checkImageDepth(img *image.Image) error {
// We add 2 layers to the depth because the container's rw and
// init layer add to the restriction
depth, err := img.Depth()
if err != nil {
return err
}
if depth+2 >= MaxImageDepth {
return fmt.Errorf("Cannot create container with more than %d parents", MaxImageDepth)
}
return nil
}
func (daemon *Daemon) checkDeprecatedExpose(config *runconfig.Config) bool {
if config != nil {
if config.PortSpecs != nil {