Add class to watch the the power state
Create a PowerState base class that has APIs to return the current power
state and to call a function on a power state change. This will be used
so that the fan presence code can run even when power is off and know
not to bother creating event logs when a fan is missing with power off.
This is split into base and derived classes to make it easier for
different system architectures to look at different things. On
OpenPower systems, the 'pgood' property on the org.openbmc.Control.Power
interface will be used, and so a PGoodState child class was created to
watch that property.
If some other platform wants to look at something else, like the power
state property hosted by the chassis state object, then a new derived
class could be created and some code could be written to read the class
to create out of the JSON or the configuration options.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I37d36719cd09f6b21d078f343353df2472788569
1 file changed