From 9e13811650f5dc15990a19bde0e01f04685475fa Mon Sep 17 00:00:00 2001 From: nitishkrishna Date: Mon, 29 Aug 2016 16:14:29 -0700 Subject: [PATCH] Closes-Bug: #1618249 - SM Monitoring has some bugs in show, processing If some server is not there in the full list, show all monitoring info fails. Also for some servers, the disk processing fails due to wrong if condition Change-Id: I2f024bb7fe6ca3032f8c4241e86367a7790c4dc1 --- src/server_mgr_ipmi_monitoring.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/server_mgr_ipmi_monitoring.py b/src/server_mgr_ipmi_monitoring.py index 156dd64d..f29203f7 100644 --- a/src/server_mgr_ipmi_monitoring.py +++ b/src/server_mgr_ipmi_monitoring.py @@ -349,7 +349,7 @@ def fetch_and_process_disk_info(self, hostname, ip, sshclient): for line in fileoutput: if line is not None: - if line.find('sd') != -1 or line.find('dm') != -1: + if (line.find('sd') != -1 or line.find('dm') != -1) and line.find('Linux')!=0: disk_data = Disk() disk_data_tot = Disk_totals() prev_disk_info = Disk_totals() @@ -715,13 +715,18 @@ def get_monitoring_info(self): return_dict = dict() return_dict["name"] = str(server['id']) return_dict["cluster_id"] = server['cluster_id'] - main_dict = self.filter_monitoring_results( - parsed_data_dict[str(server['id'])], - ret_data["type"]) - summary_dict = self.filter_monitoring_results( - sum_parsed_data_dict[str(server['id'])], - ret_data["type"] - ) + if str(server['id']) in parsed_data_dict.keys(): + main_dict = self.filter_monitoring_results( + parsed_data_dict[str(server['id'])], + ret_data["type"]) + else: + main_dict = {} + if str(server['id']) in sum_parsed_data_dict.keys(): + summary_dict = self.filter_monitoring_results( + sum_parsed_data_dict[str(server['id'])], + ret_data["type"]) + else: + summary_dict = {} for summary_key in summary_dict: main_dict[str(summary_key)] = summary_dict[summary_key] return_dict[str(uve_name)] = main_dict