集群DNS设置中增加”包含Ln节点“选项

This commit is contained in:
刘祥超
2022-08-25 19:18:30 +08:00
parent 4cb9c85a1c
commit df9dce76cb
8 changed files with 65 additions and 51 deletions

View File

@@ -1403,7 +1403,7 @@ func (this *NodeDAO) CountAllEnabledNodesWithRegionId(tx *dbs.Tx, regionId int64
}
// FindAllEnabledNodesDNSWithClusterId 获取一个集群的节点DNS信息
func (this *NodeDAO) FindAllEnabledNodesDNSWithClusterId(tx *dbs.Tx, clusterId int64, includeSecondaryNodes bool) (result []*Node, err error) {
func (this *NodeDAO) FindAllEnabledNodesDNSWithClusterId(tx *dbs.Tx, clusterId int64, includeSecondaryNodes bool, includingLnNodes bool) (result []*Node, err error) {
if clusterId <= 0 {
return nil, nil
}
@@ -1415,6 +1415,9 @@ func (this *NodeDAO) FindAllEnabledNodesDNSWithClusterId(tx *dbs.Tx, clusterId i
} else {
query.Attr("clusterId", clusterId)
}
if !includingLnNodes {
query.Lte("level", 1)
}
_, err = query.
State(NodeStateEnabled).
Attr("isOn", true).