Skip to content

Commit 7c90bb3

Browse files
authored
Fix portorch bake: get port count from db (sonic-net#645)
* Fix portorch bake: get port count from db * Refine logging
1 parent 68a9629 commit 7c90bb3

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

orchagent/portsorch.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -1312,8 +1312,10 @@ bool PortsOrch::bake()
13121312

13131313
// Check the APP_DB port table for warm reboot
13141314
vector<FieldValueTuple> tuples;
1315-
bool foundPortConfigDone = m_portTable->get("PortConfigDone", tuples);
1316-
SWSS_LOG_NOTICE("foundPortConfigDone = %d", foundPortConfigDone);
1315+
string value;
1316+
bool foundPortConfigDone = m_portTable->hget("PortConfigDone", "count", value);
1317+
unsigned long portCount = stoul(value);
1318+
SWSS_LOG_NOTICE("foundPortConfigDone = %d, portCount = %lu, m_portCount = %u", foundPortConfigDone, portCount, m_portCount);
13171319

13181320
bool foundPortInitDone = m_portTable->get("PortInitDone", tuples);
13191321
SWSS_LOG_NOTICE("foundPortInitDone = %d", foundPortInitDone);
@@ -1329,11 +1331,11 @@ bool PortsOrch::bake()
13291331
return false;
13301332
}
13311333

1332-
if (m_portCount != keys.size() - 2)
1334+
if (portCount != keys.size() - 2)
13331335
{
13341336
// Invalid port table
1335-
SWSS_LOG_ERROR("Invalid port table: m_portCount, expecting %u, got %lu",
1336-
m_portCount, keys.size() - 2);
1337+
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %lu, got %lu",
1338+
portCount, keys.size() - 2);
13371339

13381340
cleanPortTable(keys);
13391341
return false;

0 commit comments

Comments
 (0)