From a01e705ab7738524b7bc31b94978b88159849ab1 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 12 Apr 2016 14:12:06 -0400 Subject: [PATCH] Fix get_health with a NextScale FPC There was an oversimplified assumption in play. Provide a method to enumerate the generated names as well as the static names. Change-Id: I08dbaaafd7c607869d185f57bae0ea70ebf1084e --- pyghmi/ipmi/oem/lenovo/handler.py | 2 +- pyghmi/ipmi/oem/lenovo/nextscale.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 1f4b03d3..510d13f0 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -299,7 +299,7 @@ class OEMHandler(generic.OEMHandler): def get_sensor_data(self): if self.is_fpc: - for name in nextscale.fpc_sensors: + for name in nextscale.get_sensor_names(): yield nextscale.get_sensor_reading(name, self.ipmicmd) def get_sensor_descriptions(self): diff --git a/pyghmi/ipmi/oem/lenovo/nextscale.py b/pyghmi/ipmi/oem/lenovo/nextscale.py index a8c53b02..c593cdf1 100644 --- a/pyghmi/ipmi/oem/lenovo/nextscale.py +++ b/pyghmi/ipmi/oem/lenovo/nextscale.py @@ -68,6 +68,18 @@ fpc_sensors = { } +def get_sensor_names(): + global fpc_sensors + for name in fpc_sensors: + sensor = fpc_sensors[name] + if 'elements' in sensor: + for elemidx in xrange(sensor['elements']): + elemidx += 1 + yield '{0} {1}'.format(name, elemidx) + else: + yield name + + def get_sensor_descriptions(): global fpc_sensors for name in fpc_sensors: