From 7709a52eda168c8db7b2daee16409c99618548da Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 28 Jan 2014 17:41:01 -0500 Subject: [PATCH] Better isolate faults in the ipmi plugin Previously, one ipmi failure would tank all consoles and commands. Now, at least console failures are isolated. Next stop is to isolate command failures, then fix up session recovery. --- plugins/hardwaremanagement/ipmi.py | 40 +++++++++++++++++------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/plugins/hardwaremanagement/ipmi.py b/plugins/hardwaremanagement/ipmi.py index 9b75268b..5c390c77 100644 --- a/plugins/hardwaremanagement/ipmi.py +++ b/plugins/hardwaremanagement/ipmi.py @@ -31,14 +31,17 @@ def _ipmi_evtloop(): console.session.Session.register_handle_callback(pullchain[0], _process_chgs) while (1): - if tmptimeout is not None: - console.session.Session.wait_for_rsp(timeout=tmptimeout) - tmptimeout = None - else: - console.session.Session.wait_for_rsp(timeout=600) - while ipmiwaiters: - waiter = ipmiwaiters.popleft() - waiter.send() + try: + if tmptimeout is not None: + console.session.Session.wait_for_rsp(timeout=tmptimeout) + tmptimeout = None + else: + console.session.Session.wait_for_rsp(timeout=600) + while ipmiwaiters: + waiter = ipmiwaiters.popleft() + waiter.send() + except: + print "Whoops, that was a doozy" def _process_chgs(intline): #here we receive functions to run in our thread @@ -48,15 +51,18 @@ def _process_chgs(intline): global chainpulled os.read(intline,1) # answer the bell chainpulled = False - while ipmiq: - cval = ipmiq.popleft() - if hasattr(cval[0], '__call__'): - if isinstance(cval[1], tuple): - rv = cval[0](*cval[1]) - elif isinstance(cval[1], dict): - rv = cval[0](**cval[1]) - if len(cval) > 2: - cval[2](rv) + try: + while ipmiq: + cval = ipmiq.popleft() + if hasattr(cval[0], '__call__'): + if isinstance(cval[1], tuple): + rv = cval[0](*cval[1]) + elif isinstance(cval[1], dict): + rv = cval[0](**cval[1]) + if len(cval) > 2: + cval[2](rv) + except: # assure the thread does not crash and burn + print "should put in some debug data here..."