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