mirror of
https://github.com/xcat2/confluent.git
synced 2026-10-20 06:35:33 +00:00
Improve snoop behavior
For one, at the time an XCC emits a NOTIFY, it's DeviceDescription.json is also very sluggish. Extend timeout knowing this may be delayed. Further, if snoop comes back with only one address family, do not perturb existing address families.
This commit is contained in:
@@ -881,7 +881,7 @@ async def detected(info):
|
||||
# have the same address, but need to be reset
|
||||
# in that case, however, a user can clear pubkeys to force a check
|
||||
return
|
||||
known_info[info['info_identifier']] = info
|
||||
merge_info(known_info, info['info_identifier'], info)
|
||||
cfg = cfm.ConfigManager(None)
|
||||
if handler:
|
||||
handler = handler.NodeHandler(info, cfg)
|
||||
@@ -974,6 +974,19 @@ async def detected(info):
|
||||
info['discostatus'] = 'unidentified'
|
||||
unknown_info[info['info_identifier']] = info
|
||||
|
||||
def merge_info(thedict, key, new_info):
|
||||
oinfo = thedict.get(key)
|
||||
thedict[key] = new_info
|
||||
if oinfo:
|
||||
oldaddresses = set(oinfo.get('addresses', []))
|
||||
newaddress = set(new_info.get('addresses', []))
|
||||
for naddr in newaddress:
|
||||
for oaddr in list(oldaddresses):
|
||||
if len(naddr) == len(oaddr):
|
||||
oldaddresses.discard(oaddr)
|
||||
merged_addresses = list(oldaddresses | newaddress)
|
||||
thedict[key]['addresses'] = merged_addresses
|
||||
|
||||
|
||||
|
||||
def b64tohex(b64str):
|
||||
|
||||
@@ -536,7 +536,8 @@ async def check_fish(urldata, port=443, verifycallback=None):
|
||||
url, data = urldata
|
||||
targtype = 'generic-redfish'
|
||||
try:
|
||||
wc = webclient.WebConnection(_get_svrip(data), port, verifycallback=verifycallback, timeout=3)
|
||||
thetimeout = 8 if url == '/DeviceDescription.json' else 3
|
||||
wc = webclient.WebConnection(_get_svrip(data), port, verifycallback=verifycallback, timeout=thetimeout)
|
||||
peerinfo = await wc.grab_json_response(url, headers={'Accept': 'application/json', 'Host': 'credible-bmc'})
|
||||
except (socket.error, asyncio.exceptions.TimeoutError):
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user