Skip to content

Commit

Permalink
Check warmboot flag during initialization (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
prsunny authored Sep 16, 2019
1 parent d98d1e9 commit 3fb22e1
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions cfgmgr/nbrmgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "exec.h"
#include "schema.h"
#include "nbrmgr.h"
#include "warm_restart.h"

using namespace std;
using namespace swss;
Expand Down Expand Up @@ -54,19 +55,25 @@ int main(int argc, char **argv)

NbrMgr nbrmgr(&cfgDb, &appDb, &stateDb, cfg_nbr_tables);

chrono::steady_clock::time_point starttime = chrono::steady_clock::now();
while (!nbrmgr.isNeighRestoreDone())
WarmStart::initialize("nbrmgrd", "swss");
WarmStart::checkWarmStart("nbrmgrd", "swss");

if (WarmStart::isWarmStart())
{
chrono::duration<double> time_span = chrono::duration_cast<chrono::duration<double>>
(chrono::steady_clock::now() - starttime);
int pasttime = int(time_span.count());
SWSS_LOG_INFO("Kernel neighbor table restoration waited for %d seconds", pasttime);
if (pasttime > RESTORE_NEIGH_WAIT_TIME_OUT)
chrono::steady_clock::time_point starttime = chrono::steady_clock::now();
while (!nbrmgr.isNeighRestoreDone())
{
SWSS_LOG_WARN("Kernel neighbor table restore is not finished!");
break;
chrono::duration<double> time_span = chrono::duration_cast<chrono::duration<double>>
(chrono::steady_clock::now() - starttime);
int pasttime = int(time_span.count());
SWSS_LOG_INFO("Kernel neighbor table restoration waited for %d seconds", pasttime);
if (pasttime > RESTORE_NEIGH_WAIT_TIME_OUT)
{
SWSS_LOG_WARN("Kernel neighbor table restore is not finished!");
break;
}
sleep(RESTORE_NEIGH_WAIT_TIME_INT);
}
sleep(RESTORE_NEIGH_WAIT_TIME_INT);
}

std::vector<Orch *> cfgOrchList = {&nbrmgr};
Expand Down

0 comments on commit 3fb22e1

Please sign in to comment.