From 7c90bb31abb808a45a665bb1212a526c89770918 Mon Sep 17 00:00:00 2001 From: Qi Luo Date: Fri, 19 Oct 2018 14:11:03 -0700 Subject: [PATCH] Fix portorch bake: get port count from db (#645) * Fix portorch bake: get port count from db * Refine logging --- orchagent/portsorch.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index 9e5a5b9272ab..06f5c83346e4 100644 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -1312,8 +1312,10 @@ bool PortsOrch::bake() // Check the APP_DB port table for warm reboot vector 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); @@ -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;