diff --git a/confluent_client/bin/confluent2xcat b/confluent_client/bin/confluent2xcat index 91e42028..1570c4fe 100644 --- a/confluent_client/bin/confluent2xcat +++ b/confluent_client/bin/confluent2xcat @@ -79,6 +79,8 @@ def collect_attribute_data(databynode, node): xcatattrs['groups'] = ','.join(data.get('groups', [])) xcatattrs['bmc'] = data.get('hardwaremanagement.manager', {}).get( 'value', None) + if xcatattrs['bmc']: + xcatattrs['bmc'] = xcatattrs['bmc'].split('/', 1)[0] xcatattrs['mpa'] = data.get('enclosure.manager', {}).get( 'value', None) xcatattrs['slotid'] = data.get('enclosure.bay', {}).get( diff --git a/confluent_server/confluent/config/attributes.py b/confluent_server/confluent/config/attributes.py index c25045c6..94428bd6 100644 --- a/confluent_server/confluent/config/attributes.py +++ b/confluent_server/confluent/config/attributes.py @@ -380,7 +380,9 @@ node = { # }, 'hardwaremanagement.manager': { 'description': 'The management address dedicated to this node. This ' - 'is the address of, for example, the Lenovo IMM.', + 'is the address of, for example, the Lenovo XCC. It may optionally ' + 'include / CIDR suffix to indicate subnet length, which is ' + 'autodetected by default where possible.', }, 'hardwaremanagement.method': { 'description': 'The method used to perform operations such as power ' diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 05ab0a21..cb5aff99 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -820,6 +820,7 @@ def get_chained_smm_name(nodename, cfg, handler, nl=None, checkswitch=True): smmaddr = cd.get(nodename, {}).get('hardwaremanagement.manager', {}).get('value', None) if not smmaddr: return None, False + smmaddr = smmaddr.split('/', 1)[0] if pkey: cv = util.TLSCertVerifier( cfg, nodename, 'pubkeys.tls_hardwaremanager').verify_cert diff --git a/confluent_server/confluent/discovery/handlers/bmc.py b/confluent_server/confluent/discovery/handlers/bmc.py index dacce06c..a9ed315a 100644 --- a/confluent_server/confluent/discovery/handlers/bmc.py +++ b/confluent_server/confluent/discovery/handlers/bmc.py @@ -160,6 +160,7 @@ class NodeHandler(generic.NodeHandler): not cd['hardwaremanagement.manager']['value'].startswith( 'fe80::')): newip = cd['hardwaremanagement.manager']['value'] + newip = newip.split('/', 1)[0] newipinfo = getaddrinfo(newip, 0)[0] # This getaddrinfo is repeated in get_nic_config, could be # optimized, albeit with a more convoluted api.. diff --git a/confluent_server/confluent/discovery/handlers/smm.py b/confluent_server/confluent/discovery/handlers/smm.py index 790ad131..365e16c9 100644 --- a/confluent_server/confluent/discovery/handlers/smm.py +++ b/confluent_server/confluent/discovery/handlers/smm.py @@ -104,6 +104,8 @@ class NodeHandler(bmchandler.NodeHandler): cd = cfg.get_node_attributes( nodename, ['hardwaremanagement.manager']) smmip = cd.get(nodename, {}).get('hardwaremanagement.manager', {}).get('value', None) + if smmip: + smmip = smmip.split('/', 1)[0] if smmip and ':' not in smmip: smmip = getaddrinfo(smmip, 0)[0] smmip = smmip[-1][0] diff --git a/confluent_server/confluent/discovery/handlers/tsm.py b/confluent_server/confluent/discovery/handlers/tsm.py index 68e76d61..8849d2b0 100644 --- a/confluent_server/confluent/discovery/handlers/tsm.py +++ b/confluent_server/confluent/discovery/handlers/tsm.py @@ -198,6 +198,7 @@ class NodeHandler(generic.NodeHandler): not cd['hardwaremanagement.manager']['value'].startswith( 'fe80::')): newip = cd['hardwaremanagement.manager']['value'] + newip = newip.split('/', 1)[0] newipinfo = getaddrinfo(newip, 0)[0] newip = newipinfo[-1][0] if ':' in newip: @@ -234,9 +235,10 @@ def remote_nodecfg(nodename, cfm): nodename, 'hardwaremanagement.manager') ipaddr = cfg.get(nodename, {}).get('hardwaremanagement.manager', {}).get( 'value', None) + ipaddr = ipaddr.split('/', 1)[0] ipaddr = getaddrinfo(ipaddr, 0)[0][-1] if not ipaddr: - raise Excecption('Cannot remote configure a system without known ' + raise Exception('Cannot remote configure a system without known ' 'address') info = {'addresses': [ipaddr]} nh = NodeHandler(info, cfm) diff --git a/confluent_server/confluent/discovery/handlers/xcc.py b/confluent_server/confluent/discovery/handlers/xcc.py index 5c236b03..b405f9fa 100644 --- a/confluent_server/confluent/discovery/handlers/xcc.py +++ b/confluent_server/confluent/discovery/handlers/xcc.py @@ -555,6 +555,7 @@ class NodeHandler(immhandler.NodeHandler): not cd['hardwaremanagement.manager']['value'].startswith( 'fe80::')): newip = cd['hardwaremanagement.manager']['value'] + newip = newip.split('/', 1)[0] newipinfo = getaddrinfo(newip, 0)[0] newip = newipinfo[-1][0] if ':' in newip: @@ -599,6 +600,7 @@ def remote_nodecfg(nodename, cfm): nodename, 'hardwaremanagement.manager') ipaddr = cfg.get(nodename, {}).get('hardwaremanagement.manager', {}).get( 'value', None) + ipaddr = ipaddr.split('/', 1)[0] ipaddr = getaddrinfo(ipaddr, 0)[0][-1] if not ipaddr: raise Excecption('Cannot remote configure a system without known ' diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index ec80a095..b2b692ec 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -687,6 +687,7 @@ def resourcehandler_backend(env, start_response): start_response('404 Not Found', headers) yield 'No hardwaremanagement.manager defined for node' return + targip = targip.split('/', 1)[0] funport = forwarder.get_port(targip, env['HTTP_X_FORWARDED_FOR'], authorized['sessionid']) host = env['HTTP_X_FORWARDED_HOST'] diff --git a/confluent_server/confluent/lookuptools.py b/confluent_server/confluent/lookuptools.py index 8e24d7e5..fee9dcc8 100644 --- a/confluent_server/confluent/lookuptools.py +++ b/confluent_server/confluent/lookuptools.py @@ -64,6 +64,7 @@ def node_by_manager(manager): ('hardwaremanagement.manager',)) for node in hmattribs: currhm = hmattribs[node]['hardwaremanagement.manager']['value'] + currhm = currhm.split('/', 1)[0] if currhm in manageraddresses: manager_to_nodemap[manager] = node return node diff --git a/confluent_server/confluent/plugins/console/tsmsol.py b/confluent_server/confluent/plugins/console/tsmsol.py index b120579f..5e662ebd 100644 --- a/confluent_server/confluent/plugins/console/tsmsol.py +++ b/confluent_server/confluent/plugins/console/tsmsol.py @@ -46,6 +46,7 @@ def get_conn_params(node, configdata): bmc = configdata['hardwaremanagement.manager']['value'] else: bmc = node + bmc = bmc.split('/', 1)[0] return { 'username': username, 'passphrase': passphrase, diff --git a/confluent_server/confluent/plugins/hardwaremanagement/deltapdu.py b/confluent_server/confluent/plugins/hardwaremanagement/deltapdu.py index f8f78627..0943404f 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/deltapdu.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/deltapdu.py @@ -114,6 +114,7 @@ class PDUClient(object): 'hardwaremanagement.manager', {}).get('value', None) if not target: target = self.node + target = target.split('/', 1)[0] self._wc = WebConnection(target) self.login(self.configmanager) return self._wc diff --git a/confluent_server/confluent/plugins/hardwaremanagement/eatonpdu.py b/confluent_server/confluent/plugins/hardwaremanagement/eatonpdu.py index 1c4449dd..c0c86b5a 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/eatonpdu.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/eatonpdu.py @@ -131,6 +131,7 @@ class PDUClient(object): 'hardwaremanagement.manager', {}).get('value', None) if not target: target = self.node + target = target.split('/', 1)[0] self._wc = WebConnection(target) self.login(self.configmanager) return self._wc diff --git a/confluent_server/confluent/plugins/hardwaremanagement/geist.py b/confluent_server/confluent/plugins/hardwaremanagement/geist.py index 8f977eb5..ae0458c5 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/geist.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/geist.py @@ -44,6 +44,7 @@ class GeistClient(object): 'hardwaremanagement.manager', {}).get('value', None) if not target: target = self.node + target = target.split('/', 1)[0] cv = util.TLSCertVerifier( self.configmanager, self.node, 'pubkeys.tls_hardwaremanager').verify_cert diff --git a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py index 4fbd9e80..bd50bd64 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/ipmi.py @@ -256,6 +256,7 @@ def get_conn_params(node, configdata): bmc = configdata['hardwaremanagement.manager']['value'] else: bmc = node + bmc = bmc.split('/', 1)[0] if 'secret.ipmikg' in configdata: kg = configdata['secret.ipmikg']['value'] else: diff --git a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py index 6cd23566..b4bdc86a 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/redfish.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/redfish.py @@ -236,6 +236,7 @@ def get_conn_params(node, configdata): bmc = configdata['hardwaremanagement.manager']['value'] else: bmc = node + bmc = bmc.split('/', 1)[0] # TODO(jbjohnso): check if the end has some number after a : without [] # for non default port return { diff --git a/confluent_server/confluent/selfservice.py b/confluent_server/confluent/selfservice.py index 195c2f72..66cffcbf 100644 --- a/confluent_server/confluent/selfservice.py +++ b/confluent_server/confluent/selfservice.py @@ -204,6 +204,7 @@ def handle_request(env, start_response): res['bmcvlan'] = vlan bmcaddr = hmattr.get('hardwaremanagement.manager', {}).get('value', None) + bmcaddr = bmcaddr.split('/', 1)[0] bmcaddr = socket.getaddrinfo(bmcaddr, 0)[0] bmcaddr = bmcaddr[-1][0] if '.' in bmcaddr: # ipv4 is allowed