diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index e8fd1fa9..4934f728 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -148,6 +148,8 @@ def send_discovery_datum(info): yield msg.KeyValueData({'ipaddrs': [x[0] for x in addresses]}) yield msg.KeyValueData({'serialnumber': info.get('serialnumber', '')}) yield msg.KeyValueData({'modelnumber': info.get('modelnumber', '')}) + if 'enclosure.bay' in info: + yield msg.KeyValueData({'bay': int(info['enclosure.bay'])}) yield msg.KeyValueData({'macs': [info.get('hwaddr', '')]}) types = [] for infotype in info.get('services', []): @@ -488,6 +490,7 @@ def detected(info): known_info[info['hwaddr']] = info cfg = cfm.ConfigManager(None) handler = handler.NodeHandler(info, cfg) + handler.scan() if handler.https_supported and not handler.https_cert: if handler.cert_fail_reason == 'unreachable': log.log( diff --git a/confluent_server/confluent/discovery/handlers/generic.py b/confluent_server/confluent/discovery/handlers/generic.py index be5a2a57..d13108d4 100644 --- a/confluent_server/confluent/discovery/handlers/generic.py +++ b/confluent_server/confluent/discovery/handlers/generic.py @@ -36,6 +36,12 @@ class NodeHandler(object): self.ipaddr = targsa[0] return + def scan(self): + # Do completely passive things to enhance data. + # Probe is permitted to for example attempt a login + # scan *only* does what it can without a login attempt + return + def probe(self): # Use appropriate direct strategy to gather data such as # serial number and uuid to flesh out data as needed diff --git a/confluent_server/confluent/discovery/handlers/imm.py b/confluent_server/confluent/discovery/handlers/imm.py index 23feded7..66cc4c82 100644 --- a/confluent_server/confluent/discovery/handlers/imm.py +++ b/confluent_server/confluent/discovery/handlers/imm.py @@ -15,13 +15,50 @@ import confluent.discovery.handlers.bmc as bmchandler import pyghmi.exceptions as pygexc import pyghmi.ipmi.private.util as pygutil - +import string +import struct class NodeHandler(bmchandler.NodeHandler): devname = 'IMM' - def probe(self): + def scan(self): + slpattrs = self.info.get('attributes', {}) + self.isdense = False try: + ff = slpattrs.get('enclosure-form-factor', [''])[0] + except IndexError: + return + if ff not in ('dense-computing', 'BC2'): + # do not probe unless it's a dense platform + return + self.isdense = True + wronguuid = slpattrs.get('node-uuid', [''])[0] + if wronguuid: + # we need to fix the first three portions of the uuid + uuidprefix = wronguuid.split('-')[:3] + uuidprefix = struct.pack( + '