network_manager: Remove unused restart code
Change-Id: If082467ddd0ed8df6dc6f1c7f96c9028bffac58b
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 48e3848..fe59f0b 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -36,7 +36,6 @@
{
extern std::unique_ptr<Timer> refreshObjectTimer;
-extern std::unique_ptr<Timer> restartTimer;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -249,48 +248,6 @@
#endif
-void Manager::restartTimers()
-{
- using namespace std::chrono;
- if (refreshObjectTimer && restartTimer)
- {
- restartTimer->restartOnce(restartTimeout);
- refreshObjectTimer->restartOnce(refreshTimeout);
- }
-}
-
-void Manager::restartSystemdUnit(const std::string& unit)
-{
- try
- {
- auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
- SYSTEMD_INTERFACE, "ResetFailedUnit");
- method.append(unit);
- bus.call_noreply(method);
- }
- catch (const sdbusplus::exception::exception& ex)
- {
- log<level::ERR>("Failed to reset failed unit",
- entry("UNIT=%s", unit.c_str()),
- entry("ERR=%s", ex.what()));
- elog<InternalFailure>();
- }
-
- try
- {
- auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
- SYSTEMD_INTERFACE, "RestartUnit");
- method.append(unit.c_str(), "replace");
- bus.call_noreply(method);
- }
- catch (const sdbusplus::exception::exception& ex)
- {
- log<level::ERR>("Failed to restart service", entry("ERR=%s", ex.what()),
- entry("UNIT=%s", unit.c_str()));
- elog<InternalFailure>();
- }
-}
-
void Manager::reloadConfigs()
{
try
diff --git a/src/network_manager.hpp b/src/network_manager.hpp
index a93940f..fb3cc32 100644
--- a/src/network_manager.hpp
+++ b/src/network_manager.hpp
@@ -110,9 +110,6 @@
*/
bool createDefaultNetworkFiles(bool force);
- /** @brief restart the network timers. */
- void restartTimers();
-
/** @brief This function gets the MAC address from the VPD and
* sets it on the corresponding ethernet interface during first
* Boot, once it sets the MAC from VPD, it creates a file named
@@ -127,12 +124,6 @@
void setFistBootMACOnInterface(
const std::pair<std::string, std::string>& ethPair);
- /** @brief Restart the systemd unit
- * @param[in] unit - systemd unit name which needs to be
- * restarted.
- */
- virtual void restartSystemdUnit(const std::string& unit);
-
/** @brief Tell systemd-network to reload all of the network configurations
*/
virtual void reloadConfigs();
diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp
index fb08fdf..9153f28 100644
--- a/src/network_manager_main.cpp
+++ b/src/network_manager_main.cpp
@@ -48,7 +48,6 @@
std::unique_ptr<phosphor::network::Manager> manager = nullptr;
std::unique_ptr<Timer> refreshObjectTimer = nullptr;
-std::unique_ptr<Timer> restartTimer = nullptr;
#ifdef SYNC_MAC_FROM_INVENTORY
std::unique_ptr<sdbusplus::bus::match::match> EthInterfaceMatch = nullptr;
@@ -244,21 +243,11 @@
}
}
-/** @brief restart the systemd networkd. */
-void restartNetwork()
-{
- if (manager)
- {
- manager->restartSystemdUnit(phosphor::network::networkdService);
- }
-}
-
void initializeTimers()
{
auto event = sdeventplus::Event::get_default();
refreshObjectTimer =
std::make_unique<Timer>(event, std::bind(refreshObjects));
- restartTimer = std::make_unique<Timer>(event, std::bind(restartNetwork));
}
} // namespace network
diff --git a/test/mock_network_manager.hpp b/test/mock_network_manager.hpp
index 9e27c9c..dce1b36 100644
--- a/test/mock_network_manager.hpp
+++ b/test/mock_network_manager.hpp
@@ -45,7 +45,7 @@
std::make_pair(std::move(interface), std::move(intf)));
}
}
- MOCK_METHOD1(restartSystemdUnit, void(const std::string& service));
+
MOCK_METHOD(void, reloadConfigs, (), (override));
};