2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Have persistent ipmi command objects break selves on reconfig

When any reconfiguration happens, break a command object (and the session that lies beneath).
This does cause needless churn in response to some changes that wouldn't matter, but it's a
small price to pay for the simplicity of not bothering to be fancier.
This commit is contained in:
Jarrod Johnson 2014-05-06 10:06:33 -04:00
parent 23aac5dab7
commit 4ef60d3106
2 changed files with 15 additions and 6 deletions

5
TODO
View File

@ -29,7 +29,4 @@ KeyError: ''
-confetty to do right thing with respect to status updates when run right on a
console. It currently clutters up the screen with data that would land in
a titlebar
-audit log did not show confetty activity for starting console
-ipmi plugin needs to watch for connection attribute changes. test case is to
connect to a bmc and then misconfigure. Currently, it keeps working, it should
break. watchattribs is the key
-audit log did not show confetty activity for starting console

View File

@ -32,6 +32,17 @@ _ipmithread = None
_ipmiwaiters = []
class IpmiCommandWrapper(ipmicommand.Command):
def __init__(self, node, cfm, **kwargs):
self._attribwatcher = cfm.watch_attributes(
(node,),('secret.hardwaremanagementuser',
'secret.hardwaremanagementpassphrase', 'secret.ipmikg',
'hardwaremanagement.manager'), self._attribschanged)
super(self.__class__, self).__init__(**kwargs)
def _attribschanged(self, nodeattribs, configmanager, **kwargs):
self.ipmi_session._mark_broken()
def _ipmi_evtloop():
while True:
try:
@ -219,8 +230,9 @@ class IpmiHandler(object):
if ((node, tenant) not in persistent_ipmicmds or
not persistent_ipmicmds[(node, tenant)].ipmi_session.logged):
self._logevt = threading.Event()
persistent_ipmicmds[(node, tenant)] = ipmicommand.Command(
bmc=connparams['bmc'], userid=connparams['username'],
persistent_ipmicmds[(node, tenant)] = IpmiCommandWrapper(
node, cfg, bmc=connparams['bmc'],
userid=connparams['username'],
password=connparams['passphrase'], kg=connparams['kg'],
port=connparams['port'], onlogon=self.logged)
self.ipmicmd = persistent_ipmicmds[(node, tenant)]