Skip to content

Commit

Permalink
feat(backend): 监控集群下架时的信号处理问题 #8610
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Dec 13, 2024
1 parent 069bd08 commit bf29b69
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions dbm-ui/backend/db_meta/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ 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 and sender == StorageInstance:
cluster.storageinstance_set.remove(instance)
elif cluster and sender == ProxyInstance:
cluster.proxyinstance_set.remove(instance)
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 sender == StorageInstance:
cluster.storageinstance_set.remove(instance)
elif sender == ProxyInstance:
cluster.proxyinstance_set.remove(instance)

# 仅在实例状态变更时,同步更新集群状态
if isinstance(instance, Cluster):
Expand Down

0 comments on commit bf29b69

Please sign in to comment.