Matthew Barth | fd06a2c | 2019-06-12 12:31:30 -0500 | [diff] [blame] | 1 | # Water cooled Swift fan policy for PDM. |
| 2 | # |
| 3 | # A water cooled Swift requires a minimum of three functional fan |
| 4 | # enclosures. If the number of functional fan enclosures is below three, |
| 5 | # soft poweroff the system. |
| 6 | |
| 7 | - name: fan enclosures |
| 8 | description: > |
| 9 | 'A water cooled Swift has four fan enclosures 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 | 'Swift 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 | 'Swift 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 water 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 enclosure presence state changes.' |
| 87 | class: watch |
| 88 | watch: property |
| 89 | paths: fan enclosures |
| 90 | properties: fan present |
| 91 | callback: check cooling type |
| 92 | |
| 93 | - name: watch fan functional |
| 94 | description: > |
| 95 | 'Trigger logic on fan enclosure functional state changes.' |
| 96 | class: watch |
| 97 | watch: property |
| 98 | paths: fan enclosures |
| 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 water cooled |
| 118 | |
| 119 | - name: check cooling type |
| 120 | description: > |
| 121 | 'If this condition passes the chassis is water cooled.' |
| 122 | class: condition |
| 123 | condition: count |
| 124 | paths: chassis |
| 125 | properties: chassis water cooled |
| 126 | callback: check power |
| 127 | countop: '==' |
| 128 | countbound: 1 |
| 129 | op: '==' |
| 130 | bound: true |
| 131 | |
| 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 | |
| 145 | - name: check fans |
| 146 | description: > |
| 147 | 'Verify there are at least three functional fan enclosures, |
| 148 | power off if not.' |
| 149 | class: callback |
| 150 | callback: group |
| 151 | members: |
| 152 | - check group presence |
| 153 | - check group functional enclosures |
| 154 | |
| 155 | - name: check group presence |
| 156 | description: > |
| 157 | 'If this condition passes more than one fan has been unplugged |
| 158 | for more than 25 seconds. Shut the system down. Count present |
| 159 | fans rather than non-present fans since the latter would pass |
| 160 | if the fan has not been created for some reason. |
| 161 | |
| 162 | For a more detailed definition of unplugged, consult the documentation |
| 163 | of xyz.openbmc_project.Inventory.Item and/or the documentation |
| 164 | of the fan inventory object implementation.' |
| 165 | class: condition |
| 166 | condition: count |
| 167 | paths: fan enclosures |
| 168 | properties: fan present |
| 169 | defer: 25000000us |
| 170 | callback: log and shutdown |
| 171 | countop: '<' |
| 172 | countbound: 3 |
| 173 | op: '==' |
| 174 | bound: true |
| 175 | |
| 176 | - name: check group functional enclosures |
| 177 | description: > |
| 178 | 'If this condition passes more than one fan enclosure in the group has been |
| 179 | marked as nonfunctional for five seconds. Shut the system down. |
| 180 | |
| 181 | For a more detailed definition of nonfunctional, consult the documentation |
| 182 | of xyz.openbmc_project.State.Decorator.OperationalStatus and/or the |
| 183 | documentation of the fan inventory object implementation.' |
| 184 | class: condition |
| 185 | condition: count |
| 186 | paths: fan enclosures |
| 187 | properties: fan functional |
| 188 | defer: 5000000us |
| 189 | callback: log and shutdown |
| 190 | countop: '>' |
| 191 | countbound: 1 |
| 192 | op: '==' |
| 193 | bound: false |
| 194 | |
| 195 | - name: log and poweroff |
| 196 | description: > |
| 197 | 'Immediately poweroff, log an event in the journal, and create an |
| 198 | error log.' |
| 199 | class: callback |
| 200 | callback: group |
| 201 | members: |
| 202 | - hard poweroff |
| 203 | - log hard poweroff |
| 204 | - create shutdown error |
| 205 | |
| 206 | - name: log and shutdown |
| 207 | description: > |
| 208 | 'Shut the system down, log an event in the journal, and create an |
| 209 | error log.' |
| 210 | class: callback |
| 211 | callback: group |
| 212 | members: |
| 213 | - shutdown |
| 214 | - log shutdown |
| 215 | - create shutdown error |
| 216 | |
| 217 | - name: hard poweroff |
| 218 | description: > |
| 219 | 'Immediately power off the system.' |
| 220 | class: callback |
| 221 | callback: method |
| 222 | service: org.freedesktop.systemd1 |
| 223 | path: /org/freedesktop/systemd1 |
| 224 | interface: org.freedesktop.systemd1.Manager |
| 225 | method: StartUnit |
| 226 | args: |
| 227 | - value: obmc-chassis-hard-poweroff@0.target |
| 228 | type: string |
| 229 | - value: replace |
| 230 | type: string |
| 231 | |
| 232 | - name: shutdown |
| 233 | description: > |
| 234 | 'Shut down the system.' |
| 235 | class: callback |
| 236 | callback: method |
| 237 | service: org.freedesktop.systemd1 |
| 238 | path: /org/freedesktop/systemd1 |
| 239 | interface: org.freedesktop.systemd1.Manager |
| 240 | method: StartUnit |
| 241 | args: |
| 242 | - value: obmc-host-shutdown@0.target |
| 243 | type: string |
| 244 | - value: replace |
| 245 | type: string |
| 246 | |
| 247 | - name: log hard poweroff |
| 248 | description: > |
| 249 | 'Log a hard poweroff event to the systemd journal.' |
| 250 | class: callback |
| 251 | callback: journal |
| 252 | paths: chassis state |
| 253 | properties: chassis powered |
| 254 | severity: ERR |
| 255 | message: Immediate poweroff of system. There are not enough functional fans. |
| 256 | |
| 257 | - name: log shutdown |
| 258 | description: > |
| 259 | 'Log a shutdown event to the systemd journal.' |
| 260 | class: callback |
| 261 | callback: journal |
| 262 | paths: chassis state |
| 263 | properties: chassis powered |
| 264 | severity: ERR |
| 265 | message: Request shutdown of system. There are not enough functional fans. |
| 266 | |
| 267 | - name: create shutdown error |
| 268 | description: > |
| 269 | 'Create a Fan Shutdown Error log.' |
| 270 | class: callback |
| 271 | callback: elog |
| 272 | paths: chassis state |
| 273 | properties: chassis powered |
| 274 | error: xyz::openbmc_project::State::Shutdown::Inventory::Error::Fan |