File: openbmc.dev

package info (click to toggle)
powerman 2.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,432 kB
  • sloc: ansic: 19,458; sh: 7,225; yacc: 694; makefile: 455; lex: 272
file content (65 lines) | stat: -rw-r--r-- 2,854 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# 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"
	}
}