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

Fix discovery uuid cross-reference

The SSDP does an endian scramble of the smm uuid,
fix it, and also update the core to prefer the
processed enclosure.uuid attribute.
This commit is contained in:
Jarrod Johnson 2022-04-27 15:09:40 -04:00
parent a738be3b53
commit 48fd496637
2 changed files with 13 additions and 2 deletions

View File

@ -947,7 +947,9 @@ def get_node_by_uuid_or_mac(uuidormac):
def get_nodename_from_enclosures(cfg, info):
nodename = None
cuuid = info.get('attributes', {}).get('chassis-uuid', [None])[0]
cuuid = info.get('enclosure.uuid', None)
if not cuuid:
cuuid = info.get('attributes', {}).get('chassis-uuid', [None])[0]
if cuuid and cuuid in nodes_by_uuid:
encl = nodes_by_uuid[cuuid]
bay = info.get('enclosure.bay', None)

View File

@ -30,6 +30,15 @@ import struct
getaddrinfo = eventlet.support.greendns.getaddrinfo
def fixuuid(baduuid):
# SMM dumps it out in hex
uuidprefix = (baduuid[:8], baduuid[9:13], baduuid[14:18])
a = codecs.encode(struct.pack('<IHH', *[int(x, 16) for x in uuidprefix]),
'hex')
a = util.stringify(a)
uuid = (a[:8], a[8:12], a[12:16], baduuid[19:23], baduuid[24:])
return '-'.join(uuid).lower()
class LockedUserException(Exception):
pass
@ -94,7 +103,7 @@ class NodeHandler(immhandler.NodeHandler):
if attrs.get('enclosure-form-factor', None) == 'dense-computing':
encuuid = attrs.get('chassis-uuid', None)
if encuuid:
self.info['enclosure.uuid'] = encuuid
self.info['enclosure.uuid'] = fixuuid(encuuid)
slot = int(attrs.get('slot', 0))
if slot != 0:
self.info['enclosure.bay'] = slot