Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[warm-restart] Fix teamd container warm restart issue #1810

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions teamsyncd/teamsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ TeamSync::TeamSync(DBConnector *db, DBConnector *stateDb, Select *select) :
m_select(select),
m_lagTable(db, APP_LAG_TABLE_NAME),
m_lagMemberTable(db, APP_LAG_MEMBER_TABLE_NAME),
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME)
m_stateLagTable(stateDb, STATE_LAG_TABLE_NAME),
m_stateWarmRestartEnableTable(stateDb, STATE_WARM_RESTART_ENABLE_TABLE_NAME)
{
WarmStart::initialize(TEAMSYNCD_APP_NAME, "teamd");
WarmStart::checkWarmStart(TEAMSYNCD_APP_NAME, "teamd");
Expand Down Expand Up @@ -215,13 +216,25 @@ void TeamSync::removeLag(const string &lagName)
void TeamSync::cleanTeamSync()
{
SWSS_LOG_ENTER();
SWSS_LOG_NOTICE("Cleaning up LAG teamd resources ...");

for (const auto& it: m_teamSelectables)
std::string team_value, system_value;
m_stateWarmRestartEnableTable.hget("system", "enable", system_value);
m_stateWarmRestartEnableTable.hget("teamd", "enable", team_value);
if (system_value == "true" || team_value == "true")
{
/* Cleanup LAG */
removeLag(it.first);
SWSS_LOG_NOTICE("Warm restart enabled, skip cleaning teamd");
}
else
{
SWSS_LOG_NOTICE("Cleaning up LAG teamd resources ...");

for (const auto& it: m_teamSelectables)
{
/* Cleanup LAG */
removeLag(it.first);
}
}

return;
}

Expand Down
1 change: 1 addition & 0 deletions teamsyncd/teamsync.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class TeamSync : public NetMsg
ProducerStateTable m_lagTable;
ProducerStateTable m_lagMemberTable;
Table m_stateLagTable;
Table m_stateWarmRestartEnableTable;

bool m_warmstart;
std::unordered_map<std::string, std::vector<FieldValueTuple>> m_stateLagTablePreserved;
Expand Down