Brad Bishop | e9969d5 | 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 |
| 124 | callback: check fans |
| 125 | countop: '==' |
| 126 | countbound: 1 |
| 127 | op: '==' |
| 128 | bound: true |
| 129 | |
| 130 | - name: check fans |
| 131 | description: > |
| 132 | 'Verify there are at least two functional fans.' |
| 133 | class: callback |
| 134 | callback: group |
| 135 | members: |
| 136 | - check presence |
| 137 | - check functional |
| 138 | |
| 139 | - name: check presence |
| 140 | description: > |
| 141 | 'If this condition passes more than one fan has been unplugged |
| 142 | for more than 25 seconds. Shut the system down. Count present |
| 143 | fans rather than non-present fans since the latter would pass |
| 144 | if the fan has not been created for some reason. |
| 145 | |
| 146 | For a more detailed definition of unplugged, consult the documentation |
| 147 | of xyz.openbmc_project.Inventory.Item and/or the documentation |
| 148 | of the fan inventory object implementation.' |
| 149 | class: condition |
| 150 | condition: count |
| 151 | paths: fans |
| 152 | properties: fan present |
| 153 | defer: 25000000us |
| 154 | callback: check power |
| 155 | countop: '<' |
| 156 | countbound: 2 |
| 157 | op: '==' |
| 158 | bound: true |
| 159 | |
| 160 | - name: check functional |
| 161 | description: > |
| 162 | 'If this condition passes more than one fan in the group has been marked |
| 163 | as nonfunctional for five seconds. Shut the system down. |
| 164 | |
| 165 | For a more detailed definition of nonfunctional, consult the documentation |
| 166 | of xyz.openbmc_project.State.Decorator.OperationalStatus and/or the |
| 167 | documentation of the fan inventory object implementation.' |
| 168 | class: condition |
| 169 | condition: count |
| 170 | paths: fans |
| 171 | properties: fan functional |
| 172 | defer: 5000000us |
| 173 | callback: check power |
| 174 | countop: '>' |
| 175 | countbound: 1 |
| 176 | op: '==' |
| 177 | bound: false |
| 178 | |
| 179 | - name: check power |
| 180 | description: > |
| 181 | 'If the chassis has power, power it off.' |
| 182 | class: condition |
| 183 | condition: count |
| 184 | paths: chassis state |
| 185 | properties: chassis powered |
| 186 | callback: log and shutdown |
| 187 | countop: '>' |
| 188 | countbound: 0 |
| 189 | op: '==' |
| 190 | bound: xyz.openbmc_project.State.Chassis.PowerState.On |
| 191 | |
| 192 | - name: log and shutdown |
| 193 | description: > |
| 194 | 'Shut the system down and log an event.' |
| 195 | class: callback |
| 196 | callback: group |
| 197 | members: |
| 198 | - shutdown |
| 199 | - log |
| 200 | |
| 201 | - name: shutdown |
| 202 | description: > |
| 203 | 'Shut down the system.' |
| 204 | class: callback |
| 205 | callback: method |
| 206 | service: org.freedesktop.systemd1 |
| 207 | path: /org/freedesktop/systemd1 |
| 208 | interface: org.freedesktop.systemd1.Manager |
| 209 | method: StartUnit |
| 210 | args: |
| 211 | - value: obmc-host-shutdown@0.target |
| 212 | type: string |
| 213 | - value: replace |
| 214 | type: string |
| 215 | |
| 216 | - name: log |
| 217 | description: > |
| 218 | 'Log a shutdown event to the systemd journal.' |
| 219 | class: callback |
| 220 | callback: journal |
| 221 | paths: chassis state |
| 222 | properties: chassis powered |
| 223 | severity: ERR |
| 224 | message: Shutting down system. There are not enough functional fans. |