From 02848d66b7694986465ab44e4d5f7717fcdae956 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Sat, 1 Feb 2014 19:02:18 -0500 Subject: [PATCH] Use different timeout values for logon and retry When establishing a session, there is not much to lose. If three get channel authentication capabilities fail, it's almost certainly because it just isn't going to work (bad IP, rebooting BMC, something like that). However, once signs of life have been displayed, the likely cause of an outage shifts toward a transient network outage (e.g. link speed negotiation after rebooting a shared nic configured solution). Particularly with SOL, there is a high chance of inflight data worth trying to recover the session to get. For that we go to tolerating up to ~20 seconds of outage. Much longer than that and we are pretty much certain to run afoul of BMC timeout anyway, so no hope of withstanding something like spanning tree with blocking by default, but it can withstand moderately well configured networks. Change-Id: I783d13eaee4360cfd780e28b2b4cbf77cc980945 --- pyghmi/ipmi/private/session.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index 7af988a9..fa2398cb 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -218,6 +218,7 @@ class Session(object): else: self.iterwaiters.append(onlogon) return + self.maxtimeout = 3 # be aggressive about giving up on initial packet self.incommand = False self.initialized = True self.cleaningup = False @@ -576,6 +577,7 @@ class Session(object): if 'error' in response: self.onlogon(response) return + self.maxtimeout = 6 # we have a confirmed bmc, be more tenacious if response['code'] == 0xcc and self.ipmi15only is not None: # tried ipmi 2.0 against a 1.5 which should work, but some bmcs # thought 'reserved' meant 'must be zero' @@ -1169,7 +1171,7 @@ class Session(object): return self.nowait = True self.timeout += 1 - if self.timeout > 5: + if self.timeout > self.maxtimeout: response = {'error': 'timeout'} self.ipmicallback(response) self.incommand = False