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 reboot] Warm Reboot Support for EVPN VXLAN #350

Merged
merged 3 commits into from
Oct 12, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
35 changes: 35 additions & 0 deletions common/warm_restart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,41 @@ bool WarmStart::isSystemWarmRebootEnabled(void)
return warmStart.m_systemWarmRebootEnabled;
}

void WarmStart::getWarmStartState(const std::string &app_name, WarmStartState &state)
Copy link
Contributor

@qiluo-msft qiluo-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WarmStartState [](start = 63, length = 14)

Why not just return this state? #WontFix

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't see any issue with pass by reference. Will consider that while updating other files where this api is used.

{
//WarmStartStateNameMap::iterator it;
Copy link
Contributor

@qiluo-msft qiluo-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//WarmStartStateNameMap::iterator it; [](start = 4, length = 37)

Remove commented code #Closed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove

std::string statestr;

auto& warmStart = getInstance();

state = RECONCILED;

if(!isWarmStart())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please have a space after if, also with open/close braces. Please do it for the rest of the if and for below

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

return;

warmStart.m_stateWarmRestartTable->hget(app_name, "state", statestr);

/* If warm-start is enabled, state cannot be assumed as Reconciled
* It should be set to unknown
*/
state = WSUNKNOWN;
Copy link
Contributor

@qiluo-msft qiluo-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

state = WSUNKNOWN; [](start = 4, length = 18)

Is it expected state in runtime? If not, just throw an exception. #Closed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is expected. When Module A check for the status of Module B, module B may not have reached/initialised to any state yet. Hence module A needs to know that Module B is not ready yet an act accordingly.


for(std::map<WarmStart::WarmStartState, std::string>::const_iterator it = warmStartStateNameMap.begin(); it != warmStartStateNameMap.end(); it++)
Copy link
Contributor

@qiluo-msft qiluo-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::map<WarmStart::WarmStartState, std::string>::const_iterator [](start = 8, length = 64)

auto? #Closed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update

{
if(it->second == statestr)
{
state = it->first;
break;
}
Copy link
Contributor

@qiluo-msft qiluo-msft Sep 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[](start = 4, length = 2)

Use 4x spaces as indentation #Closed

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will change

}

SWSS_LOG_INFO("%s warm start state get %s(%d)",
app_name.c_str(), statestr.c_str(), state);

return;
}


// Set the WarmStart FSM state for a particular application.
void WarmStart::setWarmStartState(const std::string &app_name, WarmStartState state)
{
Expand Down
6 changes: 6 additions & 0 deletions common/warm_restart.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ class WarmStart
{
INITIALIZED,
RESTORED,
REPLAYED,
RECONCILED,
WSDISABLED,
WSUNKNOWN,
};

enum DataCheckState
Expand Down Expand Up @@ -53,6 +56,9 @@ class WarmStart

static bool isSystemWarmRebootEnabled(void);

static void getWarmStartState(const std::string &app_name,
WarmStartState &state);

static void setWarmStartState(const std::string &app_name,
WarmStartState state);

Expand Down