Skip to content

Commit

Permalink
fix: 故障后迁移standby从库域名的获取 TencentBlueKing#8608
Browse files Browse the repository at this point in the history
  • Loading branch information
zfrendo committed Dec 16, 2024
1 parent dcd8a47 commit 473d8d6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
13 changes: 7 additions & 6 deletions dbm-ui/backend/db_meta/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ def update_cluster_status(sender, instance: Union[StorageInstance, ProxyInstance
if kwargs.get("signal") == pre_delete and not isinstance(instance, Cluster):
# 提前删除实例与cluster的关联关系
cluster = instance.cluster.first()
trigger_operate_collector(
ClusterType.cluster_type_to_db_type(cluster.cluster_type),
instance.machine_type,
bk_instance_ids=[instance.bk_instance_id],
action=OperateCollectorActionEnum.INSTALL.value,
)
if cluster:
trigger_operate_collector(
ClusterType.cluster_type_to_db_type(cluster.cluster_type),
instance.machine_type,
bk_instance_ids=[instance.bk_instance_id],
action=OperateCollectorActionEnum.INSTALL.value,
)
if cluster and sender == StorageInstance:
cluster.storageinstance_set.remove(instance)
elif cluster and sender == ProxyInstance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def tendb_ha_restore_slave_flow(self):
# cluster = {"uninstall_ip": self.data["old_slave_ip"], "cluster_ids": self.data["cluster_ids"]}
cluster = {
"uninstall_ip": self.data["old_slave_ip"],
"ports": [self.data["ports"]],
"ports": self.data["ports"],
"bk_cloud_id": cluster_class.bk_cloud_id,
"cluster_type": cluster_class.cluster_type,
}
Expand Down
7 changes: 4 additions & 3 deletions dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,14 +1039,15 @@ def uninstall_instance(self):
machine__bk_cloud_id=self.cluster["bk_cloud_id"],
port=port,
)
cc_manage = CcManage(storage.bk_biz_id, cluster_type=self.cluster["cluster_type"])
cc_manage = CcManage(storage.bk_biz_id, cluster_type=storage.cluster_type)
cc_manage.delete_service_instance(bk_instance_ids=[storage.bk_instance_id])
storage.cluster.first()
storage.delete()

if not StorageInstance.objects.filter(
machine__ip=self.cluster["uninstall_ip"], machine__bk_cloud_id=self.cluster["bk_cloud_id"]
machine__ip=storage.machine.ip, machine__bk_cloud_id=storage.machine.bk_cloud_id
).exists():
api.machine.delete(machines=[self.cluster["uninstall_ip"]], bk_cloud_id=self.cluster["bk_cloud_id"])
api.machine.delete(machines=[storage.machine.ip], bk_cloud_id=storage.machine.bk_cloud_id)

def update_proxy_instance_version(self):
"""
Expand Down

0 comments on commit 473d8d6

Please sign in to comment.