1120: Check PowerSupply availability prop for State/Hlth #1281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit makes use of the Available property on the power supply D-Bus object when determining the power supply state and health in the PowerSupply response. The power supply monitor code from phosphor-power will set the property to false if it can determine that the power supply isn't able to provide power due to certain faults.
If the PS isn't available, then the Health property will be set to Critical, and the State will be set to UnavailableOffline (assuming it shouldn't be Absent instead).
This is necessary because on IBM systems the Functional property determines the fault LED state as well as the health value, and in certain cases the fault LED needs to stay off even though the PS health is not OK. A specific example of this is when the PS cord is unplugged: no fault LED is desired but it is desired for the Redfish output to show that there is an issue with the PS.
If the Available property isn't present on D-Bus, it acts as if it had a value of true and behaves the same as it does today.
Tested:
Available = false:
"Health": "Critical",
"State": "UnavailableOffline"
Available = true, Functional = false:
"Health": "Critical",
"State": "Enabled"
PS missing:
"Health": "Critical",
"State": "Absent"
Everything OK:
"Health": "OK",
"State": "Enabled"
No Available property on D-Bus:
"Health": "OK",
"State": "Enabled"
Change-Id: I1a3194bf3a6ca3936954b31439070dcc2f343411