Skip to content

Commit

Permalink
Add warm-reboot mode for teammgrd (#678)
Browse files Browse the repository at this point in the history
* Add Warm-reboot mode for teammgrd
  • Loading branch information
pavel-shirshov committed Nov 9, 2018
1 parent 8c60787 commit 9fbcb60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cfgmgr/teammgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "logger.h"
#include "shellcmd.h"
#include "tokenize.h"
#include "warm_restart.h"

#include <algorithm>
#include <sstream>
Expand Down Expand Up @@ -380,7 +381,15 @@ bool TeamMgr::addLag(const string &alias, int min_links, bool fallback)
SWSS_LOG_INFO("Port channel %s teamd configuration: %s",
alias.c_str(), conf.str().c_str());

cmd << TEAMD_CMD << " -r -t " << alias << " -c " << conf.str() << " -d";
string warmstart_flag = WarmStart::isWarmStart() ? " -w " : "";
const string dump_path = "/var/warmboot/teamd/";

cmd << TEAMD_CMD
<< warmstart_flag
<< " -r -t " << alias
<< " -c " << conf.str()
<< " -L " << dump_path
<< " -d";
EXEC_WITH_ERROR_THROW(cmd.str(), res);

SWSS_LOG_NOTICE("Start port channel %s with teamd", alias.c_str());
Expand Down
4 changes: 4 additions & 0 deletions cfgmgr/teammgrd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "netdispatcher.h"
#include "netlink.h"
#include "select.h"
#include "warm_restart.h"

using namespace std;
using namespace swss;
Expand All @@ -29,6 +30,9 @@ int main(int argc, char **argv)
DBConnector app_db(APPL_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);
DBConnector state_db(STATE_DB, DBConnector::DEFAULT_UNIXSOCKET, 0);

WarmStart::initialize("teammgrd");
WarmStart::checkWarmStart("teammgrd");

TableConnector conf_lag_table(&conf_db, CFG_LAG_TABLE_NAME);
TableConnector conf_lag_member_table(&conf_db, CFG_LAG_MEMBER_TABLE_NAME);
TableConnector state_port_table(&state_db, STATE_PORT_TABLE_NAME);
Expand Down

0 comments on commit 9fbcb60

Please sign in to comment.