From 004d7412964fd9bc70c6abf85d3cf0d2e9aa34c7 Mon Sep 17 00:00:00 2001 From: shi-su Date: Fri, 12 Feb 2021 00:41:53 +0000 Subject: [PATCH] Add an optional parameter context --- orchagent/orch.cpp | 18 +++++++++--------- orchagent/orch.h | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/orchagent/orch.cpp b/orchagent/orch.cpp index 0a54377a40e..a51dacb14a8 100644 --- a/orchagent/orch.cpp +++ b/orchagent/orch.cpp @@ -686,7 +686,7 @@ Executor *Orch::getExecutor(string executorName) return NULL; } -bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status) +bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status, void *context) { /* * This function aims to provide coarse handling of failures in sairedis create @@ -694,8 +694,8 @@ bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status) * Return value: true - Handled the status successfully. No need to retry this SAI operation. * false - Cannot handle the status. Need to retry the SAI operation. * TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_ITEM_ALREADY_EXISTS) - * 2. Develop fine-grain failure handling mechanisms specific and replace - * this coarse handling in each orch. + * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling + * in each orch. * 3. Take the type of sai api into consideration. */ switch (status) @@ -711,7 +711,7 @@ bool Orch::handleSaiCreateStatus(sai_api_t api, sai_status_t status) return false; } -bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status) +bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status, void *context) { /* * This function aims to provide coarse handling of failures in sairedis set @@ -719,8 +719,8 @@ bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status) * Return value: true - Handled the status successfully. No need to retry this SAI operation. * false - Cannot handle the status. Need to retry the SAI operation. * TODO: 1. Add general handling logic for specific statuses - * 2. Develop fine-grain failure handling mechanisms specific and replace - * this coarse handling in each orch. + * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling + * in each orch. * 3. Take the type of sai api into consideration. */ switch (status) @@ -736,7 +736,7 @@ bool Orch::handleSaiSetStatus(sai_api_t api, sai_status_t status) return false; } -bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status) +bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status, void *context) { /* * This function aims to provide coarse handling of failures in sairedis remove @@ -745,8 +745,8 @@ bool Orch::handleSaiRemoveStatus(sai_api_t api, sai_status_t status) * false - Cannot handle the status. Need to retry the SAI operation. * TODO: 1. Add general handling logic for specific statuses (e.g., SAI_STATUS_OBJECT_IN_USE, * SAI_STATUS_ITEM_NOT_FOUND) - * 2. Develop fine-grain failure handling mechanisms specific and replace - * this coarse handling in each orch. + * 2. Develop fine-grain failure handling mechanisms and replace this coarse handling + * in each orch. * 3. Take the type of sai api into consideration. */ switch (status) diff --git a/orchagent/orch.h b/orchagent/orch.h index 2c5376a6d3e..fcecf98a22d 100644 --- a/orchagent/orch.h +++ b/orchagent/orch.h @@ -237,9 +237,9 @@ class Orch Executor *getExecutor(std::string executorName); /* Handling SAI status*/ - virtual bool handleSaiCreateStatus(sai_api_t api, sai_status_t status); - virtual bool handleSaiSetStatus(sai_api_t api, sai_status_t status); - virtual bool handleSaiRemoveStatus(sai_api_t api, sai_status_t status); + virtual bool handleSaiCreateStatus(sai_api_t api, sai_status_t status, void *context = nullptr); + virtual bool handleSaiSetStatus(sai_api_t api, sai_status_t status, void *context = nullptr); + virtual bool handleSaiRemoveStatus(sai_api_t api, sai_status_t status, void *context = nullptr); private: void removeMeFromObjsReferencedByMe(type_map &type_maps, const std::string &table, const std::string &obj_name, const std::string &field, const std::string &old_referenced_obj_name); void addConsumer(swss::DBConnector *db, std::string tableName, int pri = default_orch_pri);