Skip to content
Commit 3a2d0424 authored by Chris Cain's avatar Chris Cain
Browse files

Systems: Add PowerMode support

The computer system power mode defines the behavior of a system
based on the performance and power saving requirements.
For example, a system could be set to MaximumPerformance to
run as fast as possible without regard to power consumption.
A system could also be configured to run in PowerSaving mode
which would be running at slower speeds to try to save power.
More information can be found at https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/38786

This commit will allow GET / PATCH operations to the PowerMode property

PowerMode was added in Redfish Release 2021.1:
https://www.dmtf.org/content/redfish-release-20211-now-available

Tested: I manually tested retrieving and setting the PowerMode property
on a Rainier system (with good and bad values):
  # curl -k https://$bmc/redfish/v1/Systems/system
  {
    "@odata.id": "/redfish/v1/Systems/system",
    "@odata.type": "#ComputerSystem.v1_15_0.ComputerSystem
  ...
    "PartNumber": "",
    "PowerMode": "MaximumPerformance",
    "PowerMode@Redfish.AllowableValues": [
      "Static",
      "MaximumPerformance",
      "PowerSaving"
    ],
    "PowerRestorePolicy": "AlwaysOff",
  ...
  # curl -k https://$bmc/xyz/openbmc_project/control/host0/power_mode
  {
    "data": {
      "PowerMode": "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance"
    },
    "message": "200 OK",
    "status": "ok"
  }
  # curl -k -X PATCH -d '{ "PowerMode":"Static"}' https://$bmc/redfish/v1/Systems/system
  curl -k https://$bmc/xyz/openbmc_project/control/host0/power_mode


  {
    "data": {
      "PowerMode": "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static"
    },
    "message": "200 OK",
    "status": "ok"
  }
Ran Validator on hardware and all tests passed:
Elapsed time: 0:05:07
Counter({'skipOptional': 7128, 'pass': 6020, 'metadataNamespaces': 2217, 'passGet': 315, 'warnDeprecated': 212, 'serviceNamespaces': 79, 'warningPresent': 47, 'warnTrailingSlashLink': 24, 'invalidPropertyValue': 18, 'passAction': 14, 'optionalAction': 11, 'repeat': 3, 'unverifiedComplexAdditional': 1})
Validation has succeeded.

Signed-off-by: default avatarChris Cain <cjcain@us.ibm.com>
Change-Id: I5523a0ebe4a2a77ea4709a14863bff7b55f0303d
parent 1981771b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment