fix: Fix that fail to create vm with unforced instance group

1. This is a bug because of latest modify about scheduler's instance_group_predicate.
Should set minFree as zero when founding that host can't be used to create vm
with requested forced instance group.
2. Fix some little error of instance group.
3. Add PerformEnable and PerformDisable for instance group.
4. Clean scheduler desc cache after having attached or detached guests and groups
and enabled group. Cleaning was necessary when disable group because disabled
group is prohibited.
5. Add package 'golang.org/x/sync/errgroup'.
This commit is contained in:
郑雨
2019-11-07 15:35:51 +08:00
parent 77d722ee45
commit b59a145184
10 changed files with 250 additions and 29 deletions
@@ -78,6 +78,7 @@ func (p *SForcedGroupPredicate) Execute(u *core.Unit, c core.Candidater) (bool,
h.AppendPredicateFailMsg(fmt.Sprintf(
"the number of guests with same instance group '%s' in this host has reached the upper limit",
instanceGroups[id].GetName()))
minFree = 0
break
}
} else {
@@ -87,10 +88,6 @@ func (p *SForcedGroupPredicate) Execute(u *core.Unit, c core.Candidater) (bool,
minFree = free
}
}
// show that minFree shoule be zero
if minFree == math.MaxInt32 {
minFree = 0
}
// chose the min capacity of groups
h.SetCapacity(int64(minFree))
return h.GetResult()