Skip to content

Commit 3226163

Browse files
authored
[BufferOrch] Don't call SAI API for BUFFER_POOL/PROFILE handling in case the op is DEL and the SAI OID is NULL (sonic-net#1786)
- What I did Don't call SAI API for BUFFER_POOL/PROFILE handling in case the op is DEL and the SAI OID is NULL in order to avoid orchagent from exiting. We need it only in 202106 or above. In 202012 the orchagent won't exit in such case. - Why I did it Handle rare cases which cause SAI error eventually makes orchagent to exit. - How I verified it Manually test. Signed-off-by: Stephen Sun <[email protected]>
1 parent 6c88e47 commit 3226163

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

orchagent/bufferorch.cpp

+18-12
Original file line numberDiff line numberDiff line change
@@ -452,14 +452,17 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
452452
return task_process_status::task_need_retry;
453453
}
454454

455-
sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
456-
if (SAI_STATUS_SUCCESS != sai_status)
455+
if (SAI_NULL_OBJECT_ID != sai_object)
457456
{
458-
SWSS_LOG_ERROR("Failed to remove buffer pool %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
459-
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
460-
if (handle_status != task_process_status::task_success)
457+
sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
458+
if (SAI_STATUS_SUCCESS != sai_status)
461459
{
462-
return handle_status;
460+
SWSS_LOG_ERROR("Failed to remove buffer pool %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
461+
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
462+
if (handle_status != task_process_status::task_success)
463+
{
464+
return handle_status;
465+
}
463466
}
464467
}
465468
SWSS_LOG_NOTICE("Removed buffer pool %s with type %s", object_name.c_str(), map_type_name.c_str());
@@ -651,14 +654,17 @@ task_process_status BufferOrch::processBufferProfile(KeyOpFieldsValuesTuple &tup
651654
return task_process_status::task_need_retry;
652655
}
653656

654-
sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
655-
if (SAI_STATUS_SUCCESS != sai_status)
657+
if (SAI_NULL_OBJECT_ID != sai_object)
656658
{
657-
SWSS_LOG_ERROR("Failed to remove buffer profile %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
658-
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
659-
if (handle_status != task_process_status::task_success)
659+
sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
660+
if (SAI_STATUS_SUCCESS != sai_status)
660661
{
661-
return handle_status;
662+
SWSS_LOG_ERROR("Failed to remove buffer profile %s with type %s, rv:%d", object_name.c_str(), map_type_name.c_str(), sai_status);
663+
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
664+
if (handle_status != task_process_status::task_success)
665+
{
666+
return handle_status;
667+
}
662668
}
663669
}
664670

0 commit comments

Comments
 (0)