Hi Thang
ack (review only), with a minor comment.
On 08/10/18 20:41, thang.nguyen wrote:
In some condition, due to the AMF implementer released
was not synced to the remain SC. So the ERR_EXIST returned
when trying invoking implementer set on the remain SC.
Add some retries on the ERR_EXIST.
---
src/amf/amfd/role.cc | 27 ++++++++++++++++++++++++---
src/clm/clmd/clms_imm.cc | 10 ++++++++++
2 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/src/amf/amfd/role.cc b/src/amf/amfd/role.cc
index 790983e..dc71665 100644
--- a/src/amf/amfd/role.cc
+++ b/src/amf/amfd/role.cc
@@ -49,12 +49,14 @@
#include "base/osaf_utility.h"
#include "role.h"
#include "nid/agent/nid_api.h"
+#include "base/osaf_time.h"
extern pthread_mutex_t imm_reinit_mutex;
static uint32_t avd_role_failover(AVD_CL_CB *cb, SaAmfHAStateT role);
static uint32_t avd_role_failover_qsd_actv(AVD_CL_CB *cb, SaAmfHAStateT role);
static uint32_t avd_rde_set_role(SaAmfHAStateT role);
+extern struct ImmutilWrapperProfile immutilWrapperProfile;
/****************************************************************************\
* Function: avd_role_change
@@ -259,12 +261,31 @@ done:
\**************************************************************************/
uint32_t avd_active_role_initialization(AVD_CL_CB *cb, SaAmfHAStateT role) {
uint32_t status = NCSCC_RC_FAILURE;
+ SaAisErrorT rc = SA_AIS_OK;
TRACE_ENTER();
- if (avd_imm_impl_set() != SA_AIS_OK) {
- LOG_ER("avd_imm_impl_set FAILED");
- goto done;
+ struct timespec time = {0, 0};
+ uint32_t no_of_retries = 0;
+ const uint32_t MAX_NO_RETRIES = immutilWrapperProfile.nTries;
+ osaf_millis_to_timespec(immutilWrapperProfile.retryInterval, &time);
+ /*
+ * Some retries in case takeover with consensus
+ * when OI not released/synced yet
+ */
+ while (++no_of_retries < MAX_NO_RETRIES) {
+ rc = avd_imm_impl_set();
+ if (rc != SA_AIS_OK) {
+ if (rc == SA_AIS_ERR_EXIST) {
+ osaf_nanosleep(&time);
+ continue;
+ } else {
+ LOG_ER("avd_imm_impl_set FAILED");
+ goto done;
+ }
+ } else {
+ break;
+ }
}
if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
diff --git a/src/clm/clmd/clms_imm.cc b/src/clm/clmd/clms_imm.cc
index 076890e..8c409cf 100644
--- a/src/clm/clmd/clms_imm.cc
+++ b/src/clm/clmd/clms_imm.cc
@@ -534,6 +534,16 @@ SaAisErrorT clms_imm_activate(CLMS_CB *cb) {
}
continue;
}
+ /*
+ * Some retries in case takeover with consensus
+ * when OI not released/synced yet
+ */
[GL] 'else if (rc == SA_AIS_ERR_EXIST)' is probably better.
+ if (rc == SA_AIS_ERR_EXIST) {
+ LOG_WA("saImmOiImplementerSet returned %u", (unsigned)rc);
+ usleep(sleep_delay_ms * 1000);
+ msecs_waited += sleep_delay_ms;
+ continue;
+ }
if (rc != SA_AIS_OK) {
LOG_ER("saImmOiImplementerSet failed rc: %u", (unsigned)rc);
goto done;
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel