Skip to content

Commit a732858

Browse files
authored
Process only shutdown requests after pre shutdown (sonic-net#395)
1 parent 1288f77 commit a732858

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

syncd/syncd.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -3672,7 +3672,9 @@ int syncd_main(int argc, char **argv)
36723672
{
36733673
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_RESTART_WARM=true: %s for pre-shutdown",
36743674
sai_serialize_status(status).c_str());
3675+
36753676
shutdownType = SYNCD_RESTART_TYPE_COLD;
3677+
36763678
warmRestartTable->hset("warm-shutdown", "state", "set-flag-failed");
36773679
continue;
36783680
}
@@ -3681,14 +3683,22 @@ int syncd_main(int argc, char **argv)
36813683
attr.value.booldata = true;
36823684

36833685
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
3686+
36843687
if (status == SAI_STATUS_SUCCESS)
36853688
{
36863689
warmRestartTable->hset("warm-shutdown", "state", "pre-shutdown-succeeded");
3690+
3691+
s = swss::Select();
3692+
3693+
s.addSelectable(restartQuery.get());
3694+
3695+
SWSS_LOG_NOTICE("switched to PRE_SHUTDOWN, from now on accepting only shurdown requests");
36873696
}
36883697
else
36893698
{
36903699
SWSS_LOG_ERROR("Failed to set SAI_SWITCH_ATTR_PRE_SHUTDOWN=true: %s",
36913700
sai_serialize_status(status).c_str());
3701+
36923702
warmRestartTable->hset("warm-shutdown", "state", "pre-shutdown-failed");
36933703

36943704
// Restore cold shutdown.

0 commit comments

Comments
 (0)