mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-09 04:56:12 +00:00
Add ability to group discovery by uuid
API adds 'by-uuid', which helps group BMC and PXE together to make relationship clear.
This commit is contained in:
parent
4af5e2d615
commit
68c7ab4c90
@ -165,6 +165,7 @@ def _info_matches(info, criteria):
|
||||
node = criteria.get('by-node', None)
|
||||
serial = criteria.get('by-serial', None)
|
||||
status = criteria.get('by-state', None)
|
||||
uuid = criteria.get('by-uuid', None)
|
||||
if model and info.get('modelnumber', None) != model:
|
||||
return False
|
||||
if devtype and devtype not in info.get('services', []):
|
||||
@ -175,6 +176,8 @@ def _info_matches(info, criteria):
|
||||
return False
|
||||
if status and info.get('discostatus', None) != status:
|
||||
return False
|
||||
if uuid and info.get('uuid') != uuid:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
@ -196,6 +199,18 @@ def list_matching_serials(criteria):
|
||||
if _info_matches(info, criteria):
|
||||
yield msg.ChildCollection(serial + '/')
|
||||
|
||||
def list_matching_uuids(criteria):
|
||||
uuids = []
|
||||
for mac in known_info:
|
||||
info = known_info[mac]
|
||||
uuid = info.get('uuid', None)
|
||||
if not uuid:
|
||||
continue
|
||||
if _info_matches(info, criteria):
|
||||
uuids.append(uuid)
|
||||
for uuid in uuids:
|
||||
yield msg.ChildCollection(uuid + '/')
|
||||
|
||||
|
||||
def list_matching_states(criteria):
|
||||
return [msg.ChildCollection(x) for x in ('discovered/', 'identified/',
|
||||
@ -247,12 +262,12 @@ multi_selectors = set([
|
||||
'by-type',
|
||||
'by-model',
|
||||
'by-state',
|
||||
'by-uuid',
|
||||
])
|
||||
|
||||
|
||||
node_selectors = set([
|
||||
'by-node',
|
||||
#'by-uuid',
|
||||
'by-serial',
|
||||
])
|
||||
|
||||
|
@ -62,7 +62,7 @@ class NodeHandler(bmchandler.NodeHandler):
|
||||
ipmicmd = self._get_ipmicmd()
|
||||
guiddata = ipmicmd.xraw_command(netfn=6, command=8)
|
||||
self.info['uuid'] = pygutil.decode_wireformat_uuid(
|
||||
guiddata['data'])
|
||||
guiddata['data']).lower()
|
||||
ipmicmd.oem_init()
|
||||
bayid = ipmicmd._oem.immhandler.get_property(
|
||||
'/v2/cmm/sp/7')
|
||||
|
@ -37,7 +37,7 @@ def decode_uuid(rawguid):
|
||||
lebytes = struct.unpack_from('<IHH', buffer(rawguid[:8]))
|
||||
bebytes = struct.unpack_from('>HHI', buffer(rawguid[8:]))
|
||||
return '{0:08X}-{1:04X}-{2:04X}-{3:04X}-{4:04X}{5:08X}'.format(
|
||||
lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2])
|
||||
lebytes[0], lebytes[1], lebytes[2], bebytes[0], bebytes[1], bebytes[2]).lower()
|
||||
|
||||
|
||||
def find_info_in_options(rq, optidx):
|
||||
|
@ -272,7 +272,7 @@ def _parse_attrlist(attrstr):
|
||||
'{4:04X}{5:08X}'.format(
|
||||
lebytes[0], lebytes[1], lebytes[2], bebytes[0],
|
||||
bebytes[1], bebytes[2]
|
||||
)
|
||||
).lower()
|
||||
attribs[attrname].append(val)
|
||||
attrstr = attrstr[attrstr.index(')'):]
|
||||
elif attrstr[0] == ',':
|
||||
|
Loading…
Reference in New Issue
Block a user