2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Say what is missing when sensor records cannot be read

A bmc that keeps its sensor data records on the sensor device rather than
in a repository was answered with a bare NotImplementedError.  With no
text of its own it reached the user as "Unexpected Error:
NotImplementedError" and was logged with a traceback, for a capability the
library had simply never implemented rather than anything having gone
wrong.

Say so instead, in all three places that give up: the two branches for a
bmc without an sdr repository, and the version check that only understands
records of version 0x51, which now names the version it was given.

This makes the inventory usable on such a bmc as a side effect.  The
system fru is gathered before the records are, and an unsupported
operation is tolerated where an unexpected error was not, so nodeinventory
answers with the board, chassis and product data instead of one line of
error.
This commit is contained in:
Markus Hilger
2026-08-14 02:06:24 +02:00
parent 233fc9ec5a
commit 8de6c56998
+9 -3
View File
@@ -687,11 +687,15 @@ class SDR(object):
# The device has sensor device support, so in theory we should
# be able to proceed
# However at the moment, we haven't done so
raise NotImplementedError
return
raise exc.UnsupportedFunctionality(
'This bmc keeps its sensor data records on the sensor '
'device rather than in a repository, which is not '
'supported')
# We have Device SDR, without SDR Repository device, but
# also without sensor device support, no idea how to
# continue
raise exc.UnsupportedFunctionality(
'This bmc offers no way to read its sensor data records')
await self.get_sdr()
async def get_sdr_reservation(self):
@@ -706,7 +710,9 @@ class SDR(object):
if (repinfo['data'][0] != 0x51):
# we only understand SDR version 51h, the only version defined
# at time of this writing
raise NotImplementedError
raise exc.UnsupportedFunctionality(
'This bmc reports sensor data record version {0:#x}, and only '
'0x51 is understood'.format(repinfo['data'][0]))
# NOTE(jbjohnso): we actually don't need to care about 'numrecords'
# since FFFF marks the end explicitly
# numrecords = (rsp['data'][2] << 8) + rsp['data'][1]