2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 03:19:48 +00:00

Support caching SDR for pyghmi versions that support it

This will improve performance across confluent restarts for commands
like nodesensors, nodehealth, and nodeinventory.
This commit is contained in:
Jarrod Johnson 2018-12-12 09:53:36 -05:00
parent 8a03bc48de
commit 66471624bc

View File

@ -27,6 +27,7 @@ import eventlet.greenpool as greenpool
import eventlet.queue as queue
import eventlet.support.greendns
from fnmatch import fnmatch
import os
import pyghmi.constants as pygconstants
import pyghmi.exceptions as pygexc
import pyghmi.storage as storage
@ -172,6 +173,17 @@ class IpmiCommandWrapper(ipmicommand.Command):
'hardwaremanagement.manager'), self._attribschanged)
super(self.__class__, self).__init__(**kwargs)
self.setup_confluent_keyhandler()
try:
os.makedirs('/var/cache/confluent/ipmi/')
except OSError as e:
if e.errno != errno.EEXIST or not os.path.isdir(
'/var/cache/confluent/ipmi/'):
raise
try:
self.set_sdr_cachedir('/var/cache/confluent/ipmi/')
except Exception:
pass
def setup_confluent_keyhandler(self):
self.register_key_handler(util.TLSCertVerifier(