EnvironmentMetrics: Adjust PowerLimitWatts functions for reuse
Work is in-progress to add PowerLimitWatts support to the EnvironmentMetrics property for both Processors[1] and Chassis[2] paths. The Processors commit adds functions for getting the object implementing the xyz.openbmc_project.Control.Power.Cap interface. It uses the controlled_by association to find the object. That commit also adds a function to fill in the PowerLimitWatts properties for the GET response. These functions can be used for the Chassis path as well. Additionally, the Chassis path adds setting of the SetPoint and ControlMode properties of PowerLimitWatts. For the PATCH path the common function can be used to get the object with difference in error handling. In order to allow for the reuse this drop is adjusting these functions: - Added common PATCH handling functions - Renamed getPowerLimitWatts -> getPowerCapObject This is the function that gets the associated object implementing the Power.Cap interface. This can be used by either the GET or PATCH path by specifying a different callback. Adjusted to pass errors to the callback for handling. Except special-case of internal error where multiple objects are returned as controlling the object. - Renamed getPowerCapFromControl -> getPowerLimitWatts This is the function used for GET to fill in the PowerLimitWatts in the response. [1] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/87018 [2] https://gerrit.openbmc.org/c/openbmc/bmcweb/+/47300 Tested: - Tested with commit [2] using Chassis path Change-Id: I8272fb9ab80e8063858bb2016dc209a1ca0b2038 Signed-off-by: Janet Adkins <janeta@us.ibm.com>
J
Janet Adkins committed
5b2d5d86b0fb8e5a2f7b20aabfb83b4dd97c5ab7
Parent: e80fca9
Committed by Gunnar Mills <gunnar@gmills.xyz>
on 6/30/2026, 12:45:35 AM