diff --git a/core.py b/core.py index abfd1d5e..9fa7144c 100644 --- a/core.py +++ b/core.py @@ -323,6 +323,7 @@ def analyze_fuction(self, function_type, opt): self.set_context(function_type, 'analyze', config) handler = AnalyzeIndexSpaceHandler(self.context) handler.handle() + return ObdiagResult(ObdiagResult.SUCCESS_CODE, data=handler.execute()) else: self._call_stdio('error', 'Not support analyze function: {0}'.format(function_type)) return ObdiagResult(ObdiagResult.INPUT_ERROR_CODE, error_data='Not support analyze function: {0}'.format(function_type)) diff --git a/handler/analyzer/analyze_index_space.py b/handler/analyzer/analyze_index_space.py index 4d010e05..2e202898 100644 --- a/handler/analyzer/analyze_index_space.py +++ b/handler/analyzer/analyze_index_space.py @@ -144,10 +144,6 @@ def handle(self): node_result_map["estimated_index_space"] = target_server_estimated_index_size node_result_map["available_disk_space"] = available_disk_space self.result_map_list.append(node_result_map) - # if target_server_estimated_index_size > available_disk_space: - # self.stdio.print("the disk space of server({0}:{1}) disk is not enough. please add the server disk".format(target_server_ip, target_server_port)) - # else: - # self.stdio.print("the disk space of server({0}:{1}) is enough. Don't warn. If there are still errors, please contact the OceanBase community.".format(target_server_ip, target_server_port)) self.export_report_table() except Exception as e: self.stdio.verbose("analyze index space error: {0}".format(e)) @@ -155,6 +151,11 @@ def handle(self): finally: self.stdio.verbose("end analyze index space") + def execute(self): + result_map = {} + result_map["result"] = self.result_map_list + return result_map + def export_report_table(self): try: report_index_space_tb = PrettyTable(["ip", "port", "estimated_index_space", "available_disk_space"])