From 4cdbc7807b171085732771a150ba613c26606056 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 19 Aug 2019 16:37:14 -0400 Subject: [PATCH] Add thinkagile storage to discovery At least enumerate the ipv4 pieces. --- confluent_server/confluent/discovery/core.py | 3 +++ confluent_server/confluent/discovery/protocols/slp.py | 11 +++++++++++ .../confluent/discovery/protocols/ssdp.py | 9 +++++++-- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 1f9f66ec..005a57f7 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -101,6 +101,7 @@ nodehandlers = { 'service:management-hardware.IBM:integrated-management-module2': imm, 'pxe-client': pxeh, 'service:io-device.Lenovo:management-module': None, + 'service:thinkagile-storage': None, } servicenames = { @@ -109,6 +110,7 @@ servicenames = { 'service:management-hardware.Lenovo:lenovo-xclarity-controller': 'lenovo-xcc', 'service:management-hardware.IBM:integrated-management-module2': 'lenovo-imm2', 'service:io-device.Lenovo:management-module': 'lenovo-switch', + 'service:thinkagile-storage': 'thinkagile-storagebmc', } servicebyname = { @@ -117,6 +119,7 @@ servicebyname = { 'lenovo-xcc': 'service:management-hardware.Lenovo:lenovo-xclarity-controller', 'lenovo-imm2': 'service:management-hardware.IBM:integrated-management-module2', 'lenovo-switch': 'service:io-device.Lenovo:management-module', + 'thinkagile-storage': 'service:thinkagile-storagebmc', } discopool = eventlet.greenpool.GreenPool(500) diff --git a/confluent_server/confluent/discovery/protocols/slp.py b/confluent_server/confluent/discovery/protocols/slp.py index 2d5dc063..145d6769 100644 --- a/confluent_server/confluent/discovery/protocols/slp.py +++ b/confluent_server/confluent/discovery/protocols/slp.py @@ -27,6 +27,7 @@ import traceback _slp_services = set([ 'service:management-hardware.IBM:integrated-management-module2', 'service:lenovo-smm', + 'service:ipmi', 'service:management-hardware.Lenovo:lenovo-xclarity-controller', 'service:management-hardware.IBM:chassis-management-module', 'service:management-hardware.Lenovo:chassis-management-module', @@ -484,6 +485,11 @@ def snoop(handler, protocol=None): _add_attributes(peerbymacaddress[mac]) peerbymacaddress[mac]['hwaddr'] = mac peerbymacaddress[mac]['protocol'] = protocol + if 'service:ipmi' in peerbymacaddress[mac]['services']: + if 'service:ipmi//Athena:623' in peerbymacaddress[mac]['urls']: + peerbymacaddress[mac]['services'] = ['thinkagile-storage'] + else: + continue handler(peerbymacaddress[mac]) except Exception as e: tracelog.log(traceback.format_exc(), ltype=log.DataTypes.event, @@ -547,6 +553,11 @@ def scan(srvtypes=_slp_services, addresses=None, localonly=False): _grab_rsps((net, net4), rsps, 1, xidmap) # now to analyze and flesh out the responses for id in rsps: + if 'service:ipmi' in rsps[id]['services']: + if 'service:ipmi://Athena:623' in rsps[id]['urls']: + rsps[id]['services'] = ['service:thinkagile-storage'] + else: + continue if localonly: for addr in rsps[id]['addresses']: if 'fe80' in addr[0]: diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index 3ad43111..288f733e 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -78,8 +78,13 @@ def snoop(handler, byehandler=None): for i4 in util.list_ips(): ssdp4mcast = socket.inet_pton(socket.AF_INET, mcastv4addr) + \ socket.inet_aton(i4['addr']) - net4.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, - ssdp4mcast) + try: + net4.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, + ssdp4mcast) + except socket.error as e: + if e.errno != 98: + # errno 98 can happen if aliased, skip for now + raise net4.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) net4.bind(('', 1900)) net6.bind(('', 1900))