ACK Tested with normal 4 node cluster ( NOT with spare ).
-AVM On 4/28/2016 8:10 PM, mathi.naic...@oracle.com wrote: > osaf/services/saf/cpsv/cpd/cpd_init.c | 94 > +++++++++++++++++++--------------- > 1 files changed, 52 insertions(+), 42 deletions(-) > > > With the introduction of spares support #79, all services were modified to > wait for AMF role assignment > to register with MDS and proceed further with their lifecycle. > However, this is not necessary and would create a problem of 1781. > i.e. All services should ideally register with CLM independent of their HA > roles as provided by AMF or RDA. > But ofcourse until now only AMF, EVT, CKPT, MSG, NTF, SMF have been > integrated with CLM. > This patch makes the services register with CLM before entering the wait() > for AMF role. > NTF service is already handling this correctly. > This is also necessary to make OpenSAF services run - without abort, on nodes > that are administratively > locked/shutdown via CLM node admin commands. > A separate patch for SMF follow. > > diff --git a/osaf/services/saf/cpsv/cpd/cpd_init.c > b/osaf/services/saf/cpsv/cpd/cpd_init.c > --- a/osaf/services/saf/cpsv/cpd/cpd_init.c > +++ b/osaf/services/saf/cpsv/cpd/cpd_init.c > @@ -150,6 +150,53 @@ static uint32_t cpd_extract_destroy_info > return (NCSCC_RC_SUCCESS); > } > > +static SaAisErrorT cpd_clm_init(CPD_CB *cb) > +{ > + SaAisErrorT error; > + SaClmCallbacksT cpd_clm_cbk; > + > + /* Callbacks to register with CLM */ > + cpd_clm_cbk.saClmClusterNodeGetCallback = NULL; > + cpd_clm_cbk.saClmClusterTrackCallback = cpd_clm_cluster_track_cb; > + > + for (;;) { > + SaVersionT clm_version; > + m_CPSV_GET_AMF_VER(clm_version); > + error = saClmInitialize(&cb->clm_hdl, &cpd_clm_cbk, > &clm_version); > + if (error == SA_AIS_ERR_TRY_AGAIN || > + error == SA_AIS_ERR_TIMEOUT || > + error == SA_AIS_ERR_UNAVAILABLE) { > + if (error != SA_AIS_ERR_TRY_AGAIN) { > + LOG_WA("saClmInitialize returned %u", > + (unsigned) error); > + } > + osaf_nanosleep(&kHundredMilliseconds); > + continue; > + } > + if (error == SA_AIS_OK) break; > + LOG_ER("Failed to Initialize with CLM: %u", error); > + return error; > + } > + > + error = saClmSelectionObjectGet(cb->clm_hdl, &cb->clm_sel_obj); > + if (error != SA_AIS_OK) { > + LOG_ER("cpd clm selectionobjget failed %u",error); > + goto done; > + } > + > + /* Start Cluster Tracking */ > + error = saClmClusterTrack(cb->clm_hdl, SA_TRACK_CHANGES_ONLY, NULL); > + if (error != SA_AIS_OK) { > + LOG_ER("cpd clm cluster track failed %u",error); > + goto done; > + } > + > +done: > + saClmFinalize(cb->clm_hdl); > + > + return error; > +} > + > > /**************************************************************************** > * Name : cpd_lib_init > * > @@ -234,8 +281,7 @@ static uint32_t cpd_lib_init(CPD_CREATE_ > goto amf_reg_err; > } > > - /* Register with CLM */ > - > + /* Request AMF for Healthcheck */ > memset(&healthy, 0, sizeof(healthy)); > health_key = (int8_t *)getenv("CPSV_ENV_HEALTHCHECK_KEY"); > if (health_key == NULL) { > @@ -258,6 +304,10 @@ static uint32_t cpd_lib_init(CPD_CREATE_ > LOG_ER("cpd health check start failed"); > } > > + /* Initialize with CLM */ > + if (cpd_clm_init(cb) != SA_AIS_OK) > + goto cpd_mab_fail; > + > if ((rc = initialize_for_assignment(cb, cb->ha_state)) != > NCSCC_RC_SUCCESS) { > LOG_ER("initialize_for_assignment FAILED %u", (unsigned) rc); > @@ -298,9 +348,7 @@ static uint32_t cpd_lib_init(CPD_CREATE_ > uint32_t initialize_for_assignment(CPD_CB *cb, SaAmfHAStateT ha_state) > { > TRACE_ENTER2("ha_state = %d", (int) ha_state); > - SaClmCallbacksT cpd_clm_cbk; > uint32_t rc = NCSCC_RC_SUCCESS; > - SaAisErrorT error; > if (cb->fully_initialized || ha_state == SA_AMF_HA_QUIESCED) { > goto done; > } > @@ -315,43 +363,6 @@ uint32_t initialize_for_assignment(CPD_C > goto mbcsv_reg_err; > } > > - cpd_clm_cbk.saClmClusterNodeGetCallback = NULL; > - cpd_clm_cbk.saClmClusterTrackCallback = cpd_clm_cluster_track_cb; > - > - for (;;) { > - SaVersionT clm_version; > - m_CPSV_GET_AMF_VER(clm_version); > - error = saClmInitialize(&cb->clm_hdl, &cpd_clm_cbk, > &clm_version); > - if (error == SA_AIS_ERR_TRY_AGAIN || > - error == SA_AIS_ERR_TIMEOUT || > - error == SA_AIS_ERR_UNAVAILABLE) { > - if (error != SA_AIS_ERR_TRY_AGAIN) { > - LOG_WA("saClmInitialize returned %u", > - (unsigned) error); > - } > - osaf_nanosleep(&kHundredMilliseconds); > - continue; > - } > - if (error == SA_AIS_OK) break; > - LOG_ER("Failed to Initialize with CLM: %u", error); > - rc = NCSCC_RC_FAILURE; > - goto cpd_clm_fail; > - } > - > - error = saClmSelectionObjectGet(cb->clm_hdl, &cb->clm_sel_obj); > - if (error != SA_AIS_OK) { > - LOG_ER("cpd clm selectionobjget failed %u",error); > - rc = NCSCC_RC_FAILURE; > - goto cpd_imm_fail; > - } > - > - error = saClmClusterTrack(cb->clm_hdl, SA_TRACK_CHANGES_ONLY, NULL); > - if (error != SA_AIS_OK) { > - LOG_ER("cpd clm cluster track failed %u",error); > - rc = NCSCC_RC_FAILURE; > - goto cpd_imm_fail; > - } > - > if (cpd_imm_init(&cb->immOiHandle, &cb->imm_sel_obj) != SA_AIS_OK) { > LOG_ER("cpd imm initialize failed "); > rc = NCSCC_RC_FAILURE; > @@ -363,7 +374,6 @@ done: > return rc; > cpd_imm_fail: > saClmFinalize(cb->clm_hdl); > -cpd_clm_fail: > cpd_mbcsv_finalize(cb); > mbcsv_reg_err: > cpd_mds_unregister(cb); ------------------------------------------------------------------------------ Find and fix application performance issues faster with Applications Manager Applications Manager provides deep performance insights into multiple tiers of your business applications. It resolves application problems quickly and reduces your MTTR. Get your free trial! https://ad.doubleclick.net/ddm/clk/302982198;130105516;z _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel