Skip to content

Commit 47b4276

Browse files
stephenxsShi Su
authored and
Shi Su
committed
[BufferOrch] Don't call SAI API for BUFFER_POOL/PROFILE handling in case the op is DEL and the SAI OID is NULL (#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 db9238f commit 47b4276

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
@@ -448,14 +448,17 @@ task_process_status BufferOrch::processBufferPool(KeyOpFieldsValuesTuple &tuple)
448448
return task_process_status::task_need_retry;
449449
}
450450

451-
sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
452-
if (SAI_STATUS_SUCCESS != sai_status)
451+
if (SAI_NULL_OBJECT_ID != sai_object)
453452
{
454-
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);
455-
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
456-
if (handle_status != task_process_status::task_success)
453+
sai_status = sai_buffer_api->remove_buffer_pool(sai_object);
454+
if (SAI_STATUS_SUCCESS != sai_status)
457455
{
458-
return handle_status;
456+
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);
457+
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
458+
if (handle_status != task_process_status::task_success)
459+
{
460+
return handle_status;
461+
}
459462
}
460463
}
461464
SWSS_LOG_NOTICE("Removed buffer pool %s with type %s", object_name.c_str(), map_type_name.c_str());
@@ -647,14 +650,17 @@ task_process_status BufferOrch::processBufferProfile(KeyOpFieldsValuesTuple &tup
647650
return task_process_status::task_need_retry;
648651
}
649652

650-
sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
651-
if (SAI_STATUS_SUCCESS != sai_status)
653+
if (SAI_NULL_OBJECT_ID != sai_object)
652654
{
653-
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);
654-
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
655-
if (handle_status != task_process_status::task_success)
655+
sai_status = sai_buffer_api->remove_buffer_profile(sai_object);
656+
if (SAI_STATUS_SUCCESS != sai_status)
656657
{
657-
return handle_status;
658+
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);
659+
task_process_status handle_status = handleSaiRemoveStatus(SAI_API_BUFFER, sai_status);
660+
if (handle_status != task_process_status::task_success)
661+
{
662+
return handle_status;
663+
}
658664
}
659665
}
660666

0 commit comments

Comments
 (0)