Ack, one comment below/Thanks HansN -----Original Message----- From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] Sent: den 2 mars 2015 14:35 To: Hans Nordebäck; nagendr...@oracle.com; Bertil Engelholm; mathi.naic...@oracle.com Cc: opensaf-devel@lists.sourceforge.net Subject: [PATCH 5 of 7] amfd : checkpoint saAmfNGAdminState of NG [#1235]
osaf/services/saf/amf/amfd/chkop.cc | 13 ++++ osaf/services/saf/amf/amfd/ckpt_dec.cc | 83 +++++++++++++++++++++++++- osaf/services/saf/amf/amfd/ckpt_edu.cc | 2 + osaf/services/saf/amf/amfd/ckpt_enc.cc | 24 +++++++- osaf/services/saf/amf/amfd/include/ckpt.h | 4 +- osaf/services/saf/amf/amfd/include/ckpt_msg.h | 1 + osaf/services/saf/amf/amfd/nodegroup.cc | 1 + 7 files changed, 120 insertions(+), 8 deletions(-) Checkpointing of saAmfNGAdminState is needed because of two cases: 1)If during shutdown operation controller fail-over or switch-over occurs then new active controller will have to move NG to LOCKED admin state after completion of shutdown operation. 2)For 2N model (in future for NpM and NWay ) AMF performs SG shutdown or lock equivalent admin operation using saAmfSGAdminState if both active and standby SUs are hosted on nodes of nodegroup. So after completion of operation AMF will have to revert back saAmfSGAdminState. In brief changes are: -Patch enhances AMF MBCSV sub part version to 7 as a new async update for saAmfNGAdminState is added. -New aync update counter for updates related to nodegroup (cb->async_updt_cnt.ng_updt). -Encode and decode utility for saAmfNGAdminState. -No async update for saAmfNGAdminState if peer AMFD has lower AVD_MBCSV_SUB_PART_VERSION than the updated version 7 (AVD_MBCSV_SUB_PART_VERSION_7). This is the case when new AMFD is active with new version AVD_MBCSV_SUB_PART_VERSION_7 and old AMFD is standby. -Simlilarly during cold sync update if new AMFD comes as standby with AVD_MBCSV_SUB_PART_VERSION_7 and old AMFD is active with version<AVD_MBCSV_SUB_PART_VERSION_7 then cb->async_updt_cnt.ng_updt will not be matched. diff --git a/osaf/services/saf/amf/amfd/chkop.cc b/osaf/services/saf/amf/amfd/chkop.cc --- a/osaf/services/saf/amf/amfd/chkop.cc +++ b/osaf/services/saf/amf/amfd/chkop.cc @@ -1032,6 +1032,19 @@ uint32_t avsv_send_ckpt_data(AVD_CL_CB * case AVSV_CKPT_AVD_COMP_CS_TYPE_CONFIG: cb->async_updt_cnt.compcstype_updt++; break; + case AVSV_CKPT_NG_ADMIN_STATE: + /* Below check is for the case when new AMFD (AVD_MBCSV_SUB_PART_VERSION_7) is + active and old AMFD (<AVD_MBCSV_SUB_PART_VERSION_7) is standby. + In this case no need to send the message to standby as this async is newly + added. + */ + if (avd_cb->avd_peer_ver < AVD_MBCSV_SUB_PART_VERSION_7) { + LOG_NO("No ckpt for NG_ADMIN_STATE as peer AMFD has" + " lower version:%d", avd_cb->avd_peer_ver); + return NCSCC_RC_SUCCESS; + } + cb->async_updt_cnt.ng_updt++; + break; default: return NCSCC_RC_SUCCESS; diff --git a/osaf/services/saf/amf/amfd/ckpt_dec.cc b/osaf/services/saf/amf/amfd/ckpt_dec.cc --- a/osaf/services/saf/amf/amfd/ckpt_dec.cc +++ b/osaf/services/saf/amf/amfd/ckpt_dec.cc @@ -82,6 +82,7 @@ static uint32_t dec_comp_pres_state(AVD_ static uint32_t dec_comp_restart_count(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec); static uint32_t dec_cs_oper_su(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec); static uint32_t dec_comp_cs_type_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec); +static uint32_t dec_ng_admin_state(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC +*dec); /* Declaration of static cold sync decode functions */ static uint32_t dec_cs_cb_config(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC *dec, uint32_t num_of_obj); @@ -172,7 +173,8 @@ const AVSV_DECODE_CKPT_DATA_FUNC_PTR avd dec_comp_restart_count, NULL, /* AVSV_SYNC_COMMIT */ dec_su_restart_count, - dec_si_dep_state + dec_si_dep_state, + dec_ng_admin_state }; /* @@ -1089,6 +1091,28 @@ static uint32_t dec_sg_admin_state(AVD_C cb->async_updt_cnt.sg_updt++; + //For 2N model check if this checkpointing being done in the context of nodegroup operation. + if ((sg->sg_ncs_spec == false) && (sg->sg_redundancy_model == SA_AMF_2N_REDUNDANCY_MODEL)) { + if (((sg->saAmfSGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) || + (sg->saAmfSGAdminState == SA_AMF_ADMIN_LOCKED)) && + (sg->ng_using_saAmfSGAdminState == false)) { + for (std::map<std::string, AVD_AMF_NG*>::const_iterator it = nodegroup_db->begin(); + it != nodegroup_db->end(); it++) { + AVD_AMF_NG *ng = it->second; + if ((sg->is_sg_assigned_only_in_ng(ng) == true) && + ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) || + (ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED)) && + (sg->sg_fsm_state == AVD_SG_FSM_STABLE)) { + sg->ng_using_saAmfSGAdminState = true; + break; + } + } + } else if ((sg->saAmfSGAdminState == SA_AMF_ADMIN_UNLOCKED) && + (sg->ng_using_saAmfSGAdminState == true)) + sg->ng_using_saAmfSGAdminState = false; + } + TRACE("ng_using_saAmfSGAdminState:%u",sg->ng_using_saAmfSGAdminState); + TRACE_LEAVE2("'%s', saAmfSGAdminState=%u, sg_updt:%d", sg->name.value, sg->saAmfSGAdminState, cb->async_updt_cnt.sg_updt); return NCSCC_RC_SUCCESS; @@ -2201,7 +2225,6 @@ uint32_t avd_dec_cold_sync_rsp(AVD_CL_CB memset(logbuff, '\0', SA_MAX_NAME_LENGTH); snprintf(logbuff, SA_MAX_NAME_LENGTH - 1, "\n\nReceived reotype = %d num obj = %d --------------------\n", dec->i_reo_type, num_of_obj); - TRACE_ENTER(); if (((dec->i_reo_type >= AVSV_CKPT_AVD_CB_CONFIG) && (dec->i_reo_type <= AVSV_CKPT_AVD_SI_CONFIG)) || @@ -2214,7 +2237,9 @@ uint32_t avd_dec_cold_sync_rsp(AVD_CL_CB there might be some runtime attributes in the cold sync response */ dec->i_action = NCS_MBCSV_ACT_UPDATE; } - return dec_cs_data_func_list[dec->i_reo_type] (cb, dec, num_of_obj); + uint32_t status = dec_cs_data_func_list[dec->i_reo_type] (cb, dec, num_of_obj); + TRACE_LEAVE2("status:%d",status); + return status; } /****************************************************************************\ @@ -2694,7 +2719,7 @@ static uint32_t dec_cs_async_updt_cnt(AV /* * Decode and send async update counts for all the data structures. */ - if (dec->i_peer_version >= AVD_MBCSV_SUB_PART_VERSION_3) [HansN] shouldn't the else part be updated? + if (dec->i_peer_version >= AVD_MBCSV_SUB_PART_VERSION_7) status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, avsv_edp_ckpt_msg_async_updt_cnt, &dec->i_uba, EDP_OP_TYPE_DEC, &updt_cnt, &ederror, dec->i_peer_version); else @@ -2739,13 +2764,13 @@ uint32_t avd_dec_warm_sync_rsp(AVD_CL_CB * Decode latest async update counts. (In the same manner we received * in the last message of the cold sync response. */ - if (dec->i_peer_version >= AVD_MBCSV_SUB_PART_VERSION_3) + if (dec->i_peer_version >= AVD_MBCSV_SUB_PART_VERSION_7) status = m_NCS_EDU_VER_EXEC(&cb->edu_hdl, avsv_edp_ckpt_msg_async_updt_cnt, &dec->i_uba, EDP_OP_TYPE_DEC, &updt_cnt, &ederror, dec->i_peer_version); else status = m_NCS_EDU_SEL_VER_EXEC(&cb->edu_hdl, avsv_edp_ckpt_msg_async_updt_cnt, &dec->i_uba, EDP_OP_TYPE_DEC, &updt_cnt, &ederror, dec->i_peer_version, - 12,1,2,3,4,5,6,7,8,9,10,11,12); + 13,1,2,3,4,5,6,7,8,9,10,11,12,13); if (status != NCSCC_RC_SUCCESS) LOG_ER("%s: decode failed, ederror=%u", __FUNCTION__, ederror); @@ -2987,3 +3012,49 @@ static uint32_t dec_cs_comp_cs_type_conf return status; } +/** + * @brief decodes saAmfNGAdminState and updates it in corresponding ng. + * + * @param ptr to AVD_CL_CB + * @param ptr to decode structure NCS_MBCSV_CB_DEC. + * + * @return NCSCC_RC_SUCCESS + */ +static uint32_t dec_ng_admin_state(AVD_CL_CB *cb, NCS_MBCSV_CB_DEC +*dec) { + SaNameT name; + TRACE_ENTER(); + osaf_decode_sanamet(&dec->i_uba, &name); + AVD_AMF_NG *ng = nodegroup_db->find(Amf::to_string(&name)); + osafassert(ng != NULL); + osaf_decode_uint32(&dec->i_uba, (uint32_t*)&ng->saAmfNGAdminState); + cb->async_updt_cnt.ng_updt++; + + TRACE("'%s',saAmfNGAdminState:%d",ng->name.value, ng->saAmfNGAdminState); + ng->admin_ng_pend_cbk.invocation = 0; + ng->admin_ng_pend_cbk.admin_oper = static_cast<SaAmfAdminOperationIdT>(0); + for (std::set<std::string>::const_iterator iter = ng->saAmfNGNodeList.begin(); + iter != ng->saAmfNGNodeList.end(); ++iter) { + AVD_AVND *node = avd_node_get(*iter); + AVD_SU *su = NULL; + //If this node has any susi on it. + for (su = node->list_of_su; su; su = su->avnd_list_su_next) + if (su->list_of_susi != NULL) + break; + if ((ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) && (su != NULL)) + /* Still some assignments are not removed on the node. + if ng in SHUTTING_DOWN state and contoller role changes then + after all nodes of nodegroup transitions to LOCKED state, new active + controller will will mark ng LOCKED. + */ + node->admin_ng = ng; + if (ng->saAmfNGAdminState == SA_AMF_ADMIN_LOCKED) + /* If controller does not change role during shutdown operation, + then new active controller will have to clear its admin_ng pointer.*/ + node->admin_ng = NULL; + } + TRACE_LEAVE2("'%s', saAmfNGAdminState=%u, ng_updt:%d", + name.value, ng->saAmfNGAdminState, cb->async_updt_cnt.ng_updt); + return NCSCC_RC_SUCCESS; +} + diff --git a/osaf/services/saf/amf/amfd/ckpt_edu.cc b/osaf/services/saf/amf/amfd/ckpt_edu.cc --- a/osaf/services/saf/amf/amfd/ckpt_edu.cc +++ b/osaf/services/saf/amf/amfd/ckpt_edu.cc @@ -401,6 +401,8 @@ uint32_t avsv_edp_ckpt_msg_async_updt_cn (long)&((AVSV_ASYNC_UPDT_CNT *)0)->compcstype_updt, 0, NULL}, {EDU_EXEC, ncs_edp_uns32, 0, 0, 0, (long)&((AVSV_ASYNC_UPDT_CNT *)0)->si_trans_updt, 0, NULL}, + {EDU_EXEC, ncs_edp_uns32, 0, 0, 0, + (long)&((AVSV_ASYNC_UPDT_CNT *)0)->ng_updt, 0, NULL}, {EDU_END, 0, 0, 0, 0, 0, 0, NULL}, }; diff --git a/osaf/services/saf/amf/amfd/ckpt_enc.cc b/osaf/services/saf/amf/amfd/ckpt_enc.cc --- a/osaf/services/saf/amf/amfd/ckpt_enc.cc +++ b/osaf/services/saf/amf/amfd/ckpt_enc.cc @@ -82,6 +82,7 @@ static uint32_t enc_comp_pres_state(AVD_ static uint32_t enc_comp_restart_count(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc); static uint32_t enc_comp_cs_type_config(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc); static uint32_t entire_data_update(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc, bool c_sync); +static uint32_t enc_ng_admin_state(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC +*enc); /* Declaration of static cold sync encode functions */ static uint32_t enc_cs_cb_config(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC *enc, uint32_t *num_of_obj); @@ -173,7 +174,8 @@ const AVSV_ENCODE_CKPT_DATA_FUNC_PTR avd enc_comp_restart_count, NULL, /* AVSV_SYNC_COMMIT */ enc_su_restart_count, - enc_si_dep_state + enc_si_dep_state, + enc_ng_admin_state }; /* @@ -2640,3 +2642,23 @@ static uint32_t enc_cs_comp_cs_type_conf return status; } +/** + * @brief encodes saAmfNGAdminState. + * + * @param ptr to AVD_CL_CB + * @param ptr to encode structure NCS_MBCSV_CB_ENC. + * + * @return NCSCC_RC_SUCCESS + */ +static uint32_t enc_ng_admin_state(AVD_CL_CB *cb, NCS_MBCSV_CB_ENC +*enc) { + TRACE_ENTER(); + osafassert(NCS_MBCSV_ACT_UPDATE == enc->io_action); + const AVD_AMF_NG *ng = (AVD_AMF_NG *)enc->io_reo_hdl; + osaf_encode_sanamet(&enc->io_uba, &ng->name); + osaf_encode_uint32(&enc->io_uba, ng->saAmfNGAdminState); + TRACE_LEAVE(); + return NCSCC_RC_SUCCESS; +} + + diff --git a/osaf/services/saf/amf/amfd/include/ckpt.h b/osaf/services/saf/amf/amfd/include/ckpt.h --- a/osaf/services/saf/amf/amfd/include/ckpt.h +++ b/osaf/services/saf/amf/amfd/include/ckpt.h @@ -34,9 +34,10 @@ #define AVD_CKP_H // current version -#define AVD_MBCSV_SUB_PART_VERSION 6 +#define AVD_MBCSV_SUB_PART_VERSION 7 // supported versions +#define AVD_MBCSV_SUB_PART_VERSION_7 7 #define AVD_MBCSV_SUB_PART_VERSION_6 6 #define AVD_MBCSV_SUB_PART_VERSION_5 5 #define AVD_MBCSV_SUB_PART_VERSION_4 4 @@ -101,6 +102,7 @@ typedef struct avsv_async_updt_cnt { uint32_t csi_updt; uint32_t compcstype_updt; uint32_t si_trans_updt; + uint32_t ng_updt; } AVSV_ASYNC_UPDT_CNT; /* diff --git a/osaf/services/saf/amf/amfd/include/ckpt_msg.h b/osaf/services/saf/amf/amfd/include/ckpt_msg.h --- a/osaf/services/saf/amf/amfd/include/ckpt_msg.h +++ b/osaf/services/saf/amf/amfd/include/ckpt_msg.h @@ -110,6 +110,7 @@ typedef enum avsv_ckpt_msg_reo_type { AVSV_CKPT_SU_RESTART_COUNT, AVSV_CKPT_SI_DEP_STATE, + AVSV_CKPT_NG_ADMIN_STATE, AVSV_CKPT_MSG_MAX } AVSV_CKPT_MSG_REO_TYPE; diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc b/osaf/services/saf/amf/amfd/nodegroup.cc --- a/osaf/services/saf/amf/amfd/nodegroup.cc +++ b/osaf/services/saf/amf/amfd/nodegroup.cc @@ -564,6 +564,7 @@ void avd_ng_admin_state_set(AVD_AMF_NG* avd_saImmOiRtObjectUpdate(&ng->name, const_cast<SaImmAttrNameT>("saAmfNGAdminState"), SA_IMM_ATTR_SAUINT32T, &ng->saAmfNGAdminState); + m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, ng, +AVSV_CKPT_NG_ADMIN_STATE); } /** * @brief Verify if Node is stable for admin operation on Nodegroup etc. ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel