Skip to content

Commit

Permalink
hpe: Remove redundant calls to enclosurechassis endpoint
Browse files Browse the repository at this point in the history
On mono-node HPE chassis, the current code is calling the
enclosurechassis endpoint for each monitoring loop.

This call is perfectly useless since the enclosurechassis does not
exists.

This patch is about adding a is_multinode_chassis() function to be
cached that try this endpoint and get a constant answer.

Regarding this cached status, a real read of the enclosurechassis is
done for multinode chassis only.

Tested on DL380, ilorest 4.9.0.0, Model: 'iLO 5' FW: 'iLO 5 v3.03'
Tested on XL225n (Apollo 2000 Gen10), iloreset 4.9.0.0, Model: 'iLO 5' FW: 'iLO 5 v3.08'
Tested on DL340Gen12, ilorest 4.9.0.0, Model: 'iLO 6' FW: 'iLO 6 v1.62'

Signed-off-by: Erwan Velu <[email protected]>
  • Loading branch information
ErwanAliasr1 committed Oct 23, 2024
1 parent 2f3a9df commit b13b607
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions hwbench/environment/vendors/hpe/hpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,23 @@ def read_power_consumption(
)
return power_consumption

def get_oem_chassis(self):
return self.get_redfish_url(
"/redfish/v1/Chassis/enclosurechassis/", log_failure=False
@cachetools.func.ttl_cache(maxsize=1, ttl=3600)
def is_multinode_chassis(self) -> bool:
return (
True
if self.get_redfish_url(
"/redfish/v1/Chassis/enclosurechassis/", log_failure=False
)
else False
)

def get_oem_chassis(self):
if self.is_multinode_chassis():
return self.get_redfish_url(
"/redfish/v1/Chassis/enclosurechassis/", log_failure=False
)
return {}


class Hpe(Vendor):
def __init__(self, out_dir, dmi, monitoring_config_filename):
Expand Down

0 comments on commit b13b607

Please sign in to comment.