fix/autoscaling: fix some problem

1. ScalingGroupGuestManger.Query 默认添加 NotEqual(...)
2. ScalingGroup.Scale 扩大锁的粒度,更新冷却时间也挪到这里面
3. climc 中增加 scaling-group-show
This commit is contained in:
Rain
2020-04-26 14:06:50 +08:00
parent 74eef22025
commit 4d8e0ba1b4
7 changed files with 52 additions and 21 deletions

View File

@@ -514,7 +514,15 @@ func (asc *SASController) CreateInstances(
instanceMap[instane.ID] = instane
}
// check all server's status
go asc.checkAllServer(session, guestIds, retChan)
var waitLimit, waitinterval time.Duration
if sg.Hypervisor == compute.HYPERVISOR_KVM {
waitLimit = 5 * time.Minute
waitinterval = 3 * time.Second
} else {
waitLimit = 10 * time.Minute
waitinterval = 10 * time.Second
}
go asc.checkAllServer(session, guestIds, retChan, waitLimit, waitinterval)
// fourth stage: bind lb and db
failRecord := &SFailRecord{
@@ -558,10 +566,11 @@ type SCreateRet struct {
Status string
}
func (asc *SASController) checkAllServer(session *mcclient.ClientSession, guestIds []string, retChan chan SCreateRet) {
func (asc *SASController) checkAllServer(session *mcclient.ClientSession, guestIds []string, retChan chan SCreateRet,
waitLimit, waitInterval time.Duration) {
guestIDSet := sets.NewString(guestIds...)
ticker := time.NewTicker(3 * time.Second)
timer := time.NewTimer(5 * time.Minute)
timer := time.NewTimer(waitLimit)
ticker := time.NewTicker(waitInterval)
defer func() {
close(retChan)
ticker.Stop()