2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-26 10:59:53 +00:00

Dedupe concurrent ipmi health requests

IPMI health requests are relatively expensive.  It's
also pretty popular and therefore prone to be the target of
inadvertantly aggressive concurrent requests.  Mitigate the harm
by detecting concurrent usage and having callers share an answer.
This commit is contained in:
Jarrod Johnson 2016-04-12 10:28:01 -04:00
parent fa0c0ce81a
commit 4ba8a7a997

View File

@ -92,6 +92,8 @@ class IpmiCommandWrapper(ipmicommand.Command):
def __init__(self, node, cfm, **kwargs):
self.cfm = cfm
self.node = node
self._inhealth = False
self._lasthealth = None
self._attribwatcher = cfm.watch_attributes(
(node,), ('secret.hardwaremanagementuser',
'secret.hardwaremanagementpassword', 'secret.ipmikg',
@ -113,6 +115,16 @@ class IpmiCommandWrapper(ipmicommand.Command):
# then do nothing
pass
def get_health(self):
if self._inhealth:
while self._inhealth:
eventlet.sleep(0.1)
return self._lasthealth
self._inhealth = True
self._lasthealth = super(IpmiCommandWrapper, self).get_health()
self._inhealth = False
return self._lasthealth
def _ipmi_evtloop():
while True:
@ -845,7 +857,7 @@ class IpmiHandler(object):
return
def _str_health(health):
if health == 'unknown':
if isinstance(health, str):
return health
if pygconstants.Health.Failed & health:
health = 'failed'