Add association to Fan Redundancy
This also needs an association.
Change-Id: I6b0f2f4c5fdc2143ee4e2336d0f9fb9976cec629
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/TachSensor.hpp b/include/TachSensor.hpp
index 1e01859..2ef1298 100644
--- a/include/TachSensor.hpp
+++ b/include/TachSensor.hpp
@@ -30,7 +30,8 @@
{
public:
RedundancySensor(size_t count, const std::vector<std::string>& children,
- sdbusplus::asio::object_server& objectServer);
+ sdbusplus::asio::object_server& objectServer,
+ const std::string& sensorConfiguration);
~RedundancySensor();
void update(const std::string& name, bool failed);
@@ -38,6 +39,7 @@
private:
size_t count;
std::shared_ptr<sdbusplus::asio::dbus_interface> iface;
+ std::shared_ptr<sdbusplus::asio::dbus_interface> association;
sdbusplus::asio::object_server& objectServer;
boost::container::flat_map<std::string, bool> statuses;
};
diff --git a/src/FanMain.cpp b/src/FanMain.cpp
index 701edba..cab1c80 100644
--- a/src/FanMain.cpp
+++ b/src/FanMain.cpp
@@ -361,7 +361,7 @@
systemRedundancy = nullptr;
systemRedundancy = std::make_shared<RedundancySensor>(
std::get<uint64_t>(findCount->second), sensorList,
- objectServer);
+ objectServer, pathPair.first);
return;
}
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index c842464..ae27a04 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -267,15 +267,20 @@
return status;
}
-RedundancySensor::RedundancySensor(
- size_t count, const std::vector<std::string>& children,
- sdbusplus::asio::object_server& objectServer) :
+RedundancySensor::RedundancySensor(size_t count,
+ const std::vector<std::string>& children,
+ sdbusplus::asio::object_server& objectServer,
+ const std::string& sensorConfiguration) :
count(count),
iface(objectServer.add_interface(
"/xyz/openbmc_project/control/FanRedundancy/Tach",
- "xyz.openbmc_project.control.FanRedundancy")),
+ "xyz.openbmc_project.Control.FanRedundancy")),
+ association(objectServer.add_interface(
+ "/xyz/openbmc_project/control/FanRedundancy/Tach",
+ "org.openbmc.Associations")),
objectServer(objectServer)
{
+ createAssociation(association, sensorConfiguration);
iface->register_property("Collection", children);
iface->register_property("Status", std::string("Full"));
iface->register_property("AllowedFailures", static_cast<uint8_t>(count));
@@ -283,6 +288,7 @@
}
RedundancySensor::~RedundancySensor()
{
+ objectServer.remove_interface(association);
objectServer.remove_interface(iface);
}
void RedundancySensor::update(const std::string& name, bool failed)