2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-03-29 03:27:24 +00:00

Guard against accidental node duplication

If two nodes have same bmc, block one of them to prevent massive
fluctuation back and forth.
This commit is contained in:
Jarrod Johnson 2019-11-07 11:10:26 -05:00
parent 28bb143880
commit 75010ac6f0

View File

@ -278,6 +278,7 @@ def _donothing(data):
class IpmiConsole(conapi.Console):
configattributes = frozenset(_configattributes)
bmctonodemapping = {}
def __init__(self, node, config):
self.error = None
@ -295,10 +296,18 @@ class IpmiConsole(conapi.Console):
self.bmc = connparams['bmc']
self.port = connparams['port']
self.connected = False
# ok, is self.bmc unique among nodes already
# Cannot actually create console until 'connect', when we get callback
if (self.bmc in self.bmctonodemapping and
self.bmctonodemapping[self.bmc] != node):
raise Exception(
"Duplicate hardwaremanagement.manager attribute for {0} and {1}".format(
node, self.bmctonodemapping[self.bmc]))
self.bmctonodemapping[self.bmc] = node
def __del__(self):
self.solconnection = None
del self.bmctonodemapping[self.bmc]
def handle_data(self, data):
if type(data) == dict: