Skip to content

Commit

Permalink
[syncd] Notify orchagent instead of shutting down swss when translate…
Browse files Browse the repository at this point in the history
…VidToRid fails in processClearStatsEvent (#668)
  • Loading branch information
shi-su authored Oct 8, 2020
1 parent 924cb46 commit 573d5c1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
8 changes: 7 additions & 1 deletion syncd/Syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,13 @@ sai_status_t Syncd::processClearStatsEvent(
sai_object_meta_key_t metaKey;
sai_deserialize_object_meta_key(key, metaKey);

m_translator->translateVidToRid(metaKey);
if (!m_translator->tryTranslateVidToRid(metaKey))
{
SWSS_LOG_WARN("VID to RID translation failure: %s", key.c_str());
sai_status_t status = SAI_STATUS_INVALID_OBJECT_ID;
m_getResponse->set(sai_serialize_status(status), {}, REDIS_ASIC_STATE_COMMAND_GETRESPONSE);
return status;
}

auto info = sai_metadata_get_object_type_info(metaKey.objecttype);

Expand Down
17 changes: 17 additions & 0 deletions syncd/VirtualOidTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,23 @@ bool VirtualOidTranslator::tryTranslateVidToRid(
}
}

bool VirtualOidTranslator::tryTranslateVidToRid(
_Inout_ sai_object_meta_key_t &metaKey)
{
SWSS_LOG_ENTER();

try
{
translateVidToRid(metaKey);
return true;
}
catch (const std::exception& e)
{
// message was logged already when throwing
return false;
}
}

void VirtualOidTranslator::translateVidToRid(
_Inout_ sai_object_list_t &element)
{
Expand Down
3 changes: 3 additions & 0 deletions syncd/VirtualOidTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ namespace syncd
void translateVidToRid(
_Inout_ sai_object_meta_key_t &metaKey);

bool tryTranslateVidToRid(
_Inout_ sai_object_meta_key_t &metaKey);

void eraseRidAndVid(
_In_ sai_object_id_t rid,
_In_ sai_object_id_t vid);
Expand Down

0 comments on commit 573d5c1

Please sign in to comment.