Ben_Pai | 949f914 | 2019-08-05 18:34:34 +0800 | [diff] [blame] | 1 | # Air cooled mihawk fan policy for PDM. |
| 2 | # |
| 3 | # An air cooled mihawk requires a minimum of three functional fans |
| 4 | # enclosures or six functional fan rotors across all enclosures. |
| 5 | # If the number of functional fan enclosures is below three, soft poweroff |
| 6 | # the system, whereas if the number of fan rotors drop below six, an |
| 7 | # immediate hard poweroff of the system occurs. |
| 8 | |
| 9 | - name: fan enclosures |
| 10 | description: > |
| 11 | 'An air cooled mihawk has 6 fan enclosures to monitor.' |
| 12 | class: group |
| 13 | group: path |
| 14 | members: |
| 15 | - meta: FAN |
| 16 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0 |
| 17 | - meta: FAN |
| 18 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan1 |
| 19 | - meta: FAN |
| 20 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2 |
| 21 | - meta: FAN |
| 22 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3 |
| 23 | - meta: FAN |
| 24 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan4 |
| 25 | - meta: FAN |
| 26 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan5 |
| 27 | |
| 28 | - name: fan rotors |
| 29 | description: > |
| 30 | 'An air cooled Witherspoon has eight fan rotors to monitor.' |
| 31 | class: group |
| 32 | group: path |
| 33 | members: |
| 34 | - meta: FAN |
| 35 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0/fan0_0 |
| 36 | - meta: FAN |
| 37 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan0/fan0_1 |
| 38 | - meta: FAN |
| 39 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan1/fan1_0 |
| 40 | - meta: FAN |
| 41 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan1/fan1_1 |
| 42 | - meta: FAN |
| 43 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2/fan2_0 |
| 44 | - meta: FAN |
| 45 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan2/fan2_1 |
| 46 | - meta: FAN |
| 47 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3/fan3_0 |
| 48 | - meta: FAN |
| 49 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan3/fan3_1 |
| 50 | - meta: FAN |
| 51 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan4/fan4_0 |
| 52 | - meta: FAN |
| 53 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan4/fan4_1 |
| 54 | - meta: FAN |
| 55 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan5/fan5_0 |
| 56 | - meta: FAN |
| 57 | path: /xyz/openbmc_project/inventory/system/chassis/motherboard/fan5/fan5_1 |
| 58 | |
| 59 | - name: chassis state |
| 60 | description: > |
| 61 | 'Witherspoon has a single chassis to monitor.' |
| 62 | class: group |
| 63 | group: path |
| 64 | members: |
| 65 | - meta: CHASSISSTATE |
| 66 | path: /xyz/openbmc_project/state/chassis0 |
| 67 | |
| 68 | - name: chassis |
| 69 | description: > |
| 70 | 'Witherspoon has a single chassis to monitor.' |
| 71 | class: group |
| 72 | group: path |
| 73 | members: |
| 74 | - meta: CHASSIS |
| 75 | path: /xyz/openbmc_project/inventory/system/chassis |
| 76 | |
| 77 | - name: fan present |
| 78 | description: > |
| 79 | 'Monitor the presence state of each fan.' |
| 80 | class: group |
| 81 | group: property |
| 82 | type: boolean |
| 83 | members: |
| 84 | - interface: xyz.openbmc_project.Inventory.Item |
| 85 | meta: PRESENT |
| 86 | property: Present |
| 87 | |
| 88 | - name: fan functional |
| 89 | description: > |
| 90 | 'Monitor the functional state of each fan.' |
| 91 | class: group |
| 92 | group: property |
| 93 | type: boolean |
| 94 | members: |
| 95 | - interface: xyz.openbmc_project.State.Decorator.OperationalStatus |
| 96 | meta: FUNCTIONAL |
| 97 | property: Functional |
| 98 | |
| 99 | - name: chassis powered |
| 100 | description: > |
| 101 | 'Monitor the chassis power state.' |
| 102 | class: group |
| 103 | group: property |
| 104 | type: string |
| 105 | members: |
| 106 | - interface: xyz.openbmc_project.State.Chassis |
| 107 | meta: CHASSIS_STATE |
| 108 | property: CurrentPowerState |
| 109 | |
| 110 | - name: chassis air cooled |
| 111 | description: > |
| 112 | 'Monitor the chassis cooling type.' |
| 113 | class: group |
| 114 | group: property |
| 115 | type: boolean |
| 116 | members: |
| 117 | - interface: xyz.openbmc_project.Inventory.Decorator.CoolingType |
| 118 | meta: COOLING_TYPE |
| 119 | property: WaterCooled |
| 120 | |
| 121 | - name: watch fan present |
| 122 | description: > |
| 123 | 'Trigger logic on fan enclosure presence state changes.' |
| 124 | class: watch |
| 125 | watch: property |
| 126 | paths: fan enclosures |
| 127 | properties: fan present |
| 128 | callback: check cooling type |
| 129 | |
| 130 | - name: watch fan functional |
| 131 | description: > |
| 132 | 'Trigger logic on fan enclosure functional state changes.' |
| 133 | class: watch |
| 134 | watch: property |
| 135 | paths: fan enclosures |
| 136 | properties: fan functional |
| 137 | callback: check cooling type |
| 138 | |
| 139 | - name: watch fan rotor functional |
| 140 | description: > |
| 141 | 'Trigger logic on fan rotor functional state changes.' |
| 142 | class: watch |
| 143 | watch: property |
| 144 | paths: fan rotors |
| 145 | properties: fan functional |
| 146 | callback: check cooling type |
| 147 | |
| 148 | - name: watch chassis state |
| 149 | description: > |
| 150 | 'Trigger logic on chassis power state changes.' |
| 151 | class: watch |
| 152 | watch: property |
| 153 | paths: chassis state |
| 154 | properties: chassis powered |
| 155 | callback: check cooling type |
| 156 | |
| 157 | - name: watch cooling type |
| 158 | description: > |
| 159 | 'Maintain a cache of the chassis cooling type.' |
| 160 | class: watch |
| 161 | watch: property |
| 162 | paths: chassis |
| 163 | properties: chassis air cooled |
| 164 | |
| 165 | - name: check cooling type |
| 166 | description: > |
| 167 | 'If this condition passes the chassis is air cooled.' |
| 168 | class: condition |
| 169 | condition: count |
| 170 | paths: chassis |
| 171 | properties: chassis air cooled |
| 172 | callback: check power |
| 173 | countop: '==' |
| 174 | countbound: 0 |
| 175 | op: '==' |
| 176 | bound: true |
| 177 | |
| 178 | - name: check power |
| 179 | description: > |
| 180 | 'If the chassis has power, check fans.' |
| 181 | class: condition |
| 182 | condition: count |
| 183 | paths: chassis state |
| 184 | properties: chassis powered |
| 185 | callback: check fans |
| 186 | countop: '>' |
| 187 | countbound: 0 |
| 188 | op: '==' |
| 189 | bound: xyz.openbmc_project.State.Chassis.PowerState.On |
| 190 | |
| 191 | - name: check fans |
| 192 | description: > |
| 193 | 'Verify there are at least three functional fan enclosures and at least |
| 194 | six functional fan rotors, power off if not.' |
| 195 | class: callback |
| 196 | callback: group |
| 197 | members: |
| 198 | - check group presence |
| 199 | - check group functional enclosures |
| 200 | - check group functional rotors |
| 201 | |
| 202 | - name: check group presence |
| 203 | description: > |
| 204 | 'If this condition passes more than one fan has been unplugged |
| 205 | for more than 25 seconds. Shut the system down. Count present |
| 206 | fans rather than non-present fans since the latter would pass |
| 207 | if the fan has not been created for some reason. |
| 208 | |
| 209 | For a more detailed definition of unplugged, consult the documentation |
| 210 | of xyz.openbmc_project.Inventory.Item and/or the documentation |
| 211 | of the fan inventory object implementation.' |
| 212 | class: condition |
| 213 | condition: count |
| 214 | paths: fan enclosures |
| 215 | properties: fan present |
| 216 | defer: 25000000us |
| 217 | callback: log and shutdown |
| 218 | countop: '<' |
| 219 | countbound: 6 |
| 220 | op: '==' |
| 221 | bound: true |
| 222 | |
| 223 | - name: check group functional enclosures |
| 224 | description: > |
| 225 | 'If this condition passes more than one fan enclosure in the group has been |
| 226 | marked as nonfunctional for 25 seconds. Shut the system down. |
| 227 | |
| 228 | For a more detailed definition of nonfunctional, consult the documentation |
| 229 | of xyz.openbmc_project.State.Decorator.OperationalStatus and/or the |
| 230 | documentation of the fan inventory object implementation.' |
| 231 | class: condition |
| 232 | condition: count |
| 233 | paths: fan enclosures |
| 234 | properties: fan functional |
| 235 | defer: 25000000us |
| 236 | callback: log and shutdown |
| 237 | countop: '>' |
| 238 | countbound: 1 |
| 239 | op: '==' |
| 240 | bound: false |
| 241 | |
| 242 | - name: check group functional rotors |
| 243 | description: > |
| 244 | 'If this condition passes more than two fan rotors in the group have been |
| 245 | marked as nonfunctional for 25 seconds. Immediately power off. |
| 246 | For a more detailed definition of nonfunctional, consult the documentation |
| 247 | of xyz.openbmc_project.State.Decorator.OperationalStatus and/or the |
| 248 | documentation of the fan inventory object implementation.' |
| 249 | class: condition |
| 250 | condition: count |
| 251 | paths: fan rotors |
| 252 | properties: fan functional |
| 253 | defer: 25000000us |
| 254 | callback: log and poweroff |
| 255 | countop: '>' |
| 256 | countbound: 1 |
| 257 | op: '==' |
| 258 | bound: false |
| 259 | |
| 260 | - name: log and poweroff |
| 261 | description: > |
| 262 | 'Immediately poweroff, log an event in the journal, and create an |
| 263 | error log.' |
| 264 | class: callback |
| 265 | callback: group |
| 266 | members: |
| 267 | - hard poweroff |
| 268 | - log hard poweroff |
| 269 | - create shutdown error |
| 270 | |
| 271 | - name: log and shutdown |
| 272 | description: > |
| 273 | 'Shut the system down, log an event in the journal, and create an |
| 274 | error log.' |
| 275 | class: callback |
| 276 | callback: group |
| 277 | members: |
| 278 | - shutdown |
| 279 | - log shutdown |
| 280 | - create shutdown error |
| 281 | |
| 282 | - name: hard poweroff |
| 283 | description: > |
| 284 | 'Immediately power off the system.' |
| 285 | class: callback |
| 286 | callback: method |
| 287 | service: org.freedesktop.systemd1 |
| 288 | path: /org/freedesktop/systemd1 |
| 289 | interface: org.freedesktop.systemd1.Manager |
| 290 | method: StartUnit |
| 291 | args: |
| 292 | - value: obmc-chassis-hard-poweroff@0.target |
| 293 | type: string |
| 294 | - value: replace |
| 295 | type: string |
| 296 | |
| 297 | - name: shutdown |
| 298 | description: > |
| 299 | 'Shut down the system.' |
| 300 | class: callback |
| 301 | callback: method |
| 302 | service: org.freedesktop.systemd1 |
| 303 | path: /org/freedesktop/systemd1 |
| 304 | interface: org.freedesktop.systemd1.Manager |
| 305 | method: StartUnit |
| 306 | args: |
| 307 | - value: obmc-host-shutdown@0.target |
| 308 | type: string |
| 309 | - value: replace |
| 310 | type: string |
| 311 | |
| 312 | - name: log hard poweroff |
| 313 | description: > |
| 314 | 'Log a hard poweroff event to the systemd journal.' |
| 315 | class: callback |
| 316 | callback: journal |
| 317 | paths: chassis state |
| 318 | properties: chassis powered |
| 319 | severity: ERR |
| 320 | message: Immediate poweroff of system. There are not enough functional fans. |
| 321 | |
| 322 | - name: log shutdown |
| 323 | description: > |
| 324 | 'Log a shutdown event to the systemd journal.' |
| 325 | class: callback |
| 326 | callback: journal |
| 327 | paths: chassis state |
| 328 | properties: chassis powered |
| 329 | severity: ERR |
| 330 | message: Request shutdown of system. There are not enough functional fans. |
| 331 | |
| 332 | - name: create shutdown error |
| 333 | description: > |
| 334 | 'Create a Fan Shutdown Error log.' |
| 335 | class: callback |
| 336 | callback: elog |
| 337 | paths: chassis state |
| 338 | properties: chassis powered |
| 339 | error: xyz::openbmc_project::State::Shutdown::Inventory::Error::Fan |