2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-09-29 00:31:09 +00:00

Continue work on mac search capability

This commit is contained in:
Jarrod Johnson
2017-02-15 14:03:28 -05:00
parent 88b2b49d3b
commit 2f251dd05a
2 changed files with 16 additions and 1 deletions
@@ -18,12 +18,18 @@ import confluent.discovery.handlers.bmchandler as bmchandler
class NodeHandler(bmchandler.NodeHandler):
def preconfig(self):
self.discoverable = True
# attempt to enable SMM
ipmicmd = self._get_ipmicmd()
try:
ipmicmd.xraw_command(netfn=0x3a, command=0xf1, data=(1,))
self.discoverable = False
except pygexc.IpmiException:
# If the XCC can't do it, that's fine, it wasn't stark
pass
ipmicmd.ipmi_session.logout()
icmd.logout()
def discoverable_by_switch(self):
return self.discoverable
@@ -37,6 +37,7 @@ if __name__ == '__main__':
import confluent.exceptions as exc
import confluent.log as log
import confluent.snmputil as snmp
import confluent.util as util
from eventlet.greenpool import GreenPool
import re
@@ -44,6 +45,7 @@ _macmap = {}
_macsbyswitch = {}
_nodesbymac = {}
_switchportmap = {}
vintage = None
_whitelistnames = (
@@ -192,7 +194,12 @@ def _map_switch_backend(args):
_nodesbymac[mac] = nodename
def find_mac(mac, configmanager):
def find_node_by_mac(mac, configmanager):
if util.monotonic_time() - vintage < 90 and mac in _nodesbymac:
return _nodesbymac[mac]
for _ in update_macmap(configmanager):
if mac in _nodesbymac:
return _nodesbymac[mac]
def update_macmap(configmanager):
"""Interrogate switches to build/update mac table
@@ -205,6 +212,8 @@ def update_macmap(configmanager):
global _macmap
global _nodesbymac
global _switchportmap
global vintage
vintage = util.monotonic_time()
# Clear all existing entries
_macmap = {}
_nodesbymac = {}