Add Fan Redundancy Support
This adds fan redundancy support to passive sensors.
If there are redundancy interfaces on dbus, we'll fail
a sensor if the status is set to failed.
Tested: Set Redundancy to Failed On Dbus, saw all fans
in collection boost. Then restarted swampd, came up
and still boosted. Set redundancy OK, and they all slowed
down.
Change-Id: I8879bef1471bbc168435d6b22dd20006b9dca133
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index f5c01b3..4da1cf2 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -68,8 +68,23 @@
switch (rtype)
{
case IOInterfaceType::DBUSPASSIVE:
- ri = DbusPassive::createDbusPassive(
- passiveListeningBus, info->type, name, &helper, info);
+ // we only need to make one match based on the dbus object
+ static std::shared_ptr<DbusPassiveRedundancy> redundancy =
+ std::make_shared<DbusPassiveRedundancy>(
+ passiveListeningBus);
+
+ if (info->type == "fan")
+ {
+ ri = DbusPassive::createDbusPassive(
+ passiveListeningBus, info->type, name, &helper, info,
+ redundancy);
+ }
+ else
+ {
+ ri = DbusPassive::createDbusPassive(passiveListeningBus,
+ info->type, name,
+ &helper, info, nullptr);
+ }
if (ri == nullptr)
{
throw SensorBuildException(