From 05345f917d8d7ce860d603bb0f34b27cebd69ab5 Mon Sep 17 00:00:00 2001 From: yuanruji Date: Tue, 22 Oct 2024 09:25:26 +0800 Subject: [PATCH] 333 --- dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py b/dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py index 13e0f4ca2c..2333aab87a 100644 --- a/dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py +++ b/dbm-ui/backend/flow/utils/mysql/mysql_db_meta.py @@ -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, @@ -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):