Skip to content

Commit

Permalink
Fix portorch bake: get port count from db (#645)
Browse files Browse the repository at this point in the history
* Fix portorch bake: get port count from db
* Refine logging
  • Loading branch information
qiluo-msft authored Oct 19, 2018
1 parent 68a9629 commit 7c90bb3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,10 @@ bool PortsOrch::bake()

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

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

if (m_portCount != keys.size() - 2)
if (portCount != keys.size() - 2)
{
// Invalid port table
SWSS_LOG_ERROR("Invalid port table: m_portCount, expecting %u, got %lu",
m_portCount, keys.size() - 2);
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %lu, got %lu",
portCount, keys.size() - 2);

cleanPortTable(keys);
return false;
Expand Down

0 comments on commit 7c90bb3

Please sign in to comment.