prevent container scheduling without -c/-m

This commit is contained in:
Victor Vieux 2014-11-15 01:14:43 +00:00
parent 60a80c0c84
commit 42198c779e
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package scheduler
import (
"fmt"
"sync"
"github.com/docker/libcluster"
@ -45,6 +46,10 @@ func (s *Scheduler) CreateContainer(config *dockerclient.ContainerConfig, name s
s.Lock()
defer s.Unlock()
if config.Memory == 0 || config.CpuShares == 0 {
return nil, fmt.Errorf("Creating containers in clustering mode requires resource constraints (-c and -m) to be set")
}
node, err := s.selectNodeForContainer(config)
if err != nil {
return nil, err