# Support for OpenBMC Rest Interface # # Powerman.conf should look something like this: # include "/etc/powerman/openbmc.dev" # device "openbmc1" "openbmc" "/usr/sbin/httppower -u https://pnode1 -H Content-Type:application/json -c |&" # node "node1" "openbmc1" "pnode1" # # Tested on IBM 8335-GTW w/ firmware ibm-v2.0-0-r46-0-gbed584c. Known issues: # - openbmc's power on/off returns success before the operation has # been completed on the node. The operation typically takes 20-25 # seconds complete. To ensure powerman does not return before the # on/off is completed, we add a delay of 30 seconds. # - httppower can be configured with only one node, so one httppower # co-process is needed for every openbmc node in a cluster. This # can present scalability problems at larger scales. # - There is no background management of up/down status of openbmc # targets. At larger scales, when there will almost always be one # node removed for servicing, and unresponsive target will always # lead to powerman to timeout. # - A longer term solution is being investigated, see: # https://github.com/chaos/powerman/issues/34. # specification "openbmc" { timeout 40 # login uses openbmc default username/password, adjust if necessary script login { expect "httppower> " send "post login {\"data\":[\"root\",\"0penBmc\"]}\n" expect "httppower> " } script logout { send "post logout {\"data\":[]}\n" expect "httppower> " send "quit\n" } script status { send "get xyz/openbmc_project/state/chassis0/attr/CurrentPowerState\n" expect "xyz.openbmc_project.State.Chassis.PowerState.(On|Off)" setplugstate $1 on="On" off="Off" expect "httppower> " } script on { send "put xyz/openbmc_project/state/host0/attr/RequestedHostTransition {\"data\":\"xyz.openbmc_project.State.Host.Transition.On\"}\n" expect "httppower> " delay 30 send "get xyz/openbmc_project/state/chassis0/attr/CurrentPowerState\n" expect "xyz.openbmc_project.State.Chassis.PowerState.On" } # this is a soft power off, hard power off will bring down the bmc script off { send "put xyz/openbmc_project/state/host0/attr/RequestedHostTransition {\"data\":\"xyz.openbmc_project.State.Host.Transition.Off\"}\n" expect "httppower> " delay 30 send "get xyz/openbmc_project/state/chassis0/attr/CurrentPowerState\n" expect "xyz.openbmc_project.State.Chassis.PowerState.Off" } script cycle { send "put xyz/openbmc_project/state/host0/attr/RequestedHostTransition {\"data\":\"xyz.openbmc_project.State.Host.Transition.Reboot\"}\n" expect "httppower> " delay 30 send "get xyz/openbmc_project/state/chassis0/attr/CurrentPowerState\n" expect "xyz.openbmc_project.State.Chassis.PowerState.On" } }