Skip to content

Commit

Permalink
fix(backend): 资源申请同城同园区补充include_or_exclue参数 TencentBlueKing#9186
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 29768
  • Loading branch information
ygcyao committed Jan 22, 2025
1 parent 2d28eb4 commit 4f44956
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dbm-ui/backend/ticket/builders/__init__.py
Original file line number Diff line number Diff line change
@@ -244,7 +244,7 @@ def patch_affinity_location(cls, cluster, resource_spec, roles=None):
节点变更的时候,补充亲和性和位置参数
"""
bk_sub_zone_id = None
# 同城同园区集群的园区id处理
# 资源申请同城同园区条件:补充园区id, 且需传include_or_exclude=True来指定申请的园区,如不传nclude_or_exclude参数,默认视为排除该园区
if cluster.disaster_tolerance_level in [AffinityEnum.SAME_SUBZONE, AffinityEnum.SAME_SUBZONE_CROSS_SWTICH]:
bk_sub_zone_id = cluster.storageinstance_set.first().machine.bk_sub_zone_id

@@ -254,6 +254,7 @@ def patch_affinity_location(cls, cluster, resource_spec, roles=None):
resource_spec[role]["location_spec"] = {
"city": cluster.region,
"sub_zone_ids": [bk_sub_zone_id] if bk_sub_zone_id else [],
**({"include_or_exclude": True} if bk_sub_zone_id else {}),
}


Original file line number Diff line number Diff line change
@@ -119,7 +119,7 @@ def patch_ticket_detail(self):
continue

if role in [InstanceRole.REDIS_MASTER.value, InstanceRole.REDIS_PROXY.value]:
# 同城同园区集群的园区id处理
# 资源申请同城同园区条件:补充园区id, 且需传include_or_exclude=True来指定申请的园区,如不传nclude_or_exclude参数,默认视为排除该园区
bk_sub_zone_id = None
if cluster.disaster_tolerance_level in [
AffinityEnum.SAME_SUBZONE,
@@ -135,6 +135,7 @@ def patch_ticket_detail(self):
"location_spec": {
"city": cluster.region,
"sub_zone_ids": [bk_sub_zone_id] if bk_sub_zone_id else [],
**({"include_or_exclude": True} if bk_sub_zone_id else {}),
},
"affinity": cluster.disaster_tolerance_level,
}

0 comments on commit 4f44956

Please sign in to comment.