瀏覽代碼

Merge pull request #13112 from hqhq/hq_fix_oonkilldisable

Fix oom kill disable issue
Brian Goff 10 年之前
父節點
當前提交
feb0fa8dbf
共有 2 個文件被更改,包括 4 次插入5 次删除
  1. 0 5
      daemon/create.go
  2. 4 0
      daemon/daemon.go

+ 0 - 5
daemon/create.go

@@ -24,11 +24,6 @@ func (daemon *Daemon) ContainerCreate(name string, config *runconfig.Config, hos
 		return "", warnings, fmt.Errorf("The working directory '%s' is invalid. It needs to be an absolute path.", config.WorkingDir)
 	}
 
-	if !daemon.SystemConfig().OomKillDisable {
-		hostConfig.OomKillDisable = false
-		return "", warnings, fmt.Errorf("Your kernel does not support oom kill disable.")
-	}
-
 	container, buildWarnings, err := daemon.Create(config, hostConfig, name)
 	if err != nil {
 		if daemon.Graph().IsNotExist(err, config.Image) {

+ 4 - 0
daemon/daemon.go

@@ -1177,6 +1177,10 @@ func (daemon *Daemon) verifyHostConfig(hostConfig *runconfig.HostConfig) ([]stri
 	if hostConfig.BlkioWeight > 0 && (hostConfig.BlkioWeight < 10 || hostConfig.BlkioWeight > 1000) {
 		return warnings, fmt.Errorf("Range of blkio weight is from 10 to 1000.")
 	}
+	if hostConfig.OomKillDisable && !daemon.SystemConfig().OomKillDisable {
+		hostConfig.OomKillDisable = false
+		return warnings, fmt.Errorf("Your kernel does not support oom kill disable.")
+	}
 
 	return warnings, nil
 }