diff --git a/cfgmgr/portmgr.cpp b/cfgmgr/portmgr.cpp index 19ba41dc90..dcc71c6600 100644 --- a/cfgmgr/portmgr.cpp +++ b/cfgmgr/portmgr.cpp @@ -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); @@ -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);