entity-manager: move startRemovedTimer to EM class
This enables us to remove static variables scannedPowerOff and
scannedPowerOn.
Tested: Not sure how to test this.
Did a power-cycle of the host, nothing unusual to be seen.
EM seems to work normally.
```
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 0
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: Supermicro PWS 920P SQ 1
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: chassis
Jul 01 09:59:26 s8030-bmc-30303035c0c1 entity-manager[4204]: Inventory Added: MBX 1.57 Chassis
```
Change-Id: Ic9f80d45d255f91875876bb7d11180b2ec20cd6a
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/src/entity_manager/entity_manager.cpp b/src/entity_manager/entity_manager.cpp
index 3dc2f80..f2fbb47 100644
--- a/src/entity_manager/entity_manager.cpp
+++ b/src/entity_manager/entity_manager.cpp
@@ -369,13 +369,9 @@
logDeviceRemoved(device);
}
-void startRemovedTimer(boost::asio::steady_timer& timer,
- nlohmann::json& systemConfiguration,
- nlohmann::json& lastJson)
+void EntityManager::startRemovedTimer(boost::asio::steady_timer& timer,
+ nlohmann::json& systemConfiguration)
{
- static bool scannedPowerOff = false;
- static bool scannedPowerOn = false;
-
if (systemConfiguration.empty() || lastJson.empty())
{
return; // not ready yet
@@ -392,7 +388,7 @@
timer.expires_after(std::chrono::seconds(10));
timer.async_wait(
- [&systemConfiguration, &lastJson](const boost::system::error_code& ec) {
+ [&systemConfiguration, this](const boost::system::error_code& ec) {
if (ec == boost::asio::error::operation_aborted)
{
return;
@@ -462,7 +458,7 @@
postToDbus(newConfiguration);
if (count == instance)
{
- startRemovedTimer(timer, systemConfiguration, lastJson);
+ startRemovedTimer(timer, systemConfiguration);
}
});
}
diff --git a/src/entity_manager/entity_manager.hpp b/src/entity_manager/entity_manager.hpp
index a6095f0..81c2136 100644
--- a/src/entity_manager/entity_manager.hpp
+++ b/src/entity_manager/entity_manager.hpp
@@ -64,6 +64,12 @@
std::unique_ptr<sdbusplus::bus::match_t> nameOwnerChangedMatch = nullptr;
std::unique_ptr<sdbusplus::bus::match_t> interfacesAddedMatch = nullptr;
std::unique_ptr<sdbusplus::bus::match_t> interfacesRemovedMatch = nullptr;
+
+ bool scannedPowerOff = false;
+ bool scannedPowerOn = false;
+
+ void startRemovedTimer(boost::asio::steady_timer& timer,
+ nlohmann::json& systemConfiguration);
};
inline void logDeviceAdded(const nlohmann::json& record)