mirror of
https://github.com/xcat2/confluent.git
synced 2026-11-19 08:52:20 +00:00
Handle IPMI sessions torn down while a response is pending
A SOL keepalive reply arriving after the console was closed failed with an AttributeError on the released session. A privilege level request on a session that was logged out or given up on during login raised IpmiException out of the packet handler into the event loop shared by all sessions. Ignore the late keepalive reply, and report the failed login to its waiters instead.
This commit is contained in:
@@ -170,6 +170,9 @@ class Console(object):
|
||||
await self._sendpendingoutput()
|
||||
|
||||
async def _got_payload_instance_info(self, response):
|
||||
if self.ipmi_session is None:
|
||||
# console closed while this keepalive was in flight
|
||||
return
|
||||
if 'error' in response:
|
||||
self.activated = False
|
||||
await self._print_error(response['error'])
|
||||
|
||||
@@ -1147,27 +1147,36 @@ class Session(object):
|
||||
self.logged = 1
|
||||
self.maxtimeout = 4 # Switch quickly to the relogin recovery
|
||||
self.logontries = 1 # have one relogin waiting to heal
|
||||
response = await self.raw_command(netfn=0x6, command=0x3b,
|
||||
data=[self.privlevel])
|
||||
if response['code']:
|
||||
try:
|
||||
response = await self.raw_command(netfn=0x6, command=0x3b,
|
||||
data=[self.privlevel])
|
||||
if response['code'] in (0x80, 0x81) and self.privlevel == 4:
|
||||
# some implementations will let us get this far,
|
||||
# but suddenly get skiddish. Try again in such a case
|
||||
self.privlevel = 3
|
||||
response = await self.raw_command(netfn=0x6, command=0x3b,
|
||||
data=[self.privlevel])
|
||||
if response['code']:
|
||||
self.logged = 0
|
||||
self.onlogpayload = None
|
||||
self.logging = False
|
||||
self.logoutexpiry = None
|
||||
except exc.IpmiException as e:
|
||||
# session torn down meanwhile, fail the logon rather than
|
||||
# raising into the shared event loop
|
||||
self.logged = 0
|
||||
self.onlogpayload = None
|
||||
self.logging = False
|
||||
self.logoutexpiry = None
|
||||
await self.onlogon({'error': str(e)})
|
||||
return
|
||||
if response['code']:
|
||||
self.logged = 0
|
||||
self.onlogpayload = None
|
||||
self.logging = False
|
||||
self.logoutexpiry = None
|
||||
|
||||
mysuffix = " while requesting privelege level %d for %s" % (
|
||||
self.privlevel, self.userid)
|
||||
errstr = get_ipmi_error(response, suffix=mysuffix)
|
||||
if errstr:
|
||||
await self.onlogon({'error': errstr})
|
||||
return
|
||||
mysuffix = " while requesting privelege level %d for %s" % (
|
||||
self.privlevel, self.userid)
|
||||
errstr = get_ipmi_error(response, suffix=mysuffix)
|
||||
if errstr:
|
||||
await self.onlogon({'error': errstr})
|
||||
return
|
||||
self.logging = False
|
||||
self.logoutexpiry = None
|
||||
global KEEPALIVE_SESSIONS
|
||||
|
||||
Reference in New Issue
Block a user