It looks good to me. Thanks -Nagu
-----Original Message----- From: Praveen Malviya Sent: 13 September 2013 18:44 To: hans.fe...@ericsson.com; Nagendra Kumar Cc: opensaf-devel@lists.sourceforge.net Subject: [PATCH 1 of 1] amfnd: terminate comps when failed NPI SU is in TERMINATING state [#338] osaf/services/saf/avsv/avnd/avnd_clc.c | 3 +- osaf/services/saf/avsv/avnd/avnd_susm.c | 60 ++++++++++++++++++++++++-------- 2 files changed, 47 insertions(+), 16 deletions(-) In case of NPI SU, failed component is cleaned up when AMFD sends quiesced HA state to AMFND. In this issue when SU is still instantiating, one instantiated component failed with suFailover recovery. This patches ensures that when AMFD send quiesced HA state to AMFND, cleanup or termination of components will be performed. diff --git a/osaf/services/saf/avsv/avnd/avnd_clc.c b/osaf/services/saf/avsv/avnd/avnd_clc.c --- a/osaf/services/saf/avsv/avnd/avnd_clc.c +++ b/osaf/services/saf/avsv/avnd/avnd_clc.c @@ -2028,7 +2028,8 @@ uint32_t avnd_comp_clc_terming_cleansucc } /* TODO(hafe) needs to be changed when SU failover is implemented */ - if (m_AVND_COMP_IS_FAILED(comp) && m_AVND_SU_IS_FAILED(comp->su)) { + if (m_AVND_COMP_IS_FAILED(comp) && m_AVND_SU_IS_FAILED(comp->su) && + m_AVND_SU_IS_PREINSTANTIABLE(comp->su)) { /* request director to orchestrate component failover */ rc = avnd_di_oper_send(cb, comp->su, SA_AMF_COMPONENT_FAILOVER); } diff --git a/osaf/services/saf/avsv/avnd/avnd_susm.c b/osaf/services/saf/avsv/avnd/avnd_susm.c --- a/osaf/services/saf/avsv/avnd/avnd_susm.c +++ b/osaf/services/saf/avsv/avnd/avnd_susm.c @@ -1660,6 +1660,8 @@ uint32_t avnd_su_pres_uninst_suinst_hdle uint32_t avnd_su_pres_insting_suterm_hdler(AVND_CB *cb, AVND_SU *su, AVND_COMP *comp) { AVND_COMP *curr_comp = 0; + AVND_SU_SI_REC *si = 0; + AVND_COMP_CSI_REC *curr_csi = 0; uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER2("SU Terminate event in Instantiating state:'%s'", su->name.value); @@ -1667,23 +1669,51 @@ uint32_t avnd_su_pres_insting_suterm_hdl * If pi su, pick all the instantiated/instantiating pi comps & * trigger their FSM with TermEv. */ - for (curr_comp = m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&su->comp_list)); - curr_comp; curr_comp = m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT(&curr_comp->su_dll_node))) { - /* - * skip the npi comps.. as the su is yet to be instantiated, - * there are no SIs assigned. - */ - if (!m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(curr_comp)) - continue; + if (m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(su)){ + for (curr_comp = m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&su->comp_list)); + curr_comp; curr_comp = m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT(&curr_comp->su_dll_node))) { + /* + * skip the npi comps.. as the su is yet to be instantiated, + * there are no SIs assigned. + */ + if (!m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(curr_comp)) + continue; - /* terminate the non-uninstantiated pi comp */ - if (!m_AVND_COMP_PRES_STATE_IS_UNINSTANTIATED(curr_comp)) { - TRACE("Running the component clc FSM"); - rc = avnd_comp_clc_fsm_run(cb, curr_comp, AVND_COMP_CLC_PRES_FSM_EV_TERM); - if (NCSCC_RC_SUCCESS != rc) - goto done; + /* terminate the non-uninstantiated pi comp */ + if (!m_AVND_COMP_PRES_STATE_IS_UNINSTANTIATED(curr_comp)) { + TRACE("Running the component clc FSM"); + rc = avnd_comp_clc_fsm_run(cb, curr_comp, AVND_COMP_CLC_PRES_FSM_EV_TERM); + if (NCSCC_RC_SUCCESS != rc) + goto done; + } } - } /* for */ + } else { + TRACE("NPI SU:'%s'", su->name.value); + /* get the only si rec */ + si = (AVND_SU_SI_REC *)m_NCS_DBLIST_FIND_FIRST(&su->si_list); + osafassert(si); + /* This is a case when unlocking fails in middle and there may chance that some csi is not + assigned and are in uninstantiated state. In this case, we need to ignore those csis */ + for (curr_csi = (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_LAST(&si->csi_list); + curr_csi; curr_csi = + (AVND_COMP_CSI_REC *)m_NCS_DBLIST_FIND_PREV(&curr_csi->si_dll_node)) { + /* terminate the component containing non-unassigned csi */ + if (m_AVND_COMP_PRES_STATE_IS_UNINSTANTIATED(curr_csi->comp)) { + m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(curr_csi, + AVND_COMP_CSI_ASSIGN_STATE_ASSIGNED); + } else { + rc = avnd_comp_clc_fsm_run(cb, curr_csi->comp, + (m_AVND_COMP_IS_FAILED(curr_csi->comp))? + AVND_COMP_CLC_PRES_FSM_EV_CLEANUP : + AVND_COMP_CLC_PRES_FSM_EV_TERM); + if (NCSCC_RC_SUCCESS != rc) + goto done; + else + /* We need to break as we had triggered FSM. */ + break; + } + } + } /* transition to terminating state */ avnd_su_pres_state_set(su, SA_AMF_PRESENCE_TERMINATING); ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel