2
0
mirror of https://opendev.org/x/pyghmi synced 2026-10-06 17:46:59 +00:00

General fixup for sensor handling

Fixup more sensor scenarios.

Give OEM a mechanism to opt out of generic sensors. If, for example, the
platform is unreasonably slow at servicing the sensors.

Change-Id: Ie8668ac219fc5d90f95dd980ffecd73a09ddd0cd
This commit is contained in:
Jarrod Johnson
2025-02-07 11:42:13 -05:00
parent d17eef9b2a
commit 2a91bb3f80
3 changed files with 7 additions and 2 deletions
+5 -2
View File
@@ -68,6 +68,7 @@ _healthmap = {
'Unknown': const.Health.Warning,
'Warning': const.Health.Warning,
'OK': const.Health.Ok,
None: const.Health.Ok,
}
@@ -123,7 +124,7 @@ class SensorReading(object):
self.states = [healthinfo.get('Status', {}).get('Health',
'Unknown')]
self.health = _healthmap[healthinfo['Status']['Health']]
if healthinfo['Status']['Health'].lower() == 'ok':
if self.health == const.Health.Ok:
self.states = []
self.value = value
self.state_ids = None
@@ -692,7 +693,9 @@ class Command(object):
def _mapchassissensors(self, chassis):
chassisurl = chassis['@odata.id']
chassisinfo = self._do_web_request(chassisurl)
sensors = chassisinfo.get('Sensors', {}).get('@odata.id', '')
sensors = None
if self.oem.usegenericsensors:
sensors = chassisinfo.get('Sensors', {}).get('@odata.id', '')
if sensors:
sensorinf = self._do_web_request(sensors)
for sensor in sensorinf.get('Members', []):
+1
View File
@@ -184,6 +184,7 @@ class AttrDependencyHandler(object):
class OEMHandler(object):
hostnic = None
usegenericsensors = True
def __init__(self, sysinfo, sysurl, webclient, cache, gpool=None):
self._gpool = gpool
+1
View File
@@ -119,6 +119,7 @@ def str_to_size(sizestr):
class OEMHandler(generic.OEMHandler):
usegenericsensors = False
logouturl = '/api/providers/logout'
bmcname = 'XCC'
ADP_URL = '/api/dataset/imm_adapters?params=pci_GetAdapters'