Hi Praveen, One comment in line with [Minh]
Thanks Minh On 20/07/16 18:57, praveen.malv...@oracle.com wrote: > osaf/services/saf/amf/amfd/include/sg.h | 1 + > osaf/services/saf/amf/amfd/nodegroup.cc | 4 +- > osaf/services/saf/amf/amfd/sg_npm_fsm.cc | 62 > ++++++++++++++++++++++++++++++- > 3 files changed, 62 insertions(+), 5 deletions(-) > > > Currently 2N, N-Way Active and NoRed models are supported for lock, shutdown, > lock-in and unlock-in admin operations on NGs. > > This patch supports NplusM model also. > > diff --git a/osaf/services/saf/amf/amfd/include/sg.h > b/osaf/services/saf/amf/amfd/include/sg.h > --- a/osaf/services/saf/amf/amfd/include/sg.h > +++ b/osaf/services/saf/amf/amfd/include/sg.h > @@ -507,6 +507,7 @@ public: > uint32_t susi_failed(AVD_CL_CB *cb, AVD_SU *su, > struct avd_su_si_rel_tag *susi, AVSV_SUSI_ACT act, > SaAmfHAStateT state); > void node_fail_si_oper(AVD_CL_CB *cb, AVD_SU *su); > + void ng_admin(AVD_SU *su, AVD_AMF_NG *ng); > > private: > uint32_t su_fault_su_oper(AVD_CL_CB *cb, AVD_SU *su); > 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 > @@ -687,6 +687,7 @@ void avd_ng_admin_state_set(AVD_AMF_NG* > avd_send_admin_state_chg_ntf(&ng->name, > (SaAmfNotificationMinorIdT)SA_AMF_NTFID_NG_ADMIN_STATE, > old_state, ng->saAmfNGAdminState); > + TRACE_LEAVE(); > } > /** > * @brief Verify if Node is stable for admin operation on Nodegroup etc. > @@ -749,8 +750,7 @@ static SaAisErrorT check_red_model_servi > LOG_NO("service outage for '%s' because of > shutdown/lock " > "on > '%s'",sg->name.value,ng->name.value); > > - if ((sg->sg_redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL) > || > - (sg->sg_redundancy_model == > SA_AMF_NPM_REDUNDANCY_MODEL)) { > + if (sg->sg_redundancy_model == SA_AMF_N_WAY_REDUNDANCY_MODEL) { > LOG_NO("Admin op on '%s' hosting SUs of '%s' with > redundancy '%u' " > "is not supported",ng->name.value, > sg->name.value, > sg->sg_redundancy_model); > diff --git a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > --- a/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > +++ b/osaf/services/saf/amf/amfd/sg_npm_fsm.cc > @@ -120,16 +120,16 @@ static AVD_SU_SI_REL *avd_sg_npm_su_othr > if (i_susi->si->list_of_sisu != i_susi) { > o_susi = i_susi->si->list_of_sisu; > if (o_susi->fsm != AVD_SU_SI_STATE_UNASGN) > - return o_susi; > + break; > } else if (i_susi->si->list_of_sisu->si_next != > AVD_SU_SI_REL_NULL) { > o_susi = i_susi->si->list_of_sisu->si_next; > if (o_susi->fsm != AVD_SU_SI_STATE_UNASGN) > - return o_susi; > + break; > } > > i_susi = i_susi->su_next; > } > - > + TRACE_LEAVE2("o_susi:'%p'",o_susi); > return o_susi; > } > > @@ -4452,6 +4452,62 @@ uint32_t SG_NPM::sg_admin_down(AVD_CL_CB > return NCSCC_RC_SUCCESS; > } > > +/* > + * @brief Handles modification of assignments in SU of NpM SG > + * because of lock or shutdown operation on Node group. > + * If SU does not have any SIs assigned to it, AMF will try > + * to instantiate new SUs in the SG. If SU has assignments, > + * then depending upon lock or shutdown operation, quiesced > + * or quiescing state will be sent for active SIs in SU. > + * If SU has only standby assignments then remove the assignments. > + * > + * @param[in] ptr to SU > + * @param[in] ptr to nodegroup AVD_AMF_NG. > + */ > +void SG_NPM::ng_admin(AVD_SU *su, AVD_AMF_NG *ng) > +{ > + SaAmfHAStateT ha_state; > + > + TRACE_ENTER2("'%s', sg_fsm_state:%u",su->name.value, > + su->sg_of_su->sg_fsm_state); > + > + if (su->list_of_susi == nullptr) { > + avd_sg_app_su_inst_func(avd_cb, su->sg_of_su); > + return; > + } > + > + if (ng->saAmfNGAdminState == SA_AMF_ADMIN_SHUTTING_DOWN) > + ha_state = SA_AMF_HA_QUIESCING; > + else > + ha_state = SA_AMF_HA_QUIESCED; > + > + if (su->list_of_susi->state == SA_AMF_HA_ACTIVE) { > + if (avd_sg_su_si_mod_snd(avd_cb, su, ha_state) == NCSCC_RC_FAILURE) { > + LOG_ER("quiescing/quiesced state transtion failed for > '%s'",su->name.value); > + goto done; > + } > + } else { > + if (avd_sg_su_si_del_snd(avd_cb, su) == NCSCC_RC_FAILURE) { > + LOG_ER("removal of standby assignment failed for '%s'",su->name.value); > + goto done; > + } > + } > + > + avd_sg_su_oper_list_add(avd_cb, su, false); > + su->sg_of_su->set_fsm_state(AVD_SG_FSM_SG_REALIGN); [Minh]: For ng_admin operation, 2N is using fsm AVD_SG_FSM_SG_ADMIN, the NoRed, NwayActive are using AVD_SG_FSM_SG_REALIGN. Now the support for NpM and Nway are using AVD_SG_FSM_SG_REALIGN also. Quickly browsing through ng_admin() of NoRed, NwayActive, NpM, Nway, they are very similar to the existing of those sg_admin_down(), respectively. I think the NoRed, Nway, NwayACtive, NpM should be using AVD_SG_FSM_SG_ADMIN in the same way as 2N. The reason is the same admin operation should be treated in the same SG FSM state/code between SG types, and if sg_admin_down() works, we should reuse them. > + > + //Increment node counter for tracking status of ng operation. > + if ((su->any_susi_fsm_in_modify() == true) || > + (su->any_susi_fsm_in_unasgn() == true)) { > + su->su_on_node->su_cnt_admin_oper++; > + TRACE("node:%s, su_cnt_admin_oper:%u", su->su_on_node->name.value, > + su->su_on_node->su_cnt_admin_oper); > + } > +done: > + TRACE_LEAVE(); > + return; > +} > + > SG_NPM::~SG_NPM() { > } > > ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel