fix: scheduler network predicate not set capability when host filtered (#279)

This commit is contained in:
Zexi Li
2019-04-08 22:35:41 +08:00
committed by yunion-ci-robot
parent a7a672bf6c
commit 886c66bc67
2 changed files with 4 additions and 4 deletions
@@ -109,7 +109,7 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
filterByRandomNetwork := func() {
if err_msg := isRandomNetworkAvailable(false, false, ""); err_msg != "" {
h.AppendPredicateFailMsg(err_msg)
h.Exclude(err_msg)
}
h.SetCapacityCounter(counters)
}
@@ -138,7 +138,7 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
}
if len(errMsgs) > 0 {
h.AppendPredicateFailMsg(strings.Join(errMsgs, ", "))
h.Exclude(strings.Join(errMsgs, ", "))
}
}
@@ -140,7 +140,7 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
filterByRandomNetwork := func() {
counters := core.NewCounters()
if err_msg := isRandomNetworkAvailable(false, false, "", counters); err_msg != "" {
h.AppendPredicateFailMsg(err_msg)
h.Exclude(err_msg)
}
h.SetCapacityCounter(counters)
}
@@ -202,7 +202,7 @@ func (p *NetworkPredicate) Execute(u *core.Unit, c core.Candidater) (bool, []cor
}
if len(errMsgs) > 0 {
h.AppendPredicateFailMsg(strings.Join(errMsgs, ", "))
h.Exclude(strings.Join(errMsgs, ", "))
} else {
h.SetCapacityCounter(counters)
}