Skip to content

Commit

Permalink
fix(backend): redis 补充整机替换亲和性 TencentBlueKing#9192
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 29808
  • Loading branch information
ygcyao committed Jan 22, 2025
1 parent d50a6da commit 3e34b98
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions dbm-ui/backend/ticket/builders/redis/redis_toolbox_cut_off.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,24 @@ def patch_ticket_detail(self):
"count": 1,
"location_spec": {
"city": cluster.region,
"sub_zone_ids": [redis_master.machine.bk_sub_zone_id],
"include_or_exclue": False,
"sub_zone_ids": [],
},
"affinity": cluster.disaster_tolerance_level,
}

if resource_spec["affinity"] == AffinityEnum.CROS_SUBZONE:
resource_spec[f"{role}_{role_host['ip']}"]["location_spec"].update(
sub_zone_ids=[redis_master.machine.bk_sub_zone_id], include_or_exclue=False
)

elif resource_spec["affinity"] in [
AffinityEnum.SAME_SUBZONE,
AffinityEnum.SAME_SUBZONE_CROSS_SWTICH,
]:
resource_spec[f"{role}_{role_host['ip']}"]["location_spec"].update(
sub_zone_ids=[redis_master.machine.bk_sub_zone_id], include_or_exclue=True
)

info["resource_spec"] = resource_spec

self.ticket.save(update_fields=["details"])
Expand Down

0 comments on commit 3e34b98

Please sign in to comment.