func (s *segregatedScheduler) chooseNodeToAdd(nodes []cluster.Node, contName string, appName, process string) (string, error) {
	log.Debugf("[scheduler] Possible nodes for container %s: %#v", contName, nodes)
	s.hostMutex.Lock()
	defer s.hostMutex.Unlock()
	chosenNode, _, err := s.minMaxNodes(nodes, appName, process)
	if err != nil {
		return "", err
	}
	log.Debugf("[scheduler] Chosen node for container %s: %#v", contName, chosenNode)
	if contName != "" {
		coll := s.provisioner.Collection()
		defer coll.Close()
		err = coll.Update(bson.M{"name": contName}, bson.M{"$set": bson.M{"hostaddr": net.URLToHost(chosenNode)}})
	}
	return chosenNode, err
}
func (s *segregatedScheduler) chooseNodeToAdd(nodes []cluster.Node, contName string, appName, process string) (string, error) {
	log.Debugf("[scheduler] Possible nodes for container %s: %#v", contName, nodes)
	s.hostMutex.Lock()
	defer s.hostMutex.Unlock()
	chosenNode, _, err := s.minMaxNodes(nodes, appName, process)
	if err != nil {
		return "", err
	}
	log.Debugf("[scheduler] Chosen node for container %s: %#v", contName, chosenNode)
	if contName != "" {
		coll := s.provisioner.Collection()
		defer coll.Close()
		err = coll.Update(bson.M{"name": contName}, bson.M{"$set": bson.M{"hostaddr": net.URLToHost(chosenNode)}})
	}
	return chosenNode, err
}
func ( s * segregatedScheduler ) chooseNodeToAdd ( nodes [ ] cluster . Node , contName string , appName , process string ) ( string , error ) { log . Debugf ( " " , contName , nodes ) s . hostMutex . Lock ( ) defer s . hostMutex . Unlock ( ) chosenNode , _ , err := s . minMaxNodes ( nodes , appName , process ) if err != nil { return " " , err } log . Debugf ( " " , contName , chosenNode ) if contName != " " { coll := s . provisioner . Collection ( ) defer coll . Close ( ) err = coll . Update ( bson . M { " " : contName } , bson . M { " " : bson . M { " " : net . URLToHost ( chosenNode ) } } ) } return chosenNode , err }
// chooseNodeToAdd finds which is the node with the minimum number of containers
// and returns it
chooseNodeToAdd finds which is the node with the minimum number of containers and returns it