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

Add more data to discovery

Some applications may
want to source more information
from systems to help
identify things, particularly with
partially preconfigured systems.
This commit is contained in:
Jarrod Johnson 2021-01-15 10:34:43 -05:00
parent a5c4b64c60
commit 5736c41daa
2 changed files with 30 additions and 0 deletions

View File

@ -230,6 +230,8 @@ def send_discovery_datum(info):
yield msg.KeyValueData({'serialnumber': sn})
yield msg.KeyValueData({'modelnumber': mn})
yield msg.KeyValueData({'uuid': uuid})
if 'enclosure.uuid' in info:
yield msg.KeyValueData({'enclosure_uuid': info['enclosure.uuid']})
if 'enclosure.bay' in info:
yield msg.KeyValueData({'bay': int(info['enclosure.bay'])})
yield msg.KeyValueData({'macs': [info.get('hwaddr', '')]})
@ -240,6 +242,16 @@ def send_discovery_datum(info):
yield msg.KeyValueData({'types': types})
if 'otheraddresses' in info:
yield msg.KeyValueData({'otheripaddrs': list(info['otheraddresses'])})
if 'location' in info:
yield msg.KeyValueData({'location': info['location']})
if 'room' in info:
yield msg.KeyValueData({'room': info['room']})
if 'rack' in info:
yield msg.KeyValueData({'rack': info['rack']})
if 'u' in info:
yield msg.KeyValueData({'lowest_u': info['u']})
if 'hostname' in info:
yield msg.KeyValueData({'hostname': info['hostname']})
def _info_matches(info, criteria):

View File

@ -47,10 +47,28 @@ class NodeHandler(bmchandler.NodeHandler):
self.info['uuid'] = uuidprefix + '-' + '-'.join(
wronguuid.split('-')[3:])
self.info['uuid'] = self.info['uuid'].lower()
room = slpattrs.get('room-id', [None])[0]
if room:
self.info['room'] = room
rack = slpattrs.get('rack-id', [None])[0]
if rack:
self.info['rack'] = rack
name = slpattrs.get('name', [None])[0]
if name:
self.info['hostname'] = name
unumber = slpattrs.get('lowest-u', [None])[0]
if unumber:
self.info['u'] = unumber
location = slpattrs.get('location', [None])[0]
if location:
self.info['location'] = location
if ff not in ('dense-computing', 'BC2'):
# do not probe unless it's a dense platform
return
self.isdense = True
encuuid = slpattrs.get('chassis-uuid', [None])[0]
if encuuid:
self.info['enclosure.uuid'] = encuuid
slot = int(slpattrs.get('slot', ['0'])[0])
if slot != 0:
self.info['enclosure.bay'] = slot