Skip to content

Commit

Permalink
feat: sqlserver添加服务实例兼容信息丢夫的场景 TencentBlueKing#6659
Browse files Browse the repository at this point in the history
  • Loading branch information
yksitu committed Sep 6, 2024
1 parent a7609c8 commit 5ec3e48
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions dbm-ui/backend/db_meta/api/cluster/sqlserverha/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,11 @@ def switch_role(cls, cluster_ids: list, old_master: Host, new_master: Host, is_f
slave_entry.storageinstance_set.remove(new_master_storage_objs)
slave_entry.storageinstance_set.add(old_master_storage_objs)

cc_manage = CcManage(cluster.bk_biz_id, cluster.cluster_type)
# 切换新master服务实例角色标签
cc_manage.add_label_for_service_instance(
bk_instance_ids=[new_master_storage_objs.bk_instance_id],
labels_dict={"instance_role": InstanceRole.BACKEND_MASTER.value},
)

# 切换新slave服务实例角色标签
cc_manage.add_label_for_service_instance(
bk_instance_ids=[old_master_storage_objs.bk_instance_id],
labels_dict={"instance_role": InstanceRole.BACKEND_SLAVE.value},
cc_topo_operator = SqlserverCCTopoOperator(cluster)
cc_topo_operator.is_bk_module_created = True
cc_topo_operator.transfer_instances_to_cluster_module(
instances=[new_master_storage_objs, old_master_storage_objs],
is_increment=True,
)

@classmethod
Expand Down

0 comments on commit 5ec3e48

Please sign in to comment.