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

Process only shutdown requests after pre shutdown #395

Merged
merged 1 commit into from
Dec 5, 2018
Merged
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
10 changes: 10 additions & 0 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3672,7 +3672,9 @@ int syncd_main(int argc, char **argv)
{
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_RESTART_WARM=true: %s for pre-shutdown",
sai_serialize_status(status).c_str());

shutdownType = SYNCD_RESTART_TYPE_COLD;

warmRestartTable->hset("warm-shutdown", "state", "set-flag-failed");
continue;
}
Expand All @@ -3681,14 +3683,22 @@ int syncd_main(int argc, char **argv)
attr.value.booldata = true;

status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);

if (status == SAI_STATUS_SUCCESS)
{
warmRestartTable->hset("warm-shutdown", "state", "pre-shutdown-succeeded");

s = swss::Select();

s.addSelectable(restartQuery.get());

SWSS_LOG_NOTICE("switched to PRE_SHUTDOWN, from now on accepting only shurdown requests");
}
else
{
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_PRE_SHUTDOWN=true: %s",
sai_serialize_status(status).c_str());

warmRestartTable->hset("warm-shutdown", "state", "pre-shutdown-failed");

// Restore cold shutdown.
Expand Down