Skip to content

Commit 3fb22e1

Browse files
authored
Check warmboot flag during initialization (#1057)
1 parent d98d1e9 commit 3fb22e1

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

cfgmgr/nbrmgrd.cpp

+17-10
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "exec.h"
1010
#include "schema.h"
1111
#include "nbrmgr.h"
12+
#include "warm_restart.h"
1213

1314
using namespace std;
1415
using namespace swss;
@@ -54,19 +55,25 @@ int main(int argc, char **argv)
5455

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

57-
chrono::steady_clock::time_point starttime = chrono::steady_clock::now();
58-
while (!nbrmgr.isNeighRestoreDone())
58+
WarmStart::initialize("nbrmgrd", "swss");
59+
WarmStart::checkWarmStart("nbrmgrd", "swss");
60+
61+
if (WarmStart::isWarmStart())
5962
{
60-
chrono::duration<double> time_span = chrono::duration_cast<chrono::duration<double>>
61-
(chrono::steady_clock::now() - starttime);
62-
int pasttime = int(time_span.count());
63-
SWSS_LOG_INFO("Kernel neighbor table restoration waited for %d seconds", pasttime);
64-
if (pasttime > RESTORE_NEIGH_WAIT_TIME_OUT)
63+
chrono::steady_clock::time_point starttime = chrono::steady_clock::now();
64+
while (!nbrmgr.isNeighRestoreDone())
6565
{
66-
SWSS_LOG_WARN("Kernel neighbor table restore is not finished!");
67-
break;
66+
chrono::duration<double> time_span = chrono::duration_cast<chrono::duration<double>>
67+
(chrono::steady_clock::now() - starttime);
68+
int pasttime = int(time_span.count());
69+
SWSS_LOG_INFO("Kernel neighbor table restoration waited for %d seconds", pasttime);
70+
if (pasttime > RESTORE_NEIGH_WAIT_TIME_OUT)
71+
{
72+
SWSS_LOG_WARN("Kernel neighbor table restore is not finished!");
73+
break;
74+
}
75+
sleep(RESTORE_NEIGH_WAIT_TIME_INT);
6876
}
69-
sleep(RESTORE_NEIGH_WAIT_TIME_INT);
7077
}
7178

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

0 commit comments

Comments
 (0)