Ack, code review only. Thanks, Praveen
On 18-Jan-17 8:51 AM, Minh Hon Chau wrote: > src/amf/amfd/ndfsm.cc | 4 +-- > src/amf/amfd/sg.cc | 71 > +++++++------------------------------------------- > src/amf/amfd/sg.h | 3 +- > 3 files changed, 13 insertions(+), 65 deletions(-) > > > The patch #2112 has been pushed that makes both amfds as > earlier applier/implementer, so there's no need to add > avd_sg_read_headless_fsm_state_cached_rta which was > introduced in ticket #1987 > > diff --git a/src/amf/amfd/ndfsm.cc b/src/amf/amfd/ndfsm.cc > --- a/src/amf/amfd/ndfsm.cc > +++ b/src/amf/amfd/ndfsm.cc > @@ -133,12 +133,10 @@ void avd_process_state_info_queue(AVD_CL > // Reading sg must be after reading susi > if (found_state_info == true) { > LOG_NO("Enter restore headless cached RTAs from IMM"); > - // Read SG Fsm state to recover nodegroup operation > - avd_sg_read_headless_fsm_state_cached_rta(cb); > // Read all cached susi, includes ABSENT SUSI with IMM fsm state > avd_susi_read_headless_cached_rta(cb); > // Read SUOperationList, set ABSENT fsm state for ABSENT SUSI > - avd_sg_read_headless_su_oper_list_cached_rta(cb); > + avd_sg_read_headless_cached_rta(cb); > // Read SUSwitch of SU, validate toggle depends on SUSI fsm > state > avd_su_read_headless_cached_rta(cb); > // Clean compcsi object of ABSENT SUSI > diff --git a/src/amf/amfd/sg.cc b/src/amf/amfd/sg.cc > --- a/src/amf/amfd/sg.cc > +++ b/src/amf/amfd/sg.cc > @@ -375,6 +375,15 @@ static AVD_SG *sg_create(const std::stri > if (immutil_getAttr(const_cast<SaImmAttrNameT>("saAmfSGAdminState"), > attributes, 0, &sg->saAmfSGAdminState) != SA_AIS_OK) { > sg->saAmfSGAdminState = SA_AMF_ADMIN_UNLOCKED; > } > + // only read SG FSM State for non-ncs SG > + if (sg_name.find("safApp=OpenSAF") == std::string::npos) { > + if > (immutil_getAttr(const_cast<SaImmAttrNameT>("osafAmfSGFsmState"), > + attributes, 0, &sg->sg_fsm_state) != SA_AIS_OK) > { > + sg->sg_fsm_state = AVD_SG_FSM_STABLE; > + } > + TRACE("sg_fsm_state(%u) read from osafAmfSGFsmState", > sg->sg_fsm_state); > + } > + > /* TODO use value in type instead? */ > sg->sg_redundancy_model = sgt->saAmfSgtRedundancyModel; > > @@ -422,6 +431,7 @@ SaAisErrorT avd_sg_config_get(const std: > const_cast<SaImmAttrNameT>("saAmfSGSuRestartProb"), > const_cast<SaImmAttrNameT>("saAmfSGSuRestartMax"), > const_cast<SaImmAttrNameT>("saAmfSGAdminState"), > + const_cast<SaImmAttrNameT>("osafAmfSGFsmState"), > nullptr > }; > > @@ -2098,66 +2108,7 @@ uint32_t AVD_SG::curr_non_instantiated_s > (su->saAmfSUPresenceState == > SA_AMF_PRESENCE_UNINSTANTIATED));})); > } > > -void avd_sg_read_headless_fsm_state_cached_rta(AVD_CL_CB *cb) > -{ > - > - SaAisErrorT rc; > - SaImmSearchHandleT searchHandle; > - SaImmSearchParametersT_2 searchParam; > - > - SaNameT sg_dn; > - AVD_SG *sg; > - const SaImmAttrValuesT_2 **attributes; > - AVD_SG_FSM_STATE imm_sg_fsm_state; > - const char *className = "SaAmfSG"; > - const SaImmAttrNameT searchAttributes[] = { > - const_cast<SaImmAttrNameT>("osafAmfSGFsmState"), > - NULL > - }; > - > - TRACE_ENTER(); > - > - osafassert(cb->scs_absence_max_duration > 0); > - > - searchParam.searchOneAttr.attrName = > const_cast<SaImmAttrNameT>("SaImmAttrClassName"); > - searchParam.searchOneAttr.attrValueType = SA_IMM_ATTR_SASTRINGT; > - searchParam.searchOneAttr.attrValue = &className; > - > - if ((rc = immutil_saImmOmSearchInitialize_2(cb->immOmHandle, NULL, > SA_IMM_SUBTREE, > - SA_IMM_SEARCH_ONE_ATTR | SA_IMM_SEARCH_GET_SOME_ATTR, > &searchParam, > - searchAttributes, &searchHandle)) != SA_AIS_OK) { > - > - LOG_ER("%s: saImmOmSearchInitialize_2 failed: %u", > __FUNCTION__, rc); > - goto done; > - } > - > - while ((rc = immutil_saImmOmSearchNext_2(searchHandle, &sg_dn, > - (SaImmAttrValuesT_2 ***)&attributes)) > == SA_AIS_OK) { > - sg = sg_db->find(Amf::to_string(&sg_dn)); > - if (sg && sg->sg_ncs_spec == false) { > - if (sg->headless_validation == false) { > - continue; > - } > - if (sg->any_assignment_in_progress() == false && > - sg->any_assignment_assigned() == false) { > - continue; > - } > - // Read sg fsm state > - rc = > immutil_getAttr(const_cast<SaImmAttrNameT>("osafAmfSGFsmState"), > - attributes, 0, &imm_sg_fsm_state); > - osafassert(rc == SA_AIS_OK); > - sg->set_fsm_state(imm_sg_fsm_state, false); > - } > - } > - > - (void)immutil_saImmOmSearchFinalize(searchHandle); > - > -done: > - TRACE_LEAVE(); > - > -} > - > -void avd_sg_read_headless_su_oper_list_cached_rta(AVD_CL_CB *cb) > +void avd_sg_read_headless_cached_rta(AVD_CL_CB *cb) > { > > SaAisErrorT rc; > diff --git a/src/amf/amfd/sg.h b/src/amf/amfd/sg.h > --- a/src/amf/amfd/sg.h > +++ b/src/amf/amfd/sg.h > @@ -581,8 +581,7 @@ private: > #define m_AVD_SET_SG_ADMIN_SI(cb,si) (si)->sg_of_si->set_admin_si((si)) > #define m_AVD_CLEAR_SG_ADMIN_SI(cb,sg) (sg)->clear_admin_si() > #define m_AVD_CHK_OPLIST(i_su,flag) (flag) = > (i_su)->sg_of_su->in_su_oper_list(i_su) > -void avd_sg_read_headless_fsm_state_cached_rta(AVD_CL_CB *cb); > -void avd_sg_read_headless_su_oper_list_cached_rta(AVD_CL_CB *cb); > +void avd_sg_read_headless_cached_rta(AVD_CL_CB *cb); > bool avd_sg_validate_headless_cached_rta(AVD_CL_CB *cb); > extern void avd_sg_delete(AVD_SG *sg); > extern void avd_sg_db_add(AVD_SG *sg); > ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel