From cd82389904311ec53aa6bf5b06d1c83ea262fbbe Mon Sep 17 00:00:00 2001 From: Vasant Patil <36455926+vasant17@users.noreply.github.com> Date: Mon, 6 Apr 2020 09:01:38 +0000 Subject: [PATCH] Return correct error code when port is in use (#565) Co-authored-by: Vasant --- meta/Meta.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/meta/Meta.cpp b/meta/Meta.cpp index 354b8c7f1f05..6e1637cdce2e 100644 --- a/meta/Meta.cpp +++ b/meta/Meta.cpp @@ -2958,7 +2958,7 @@ sai_status_t Meta::meta_generic_validation_remove( SWSS_LOG_ERROR("object 0x%" PRIx64 " reference count is %d, can't remove", oid, count); - return SAI_STATUS_INVALID_PARAMETER; + return SAI_STATUS_OBJECT_IN_USE; } if (meta_key.objecttype == SAI_OBJECT_TYPE_PORT) @@ -2987,14 +2987,6 @@ sai_status_t Meta::meta_port_remove_validation( return SAI_STATUS_SUCCESS; } - if (m_oids.getObjectReferenceCount(port_id) != 0) - { - SWSS_LOG_ERROR("port %s reference count is not zero, can't remove", - sai_serialize_object_id(port_id).c_str()); - - return SAI_STATUS_OBJECT_IN_USE; - } - if (!meta_is_object_in_default_state(port_id)) { SWSS_LOG_ERROR("port %s is not in default state, can't remove",