From f5ee86f97e9a296b537377a26c4e64229edb785f Mon Sep 17 00:00:00 2001 From: Markus Hilger Date: Tue, 11 Aug 2026 00:20:49 +0200 Subject: [PATCH] Make the FPC sensor generators coroutines get_sensor_names and get_sensor_descriptions reach get_psu_count for any sensor whose table entry carries elementsfun, and get_psu_count is a coroutine. As plain generators they could not await it, so range() was handed the coroutine object and enumeration died with "'coroutine' object cannot be interpreted as an integer". Every DW612S has such entries, so nodesensors returned nothing for the enclosure. get_sensor_descriptions was doubly broken: the Lenovo handler already iterated it with async for, which a plain generator cannot satisfy. Verified against a DW612S SMM (FPC variant 38). Before, descriptions raised at the async for and readings raised partway through enumeration; after, both return all 34 sensors, 19 of which are the PSU entries that never enumerated. --- confluent_server/aiohmi/ipmi/oem/lenovo/handler.py | 4 ++-- confluent_server/aiohmi/ipmi/oem/lenovo/nextscale.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py b/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py index adea804e..b95c2763 100755 --- a/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py +++ b/confluent_server/aiohmi/ipmi/oem/lenovo/handler.py @@ -526,8 +526,8 @@ class OEMHandler(generic.OEMHandler): yield await self.immhandler.get_oem_sensor_reading(name, self.ipmicmd) elif await self.is_fpc(): - for name in nextscale.get_sensor_names(self.ipmicmd, - self._fpc_variant): + async for name in nextscale.get_sensor_names( + self.ipmicmd, self._fpc_variant): yield await nextscale.get_sensor_reading(name, self.ipmicmd, self._fpc_variant) elif await self.has_ami(): diff --git a/confluent_server/aiohmi/ipmi/oem/lenovo/nextscale.py b/confluent_server/aiohmi/ipmi/oem/lenovo/nextscale.py index 2458ecbd..b8e7a6c7 100644 --- a/confluent_server/aiohmi/ipmi/oem/lenovo/nextscale.py +++ b/confluent_server/aiohmi/ipmi/oem/lenovo/nextscale.py @@ -255,7 +255,7 @@ fpc_sensors = { } -def get_sensor_names(ipmicmd, size): +async def get_sensor_names(ipmicmd, size): global fpc_sensors for name in fpc_sensors: if size != 6 and name in ('Fan Power', 'Total Power Capacity', @@ -272,7 +272,7 @@ def get_sensor_names(ipmicmd, size): elemidx += 1 yield '{0} {1}'.format(name, elemidx) elif 'elementsfun' in sensor: - for elemidx in range(sensor['elementsfun'](ipmicmd, size)): + for elemidx in range(await sensor['elementsfun'](ipmicmd, size)): elemidx += 1 yield '{0} {1}'.format(name, elemidx) elif 'elements' in sensor: @@ -283,7 +283,7 @@ def get_sensor_names(ipmicmd, size): yield name -def get_sensor_descriptions(ipmicmd, size): +async def get_sensor_descriptions(ipmicmd, size): global fpc_sensors for name in fpc_sensors: if size != 6 and name in ('Fan Power', 'Total Power Capacity', @@ -300,7 +300,7 @@ def get_sensor_descriptions(ipmicmd, size): yield {'name': '{0} {1}'.format(name, elemidx), 'type': sensor['type']} elif 'elementsfun' in sensor: - for elemidx in range(sensor['elementsfun'](ipmicmd, size)): + for elemidx in range(await sensor['elementsfun'](ipmicmd, size)): elemidx += 1 yield {'name': '{0} {1}'.format(name, elemidx), 'type': sensor['type']}