Skip to content

Commit

Permalink
Traceback during update of local preference
Browse files Browse the repository at this point in the history
Traceback seen during update of local preference because of
service template object not read from config_db.

Handle exceptions for rabbit message gevent thread. This was
causing the greenlet to exit.

Change-Id: Ie67225e5e09932af68be20aba49c01094899e1df
Closes-Bug: #1463477
Closes-Bug: #1463091
  • Loading branch information
rrugge committed Jun 9, 2015
1 parent 3b996d2 commit e295985
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/config/svc-monitor/svc_monitor/instance_manager.py
Expand Up @@ -473,6 +473,9 @@ def _associate_vrouter(self, si, vm):
def _update_local_preference(self, si, del_vm):
if si.ha_mode != 'active-standby':
return
st = ServiceTemplateSM.get(si.service_template)
if not st:
return

if si.local_preference[del_vm.index] == \
svc_info.get_standby_preference():
Expand Down
18 changes: 10 additions & 8 deletions src/config/svc-monitor/svc_monitor/svc_monitor.py
Expand Up @@ -198,6 +198,12 @@ def config_log(self, msg, level):

def _vnc_subscribe_callback(self, oper_info):
self._db_resync_done.wait()
try:
self._vnc_subscribe_actions(oper_info)
except Exception:
cgitb_error_log(self)

def _vnc_subscribe_actions(self, oper_info):
try:
msg = "Notification Message: %s" % (pformat(oper_info))
self.config_log(msg, level=SandeshLevel.SYS_DEBUG)
Expand Down Expand Up @@ -237,11 +243,8 @@ def _vnc_subscribe_callback(self, oper_info):
obj_type, obj_id))
return


except Exception:
string_buf = cStringIO.StringIO()
cgitb.Hook(file=string_buf, format="text").handle(sys.exc_info())
self.config_log(string_buf.getvalue(), level=SandeshLevel.SYS_ERR)
cgitb_error_log(self)

for sas_id in dependency_tracker.resources.get('service_appliance_set', []):
sas_obj = ServiceApplianceSetSM.get(sas_id)
Expand Down Expand Up @@ -791,10 +794,9 @@ def launch_timer(monitor):
cgitb_error_log(monitor)

def cgitb_error_log(monitor):
tmp_file = cStringIO.StringIO()
cgitb.Hook(format="text", file=tmp_file).handle(sys.exc_info())
monitor._svc_err_logger.error("%s" % tmp_file.getvalue())
tmp_file.close()
string_buf = cStringIO.StringIO()
cgitb.Hook(file=string_buf, format="text").handle(sys.exc_info())
monitor.config_log(string_buf.getvalue(), level=SandeshLevel.SYS_ERR)

def parse_args(args_str):
'''
Expand Down

0 comments on commit e295985

Please sign in to comment.