Skip to content

Commit

Permalink
333
Browse files Browse the repository at this point in the history
  • Loading branch information
ymakedaq committed Oct 22, 2024
1 parent c7d412d commit 05345f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -789,7 +789,8 @@ def ro_slave_recover_del_instance(self):
for cluster_id in self.cluster["cluster_ids"]:
cluster = Cluster.objects.get(id=cluster_id)
master = cluster.main_storage_instances()[0]
old_slave = cluster.storageinstance_set.get(machine__ip=self.cluster["uninstall_ip"], port=master.port)
ro_slave_ip = self.cluster["uninstall_ip"]
old_slave = cluster.storageinstance_set.get(machine__ip=ro_slave_ip, port=master.port)
api.cluster.tendbha.remove_storage_tuple(
master_ip=master.machine.ip,
slave_ip=old_slave.machine.ip,
Expand All @@ -811,11 +812,11 @@ def ro_slave_recover_del_instance(self):
]
)
if not StorageInstance.objects.filter(
machine__ip=self.cluster["uninstall_ip"], machine__bk_cloud_id=cluster.bk_cloud_id
machine__ip=ro_slave_ip, machine__bk_cloud_id=cluster.bk_cloud_id
).exists():
api.machine.delete(machines=[self.cluster["uninstall_ip"]], bk_cloud_id=cluster.bk_cloud_id)
api.machine.delete(machines=[ro_slave_ip], bk_cloud_id=cluster.bk_cloud_id)
# 删除cluster entry
for ce in ClusterEntry.objects.filter(cluster=cluster).all():
for ce in ClusterEntry.objects.filter(storageinstance__machine__ip=ro_slave_ip).all():
ce.delete(keep_parents=True)

def update_upgrade_slaves_dbmodule(self):
Expand Down

0 comments on commit 05345f9

Please sign in to comment.