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):