Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 1 | # Water cooled Witherspoon fan policy for PDM. |
| 2 | # |
| 3 | # A water cooled Witherspoon requires a minimum of two functional fans. |
| 4 | # If the number of functional fans drops below that |
| 5 | # power the system off. |
| 6 | |
| 7 | - name: fans |
| 8 | description: > |
| 9 | 'A water cooled Witherspoon has three fans to monitor.' |
| 10 | class: group |
| 11 | group: path |
| 12 | members: |
| 13 | - meta: FAN |
| 14 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0 |
| 15 | - meta: FAN |
| 16 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2 |
| 17 | - meta: FAN |
| 18 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3 |
| 19 | |
| 20 | - name: chassis state |
| 21 | description: > |
| 22 | 'Witherspoon has a single chassis to monitor.' |
| 23 | class: group |
| 24 | group: path |
| 25 | members: |
| 26 | - meta: CHASSISSTATE |
| 27 | path: /xyz/openbmc_project/state/chassis0 |
| 28 | |
| 29 | - name: chassis |
| 30 | description: > |
| 31 | 'Witherspoon has a single chassis to monitor.' |
| 32 | class: group |
| 33 | group: path |
| 34 | members: |
| 35 | - meta: CHASSIS |
| 36 | path: /xyz/openbmc_project/inventory/system/chassis |
| 37 | |
| 38 | - name: fan present |
| 39 | description: > |
| 40 | 'Monitor the presence state of each fan.' |
| 41 | class: group |
| 42 | group: property |
| 43 | type: boolean |
| 44 | members: |
| 45 | - interface: xyz.openbmc_project.Inventory.Item |
| 46 | meta: PRESENT |
| 47 | property: Present |
| 48 | |
| 49 | - name: fan functional |
| 50 | description: > |
| 51 | 'Monitor the functional state of each fan.' |
| 52 | class: group |
| 53 | group: property |
| 54 | type: boolean |
| 55 | members: |
| 56 | - interface: xyz.openbmc_project.State.Decorator.OperationalStatus |
| 57 | meta: FUNCTIONAL |
| 58 | property: Functional |
| 59 | |
| 60 | - name: chassis powered |
| 61 | description: > |
| 62 | 'Monitor the chassis power state.' |
| 63 | class: group |
| 64 | group: property |
| 65 | type: string |
| 66 | members: |
| 67 | - interface: xyz.openbmc_project.State.Chassis |
| 68 | meta: CHASSIS_STATE |
| 69 | property: CurrentPowerState |
| 70 | |
| 71 | - name: chassis water cooled |
| 72 | description: > |
| 73 | 'Monitor the chassis cooling type.' |
| 74 | class: group |
| 75 | group: property |
| 76 | type: boolean |
| 77 | members: |
| 78 | - interface: xyz.openbmc_project.Inventory.Decorator.CoolingType |
| 79 | meta: COOLING_TYPE |
| 80 | property: WaterCooled |
| 81 | |
| 82 | - name: watch fan present |
| 83 | description: > |
| 84 | 'Trigger logic on fan presence state changes.' |
| 85 | class: watch |
| 86 | watch: property |
| 87 | paths: fans |
| 88 | properties: fan present |
| 89 | callback: check cooling type |
| 90 | |
| 91 | - name: watch fan functional |
| 92 | description: > |
| 93 | 'Trigger logic on fan functional state changes.' |
| 94 | class: watch |
| 95 | watch: property |
| 96 | paths: fans |
| 97 | properties: fan functional |
| 98 | callback: check cooling type |
| 99 | |
| 100 | - name: watch chassis state |
| 101 | description: > |
| 102 | 'Trigger logic on chassis power state changes.' |
| 103 | class: watch |
| 104 | watch: property |
| 105 | paths: chassis state |
| 106 | properties: chassis powered |
| 107 | callback: check cooling type |
| 108 | |
| 109 | - name: watch cooling type |
| 110 | description: > |
| 111 | 'Maintain a cache of the chassis cooling type.' |
| 112 | class: watch |
| 113 | watch: property |
| 114 | paths: chassis |
| 115 | properties: chassis water cooled |
| 116 | |
| 117 | - name: check cooling type |
| 118 | description: > |
| 119 | 'If this condition passes the chassis is water cooled.' |
| 120 | class: condition |
| 121 | condition: count |
| 122 | paths: chassis |
| 123 | properties: chassis water cooled |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 124 | callback: check power |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 125 | countop: '==' |
| 126 | countbound: 1 |
| 127 | op: '==' |
| 128 | bound: true |
| 129 | |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 130 | - name: check power |
| 131 | description: > |
| 132 | 'If the chassis has power, check fans.' |
| 133 | class: condition |
| 134 | condition: count |
| 135 | paths: chassis state |
| 136 | properties: chassis powered |
| 137 | callback: check fans |
| 138 | countop: '>' |
| 139 | countbound: 0 |
| 140 | op: '==' |
| 141 | bound: xyz.openbmc_project.State.Chassis.PowerState.On |
| 142 | |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 143 | - name: check fans |
| 144 | description: > |
Gunnar Mills | f15b0e9 | 2017-10-30 16:43:57 -0500 | [diff] [blame] | 145 | 'Verify there are at least two functional fans, power off if not.' |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 146 | class: callback |
| 147 | callback: group |
| 148 | members: |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 149 | - check group presence |
| 150 | - check group functional |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 151 | |
| 152 | - name: check group presence |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 153 | description: > |
| 154 | 'If this condition passes more than one fan has been unplugged |
| 155 | for more than 25 seconds. Shut the system down. Count present |
| 156 | fans rather than non-present fans since the latter would pass |
| 157 | if the fan has not been created for some reason. |
| 158 | |
| 159 | For a more detailed definition of unplugged, consult the documentation |
| 160 | of xyz.openbmc_project.Inventory.Item and/or the documentation |
| 161 | of the fan inventory object implementation.' |
| 162 | class: condition |
| 163 | condition: count |
| 164 | paths: fans |
| 165 | properties: fan present |
| 166 | defer: 25000000us |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 167 | callback: log and shutdown |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 168 | countop: '<' |
| 169 | countbound: 2 |
| 170 | op: '==' |
| 171 | bound: true |
| 172 | |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 173 | - name: check group functional |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 174 | description: > |
| 175 | 'If this condition passes more than one fan in the group has been marked |
| 176 | as nonfunctional for five seconds. Shut the system down. |
| 177 | |
| 178 | For a more detailed definition of nonfunctional, consult the documentation |
| 179 | of xyz.openbmc_project.State.Decorator.OperationalStatus and/or the |
| 180 | documentation of the fan inventory object implementation.' |
| 181 | class: condition |
| 182 | condition: count |
| 183 | paths: fans |
| 184 | properties: fan functional |
| 185 | defer: 5000000us |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 186 | callback: log and shutdown |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 187 | countop: '>' |
| 188 | countbound: 1 |
| 189 | op: '==' |
| 190 | bound: false |
| 191 | |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 192 | - name: log and shutdown |
| 193 | description: > |
Gunnar Mills | 43bc33d | 2017-10-13 10:02:07 -0500 | [diff] [blame] | 194 | 'Shut the system down, log an event in the journal, and create an |
| 195 | error log.' |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 196 | class: callback |
| 197 | callback: group |
| 198 | members: |
| 199 | - shutdown |
| 200 | - log |
Gunnar Mills | 43bc33d | 2017-10-13 10:02:07 -0500 | [diff] [blame] | 201 | - create shutdown error |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 202 | |
| 203 | - name: shutdown |
| 204 | description: > |
| 205 | 'Shut down the system.' |
| 206 | class: callback |
| 207 | callback: method |
| 208 | service: org.freedesktop.systemd1 |
| 209 | path: /org/freedesktop/systemd1 |
| 210 | interface: org.freedesktop.systemd1.Manager |
| 211 | method: StartUnit |
| 212 | args: |
Matthew Barth | e9a2a61 | 2017-11-08 08:15:35 -0600 | [diff] [blame] | 213 | - value: obmc-host-shutdown@0.target |
Brad Bishop | 7d1ec92 | 2017-05-31 14:10:55 -0400 | [diff] [blame] | 214 | type: string |
| 215 | - value: replace |
| 216 | type: string |
| 217 | |
| 218 | - name: log |
| 219 | description: > |
| 220 | 'Log a shutdown event to the systemd journal.' |
| 221 | class: callback |
| 222 | callback: journal |
| 223 | paths: chassis state |
| 224 | properties: chassis powered |
| 225 | severity: ERR |
| 226 | message: Shutting down system. There are not enough functional fans. |
Gunnar Mills | 8587b62 | 2017-08-09 12:52:20 -0500 | [diff] [blame] | 227 | |
Gunnar Mills | 43bc33d | 2017-10-13 10:02:07 -0500 | [diff] [blame] | 228 | - name: create shutdown error |
| 229 | description: > |
| 230 | 'Create a Fan Shutdown Error log.' |
| 231 | class: callback |
| 232 | callback: elog |
| 233 | paths: chassis state |
| 234 | properties: chassis powered |
| 235 | error: xyz::openbmc_project::State::Shutdown::Inventory::Error::Fan |