diff --git a/pyghmi/ipmi/console.py b/pyghmi/ipmi/console.py index a7d034bd..c36a82df 100644 --- a/pyghmi/ipmi/console.py +++ b/pyghmi/ipmi/console.py @@ -51,6 +51,7 @@ class Console(object): self.retriedpayload = 0 self.pendingoutput = [] self.awaitingack = False + self.activated = False self.force_session = force self.ipmi_session = session.Session(bmc=bmc, userid=userid, @@ -114,6 +115,7 @@ class Console(object): return if 'error' in response: self._print_error(response['error']) + self.activated = True #data[0:3] is reserved except for the test mode, which we don't use data = response['data'] self.maxoutcount = (data[5] << 8) + data[4] @@ -125,11 +127,37 @@ class Console(object): raise NotImplementedError("Non-standard SOL Port Number") #ignore data[10:11] for now, the vlan detail, shouldn't matter to this #code anyway... + #NOTE(jbjohnso): + #We will use a special purpose keepalive + self.keepaliveid = self.ipmi_session.register_keepalive( + cmd={'netfn': 6, 'command': 0x4b, 'data': (1, 1)}, + callback=self._got_payload_instance_info) self.ipmi_session.sol_handler = self._got_sol_payload self.connected = True if len(self.pendingoutput) > 0: self._sendpendingoutput() + def _got_payload_instance_info(self, response): + if 'error' in response: + self.activated = False + self.ipmi_session.unregister_keepalive(self.keepaliveid) + self._print_error(response['error']) + return + currowner = struct.unpack( + "