initialtimeout=0.5#minimum timeout for first packet to retry in any given session. This will be randomized to stagger out retries in case of congestion
#we throttle such that we never have no more outstanding packets than our receive buffer should be able to handle
IPMISession.maxpending=curmax/1000#pessimistically assume 1 kilobyte messages, way larger than almost all ipmi datagrams
#for faster performance, sysadmins may want to examine and tune /proc/sys/net/core/rmem_max up. This allows the module to request more,
#but does not increase buffers for applications that do less creative things
#TODO: perhaps spread sessions across a socket pool when rmem_max is small, still get ~65/socket, but avoid long queues that might happen with
#low rmem_max and putting thousands of nodes in line
def__init__(self,bmc,userid,password,port=623):
self.bmc=bmc
self.userid=userid
self.password=password
self.port=port
ifnothasattr(IPMISession,'socket'):
self._createsocket()
self.login()
def_initsession(self):
self.sessioncontext=0
self.sequencenumber=0
self.sessionid=0
self.authtype=0
self.ipmiversion=1.5
self.timeout=initialtimeout+(0.5*random())
self.seqlun=0
self.rqaddr=0x81#per IPMI table 5-4, software ids in the ipmi spec may be 0x81 through 0x8d. We'll stick with 0x81 for now, do not forsee a reason to adjust
self.logged=0
self.tabooseq={}#this tracks netfn,command,seqlun combinations that were retried so that
#we don't loop around and reuse the same request data and cause potential ambiguity in return
self.ipmi15only=0#default to supporting ipmi 2.0. Strictly by spec, this should gracefully be backwards compat, but some 1.5 implementations checked reserved bits