mirror of
https://opendev.org/x/pyghmi
synced 2025-01-27 19:37:44 +00:00
Detect indefinitely broken session and mark it
There are evidently scenarios where an orphaned object could be stuck in logging indefinitely. Place a cap and automatically mark the object if it suffers from this. Change-Id: I60733c1eabb56494ad848595b46240af82c186d3
This commit is contained in:
parent
90d02c0a03
commit
e2c6489c2c
@ -493,6 +493,7 @@ class Session(object):
|
||||
else:
|
||||
self.privlevel = 4
|
||||
self.autopriv = True
|
||||
self.logoutexpiry = None
|
||||
self.autokeepalive = keepalive
|
||||
self.maxtimeout = 3 # be aggressive about giving up on initial packet
|
||||
self.incommand = False
|
||||
@ -595,6 +596,7 @@ class Session(object):
|
||||
self.authtype = 0
|
||||
self.ipmiversion = 1.5
|
||||
self.timeout = initialtimeout + (0.5 * random.random())
|
||||
self.logoutexpiry = _monotonic_time() + self._getmaxtimeout()
|
||||
self.seqlun = 0
|
||||
# NOTE(jbjohnso): per IPMI table 5-4, software ids in the ipmi spec may
|
||||
# be 0x81 through 0x8d. We'll stick with 0x81 for now,
|
||||
@ -755,6 +757,9 @@ class Session(object):
|
||||
timeout=None,
|
||||
callback=None):
|
||||
if not self.logged:
|
||||
if (self.logoutexpiry is not None and
|
||||
_monotonic_time() > self.logoutexpiry):
|
||||
self._mark_broken()
|
||||
raise exc.IpmiException('Session no longer connected')
|
||||
self._cmdwait()
|
||||
if not self.logged:
|
||||
@ -1005,6 +1010,7 @@ class Session(object):
|
||||
|
||||
def _req_priv_level(self):
|
||||
self.logged = 1
|
||||
self.logoutexpiry = None
|
||||
response = self.raw_command(netfn=0x6, command=0x3b,
|
||||
data=[self.privlevel])
|
||||
if response['code']:
|
||||
|
Loading…
x
Reference in New Issue
Block a user