Refactor selectHost in generic_scheduler

This commit is contained in:
Claire Li 2014-11-05 21:26:25 -08:00
parent 3b1ef739d1
commit 415ac3bf8a

View File

@ -49,10 +49,10 @@ func (g *genericScheduler) Schedule(pod api.Pod, minionLister MinionLister) (str
if len(priorityList) == 0 {
return "", fmt.Errorf("failed to find a fit for pod: %v", pod)
}
return g.selectHost(priorityList)
return g.selectHost(priorityList), nil
}
func (g *genericScheduler) selectHost(priorityList HostPriorityList) (string, error) {
func (g *genericScheduler) selectHost(priorityList HostPriorityList) string {
sort.Sort(priorityList)
hosts := getMinHosts(priorityList)
@ -60,7 +60,7 @@ func (g *genericScheduler) selectHost(priorityList HostPriorityList) (string, er
defer g.randomLock.Unlock()
ix := g.random.Int() % len(hosts)
return hosts[ix], nil
return hosts[ix]
}
func findNodesThatFit(pod api.Pod, podLister PodLister, predicates []FitPredicate, nodes api.MinionList) (api.MinionList, error) {