network_manager: Reloads should be delayed via timer
Our restarts of systemd waited a short amount of time (3s) prior to
triggering in the past and didn't cause it to reconfigure immediately.
This allowed lan users to queue up a bunch of configuration commands
that would reconfigure the network before it applied.
This patch restores that behavior.
Change-Id: I4c3c589c07528a9d90e6d7e5d3b649688fcf4587
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp
index c295996..349c2ea 100644
--- a/src/network_manager_main.cpp
+++ b/src/network_manager_main.cpp
@@ -48,6 +48,7 @@
std::unique_ptr<phosphor::network::Manager> manager = nullptr;
std::unique_ptr<Timer> refreshObjectTimer = nullptr;
+std::unique_ptr<Timer> reloadTimer = nullptr;
#ifdef SYNC_MAC_FROM_INVENTORY
std::unique_ptr<sdbusplus::bus::match::match> EthInterfaceMatch = nullptr;
@@ -243,11 +244,22 @@
}
}
+void reloadNetworkd()
+{
+ if (manager)
+ {
+ log<level::INFO>("Sending networkd reload");
+ manager->doReloadConfigs();
+ log<level::INFO>("Done networkd reload");
+ }
+}
+
void initializeTimers()
{
auto event = sdeventplus::Event::get_default();
refreshObjectTimer =
std::make_unique<Timer>(event, std::bind(refreshObjects));
+ reloadTimer = std::make_unique<Timer>(event, std::bind(reloadNetworkd));
}
} // namespace network