Skip to content

Commit

Permalink
Fix portmgr write partial port config to app DB issue. (sonic-net#3304)
Browse files Browse the repository at this point in the history
Fix portmgr write partial port config to app DB issue.

Why I did it
Test case test_add_remove_neg_admin_status unstable.
  • Loading branch information
liuh-80 authored Oct 4, 2024
1 parent 3c230d2 commit 8b99543
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions cfgmgr/portmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ void PortMgr::doTask(Consumer &consumer)
}
}

if (!portOk)
{
// Port configuration is handled by the orchagent. If the configuration is written to the APP DB using
// multiple Redis write commands, the orchagent may receive a partial configuration and create a port
// with incorrect settings.
field_values.emplace_back("mtu", mtu);
field_values.emplace_back("admin_status", admin_status);
}

if (field_values.size())
{
writeConfigToAppDb(alias, field_values);
Expand All @@ -201,8 +210,6 @@ void PortMgr::doTask(Consumer &consumer)
{
SWSS_LOG_INFO("Port %s is not ready, pending...", alias.c_str());

writeConfigToAppDb(alias, "mtu", mtu);
writeConfigToAppDb(alias, "admin_status", admin_status);
/* Retry setting these params after the netdev is created */
field_values.clear();
field_values.emplace_back("mtu", mtu);
Expand Down

0 comments on commit 8b99543

Please sign in to comment.