From 9baa1f5652e90c7d6e9de07260739ed8b3b5299b Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 23 Jan 2018 13:07:59 -0500 Subject: [PATCH] Accommodate XCC firmware behavior It has been observed that a Lenovo XCC can fail to produce the appropriate attributes in the SLP data. In such a case, and only if we are in the preconfig path (which means it is a candidate for discovery), reset the XCC to try to correct the behavior. --- confluent_server/confluent/discovery/core.py | 7 ++++++- .../confluent/discovery/handlers/xcc.py | 19 ++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 9eb689dc..62337458 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -815,7 +815,12 @@ def eval_node(cfg, handler, info, nodename, manual=False): # for now, we search switch only, ideally we search cmm, smm, and # switch concurrently # do some preconfig, for example, to bring a SMM online if applicable - handler.preconfig() + errorstr = handler.preconfig() + if errorstr: + if manual: + raise exc.InvalidArgumentException(errorstr) + log.log({'error': errorstr}) + return except Exception as e: unknown_info[info['hwaddr']] = info info['discostatus'] = 'unidentified' diff --git a/confluent_server/confluent/discovery/handlers/xcc.py b/confluent_server/confluent/discovery/handlers/xcc.py index ad222489..253bb940 100644 --- a/confluent_server/confluent/discovery/handlers/xcc.py +++ b/confluent_server/confluent/discovery/handlers/xcc.py @@ -22,7 +22,24 @@ class NodeHandler(immhandler.NodeHandler): devname = 'XCC' def preconfig(self): - ff = self.info.get('attributes', {}).get('enclosure-form-factor', '') + ff = None + try: + ff = self.info['attributes']['enclosure-form-factor'] + except KeyError: + try: + # an XCC should always have that set, this is sign of + # a bug, try to reset the BMC as a workaround + ipmicmd = self._get_ipmicmd() + ipmicmd.reset_bmc() + return "XCC with address {0} did not have attributes " \ + "declared, attempting to correct with " \ + "XCC reset".format(self.ipaddr) + except pygexc.IpmiException as e: + if (e.ipmicode != 193 and + 'Unauthorized name' not in str(e) and + 'Incorrect password' not in str(e)): + # raise an issue if anything other than to be expected + raise if ff not in ('dense-computing', [u'dense-computing']): return # attempt to enable SMM