mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
loadbalancer sync remove backend group
This commit is contained in:
@@ -977,6 +977,10 @@ func (lbbg *SLoadbalancerBackendGroup) syncRemoveCloudLoadbalancerBackendgroup(c
|
||||
lockman.LockObject(ctx, lbbg)
|
||||
defer lockman.ReleaseObject(ctx, lbbg)
|
||||
|
||||
if lbbg.GetProviderName() == api.CLOUD_PROVIDER_GOOGLE {
|
||||
return nil
|
||||
}
|
||||
|
||||
err := lbbg.ValidateDeleteCondition(ctx, nil)
|
||||
if err != nil { // cannot delete
|
||||
err = lbbg.SetStatus(userCred, api.LB_STATUS_UNKNOWN, "sync to delete")
|
||||
|
||||
@@ -1134,7 +1134,8 @@ func (lblis *SLoadbalancerListener) constructFieldsFromCloudListener(userCred mc
|
||||
lblis.BackendGroupId = lb.BackendGroupId
|
||||
} else if group, err := db.FetchByExternalIdAndManagerId(LoadbalancerBackendGroupManager, groupId, func(q *sqlchemy.SQuery) *sqlchemy.SQuery {
|
||||
sq := LoadbalancerManager.Query().SubQuery()
|
||||
return q.Join(sq, sqlchemy.Equals(sq.Field("id"), q.Field("loadbalancer_id"))).Filter(sqlchemy.Equals(sq.Field("manager_id"), lb.ManagerId))
|
||||
q = q.Join(sq, sqlchemy.Equals(sq.Field("id"), q.Field("loadbalancer_id"))).Filter(sqlchemy.Equals(sq.Field("manager_id"), lb.ManagerId))
|
||||
return q.IsFalse("pending_deleted")
|
||||
}); err == nil {
|
||||
lblis.BackendGroupId = group.GetId()
|
||||
}
|
||||
|
||||
@@ -659,11 +659,10 @@ func (self *SLoadbalancer) GetInstanceGroups() ([]SInstanceGroup, error) {
|
||||
if fs, ok := zonesFilter[zoneId]; ok {
|
||||
f := fmt.Sprintf(`(selfLink="%s")`, ig)
|
||||
if !utils.IsInStringArray(f, fs) {
|
||||
fs = append(fs, f)
|
||||
zonesFilter[zoneId] = append(fs, f)
|
||||
}
|
||||
} else {
|
||||
fs = []string{fmt.Sprintf(`(selfLink="%s")`, ig)}
|
||||
zonesFilter[zoneId] = fs
|
||||
zonesFilter[zoneId] = []string{fmt.Sprintf(`(selfLink="%s")`, ig)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,6 +232,10 @@ func (self *SLoadbalancerListener) GetStickySessionCookie() string {
|
||||
}
|
||||
|
||||
func (self *SLoadbalancerListener) GetStickySessionCookieTimeout() int {
|
||||
if len(self.backendService.ConsistentHash.HTTPCookie.TTL.Seconds) == 0 {
|
||||
return 0
|
||||
}
|
||||
|
||||
sec, err := strconv.Atoi(self.backendService.ConsistentHash.HTTPCookie.TTL.Seconds)
|
||||
if err != nil {
|
||||
log.Debugf("GetStickySessionCookieTimeout %s", err)
|
||||
|
||||
Reference in New Issue
Block a user