From 8fa9c1078461cc52edb8985e39176382cf994fad Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Thu, 10 Oct 2013 14:06:02 -0400 Subject: [PATCH] Make ipmi plugin resiliant to traffic bursts to avoid a hang --- plugins/ipmi.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/ipmi.py b/plugins/ipmi.py index 0db5ec78..9bd472d9 100644 --- a/plugins/ipmi.py +++ b/plugins/ipmi.py @@ -8,6 +8,7 @@ console.session.select = eventlet.green.select _ipmithread = None #pullchain is a pipe to tug on to induce the ipmi thread process pending data pullchain = None +chainpulled = False tmptimeout = None ipmiq = collections.deque([]) ipmiwaiters = collections.deque([]) @@ -29,7 +30,9 @@ def _ipmi_evtloop(): waiter.send() 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__'): @@ -100,8 +103,12 @@ class Console(object): _ipmithread = eventlet.spawn(_ipmi_evtloop) def write(self, data): + global chainpulled ipmiq.append((self.solconnection.send_data, (data,))) - os.write(pullchain[1],'1') + if not chainpulled: + chainpulled = True + os.write(pullchain[1],'1') + #self.solconnection.send_data(data) def wait_for_data(self, timeout=600): @@ -117,8 +124,11 @@ class Console(object): # value in assuring data coming back to bother with making the stack # taller than it has to be global tmptimeout + global chainpulled tmptimeout = timeout - os.write(pullchain[1],'1') + if not chainpulled: + chainpulled=True + os.write(pullchain[1],'1') eventlet.sleep(0.001) waitevt = eventlet.event.Event() ipmiwaiters.append(waitevt)