diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index 727420fe..a15a835a 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -58,6 +58,8 @@ class Console(object): self.activated = False self.force_session = force self.port = port + self.ipmi_session = None + self.callgotsession = None self.ipmi_session = session.Session(bmc=bmc, userid=userid, password=password, @@ -67,6 +69,9 @@ class Console(object): # induce one iteration of the loop, now that we would be # prepared for it in theory session.Session.wait_for_rsp(0) + if self.callgotsession is not None: + self._got_session(self.callgotsession) + self.callgotsession = None def _got_session(self, response): """Private function to navigate SOL payload activation @@ -74,6 +79,9 @@ class Console(object): if 'error' in response: self._print_error(response['error']) return + if not self.ipmi_session: + self.callgotsession = response + return # Send activate sol payload directive # netfn= 6 (application) # command = 0x48 (activate payload) diff --git a/pyghmi/ipmi/private/session.py b/pyghmi/ipmi/private/session.py index f41fe0d2..0cd20439 100644 --- a/pyghmi/ipmi/private/session.py +++ b/pyghmi/ipmi/private/session.py @@ -484,6 +484,7 @@ class Session(object): self.iterwaiters.append(onlogon) return self.broken = False + self.socket = None self.logged = 0 self.privlevel = privlevel self.maxtimeout = 3 # be aggressive about giving up on initial packet @@ -556,7 +557,8 @@ class Session(object): self.errormsg = error if not self.broken: self.broken = True - self.socketpool[self.socket] -= 1 + if self.socket: + self.socketpool[self.socket] -= 1 def onlogon(self, parameter): if 'error' in parameter: