From: deepika.e Date: Mon, 3 Jun 2024 09:32:00 +0000 (+0530) Subject: Bug 2379: Fix for RO crashes when VIM is down X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=7b7b2d5076e8449fcaa9234dafd8c27c96b2ae58;p=osm%2FRO.git Bug 2379: Fix for RO crashes when VIM is down Added exception handling in monitor.py to ensure RO doesn't crash when a VIM is down Change-Id: I83e2b80085cfdb81d2406c19a4349214ed11035d Signed-off-by: deepika.e --- diff --git a/NG-RO/osm_ng_ro/monitor.py b/NG-RO/osm_ng_ro/monitor.py index 8099eb98..93bfa11f 100644 --- a/NG-RO/osm_ng_ro/monitor.py +++ b/NG-RO/osm_ng_ro/monitor.py @@ -875,8 +875,16 @@ class MonitorVms: self.prepare_vims_to_monitor(vims_to_monitor, ro_task, target_vim) for vim in vims_to_monitor: - all_servers, all_ports = self.my_vims[vim.vim_id].get_monitoring_data() - self.update_vnfrs(all_servers, all_ports, vim.vms) + try: + all_servers, all_ports = self.my_vims[ + vim.vim_id + ].get_monitoring_data() + self.update_vnfrs(all_servers, all_ports, vim.vms) + except (DbException, MonitorDbException) as e: + raise MonitorVmsException(str(e)) + except Exception as e: + self.logger.info("Exception in vim monitoring {}".format(e)) + continue except ( DbException, MonitorDbException, @@ -891,6 +899,8 @@ class MonitorVms: raise MonitorVmsException( f"Exception while monitoring Openstack VMs: {str(e)}" ) + except Exception as e: + self.logger.info("Exception in monitoring {}".format(e)) def start_monitoring(config: dict):