On 06/28/2013 04:45 PM, praveen malviya wrote: > Please see inline. > > Thanks, > Praveen > On 28-Jun-13 2:39 PM, Hans Feldt wrote: >> Ok so conceptually I think the COMP FSM should take care of sending >> COMPONENT_FAILOVER request to AMFD and the SU FSM should take care of >> sending SU_FAILOVER request to AMFD. Is that the way it is now? > We can make such empirical rules for our understanding. But AMF is too > complex to theorize it.
Well it is good with an idea how we think it should look >> The SU pres state change from TERMINATING to UNINSTANTIATED should be >> the trigger to send the SU_FAILOVER request. That means you should put >> the logic in function avnd_su_pres_st_chng_prc() and not in >> avnd_su_pres_fsm_run(). There is no similar logic in >> avnd_su_pres_fsm_run() and should be kept clean and do what it says. >> all_comps_terminated_in_su() is then not needed. > if you see AMFND code SU FSM transitions works differently for NPI SU > and PI SU. In case of NPI, SI has been taken as reference to trigger > FSMs because only one SI can be assigned to whole NPI SU (spec governs > it) which is good as well as creates problems also, while in case of PI > SU comp is the reference. Since comp and SU both have presence states, > their FSM works in good sync in PI case. But CSI(or SI) does not have > presence state which causes pres state of SU sometimes hanging in other > than UNINSTANTIATED state (This is the reason I cannot get away with I do not understand this. An SU in TERMINATING state can end up in either UNINSTANTIATED or TERMINATION-FAILED state. What is this "sometimes hanging" case that you refer to? I changed your patch according to my comments and it works fine. What test case am I missing? Thanks, Hans > all_comps_terminated_in_su() ). One reason I think initial developers > did not realize that component failover has no meaning in NPI case > becasue of only one SI assign to it so it is always su failover for NPI > SU (saAmfSUFailover is always true for NPI SU). See open tickets in > community for NPI configurations because of component failover in NPI. > All this you will also realize while implementing #474. To sum up, these > are the reasons I am not handling sufailover in > avnd_su_pres_st_chng_prc(). SU failover is much simpler then component > failover, cleanup components->delete susi at amfnd->inform amfd->then > usual flow. > >> Can you please provide at new 4/4 patch with the above changed? >> >> Thanks, >> Hans >> >> P.S. As a side note, I have a hard time to map the C code to UML state >> machines. The "hdler" functions seems represent actions and state >> transitions. After a state transition, avnd_su_pres_st_chng_prc() is >> executed. It checks the from state and the new state and takes >> actions. Meaning these are not entry/exit actions (which would not >> look at the from/to state), rather a clumsy way of executing common >> actions at state transitions. Would be more elegant if the "hdler" >> functions called a common stateY_to_stateY() handler instead. >> Therefore the complexity of avnd_su_pres_st_chng_prc(), it handles all >> states in one C function. This should be refactored at some point! >> >> Or maybe a complete state machine (re)design starting from diagrams... >> > I agree. To add more the variety of spec concepts like proxied, proxy, > external, PI and NPI further complicates thing at amfnd. But "future > work", good words for this. >>> -----Original Message----- >>> From:[email protected] [mailto:[email protected]] >>> Sent: den 28 juni 2013 08:22 >>> To: Hans Feldt;[email protected];[email protected] >>> Cc:[email protected] >>> Subject: [PATCH 4 of 4] amfnd: handle sufailover in SU FSM and Comp FSM >>> [#98] >>> >>> osaf/services/saf/avsv/avnd/avnd_clc.c | 82 +++++++++++--------- >>> osaf/services/saf/avsv/avnd/avnd_comp.c | 2 +- >>> osaf/services/saf/avsv/avnd/avnd_su.c | 1 + >>> osaf/services/saf/avsv/avnd/avnd_susm.c | 127 >>> ++++++++++++++++++++++++------- >>> 4 files changed, 146 insertions(+), 66 deletions(-) >>> >>> >>> Refloating the patch after incorporating comments. >>> >>> 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 >>> @@ -1065,8 +1065,8 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_ >>> if (m_AVND_COMP_IS_FAILED(comp) && !comp- >>>> csi_list.n_nodes && >>> !m_AVND_SU_IS_ADMN_TERM(comp->su) && >>> (cb->oper_state == >>> SA_AMF_OPERATIONAL_ENABLED)) { >>> - /* No need to restart component during >>> shutdown */ >>> - if (!m_AVND_IS_SHUTTING_DOWN(cb)) >>> + /* No need to restart component during >>> shutdown and during sufailover*/ >>> + if (!m_AVND_IS_SHUTTING_DOWN(cb) && >>> +!avnd_sufailover_in_progress(comp->su)) >>> rc = avnd_comp_clc_fsm_trigger(cb, >>> comp, AVND_COMP_CLC_PRES_FSM_EV_INST); >>> } else if (m_AVND_COMP_IS_FAILED(comp) && >>> !comp->csi_list.n_nodes) { >>> m_AVND_COMP_FAILED_RESET(comp); >>> /*if we moved from restart -> term >>> @@ -1099,33 +1099,38 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_ >>> goto done; >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, >>> comp, AVND_CKPT_COMP_OPER_STATE); >>> >>> - if (!m_AVND_COMP_IS_FAILED(comp)) { >>> - /* csi-set / csi-rem succeeded.. generate csi- >>> done indication */ >>> - csi = >>> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FI >>> RST(&comp->csi_list)); >>> - osafassert(csi); >>> - if >>> (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNING(csi)) >>> - rc = avnd_comp_csi_assign_done(cb, >>> comp, >>> - >>> m_AVND_COMP_IS_ALL_CSI(comp) ? 0 : csi); >>> - else if >>> (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(csi)) >>> - rc = >>> avnd_comp_csi_remove_done(cb, comp, >>> - >>> m_AVND_COMP_IS_ALL_CSI(comp) ? 0 : csi); >>> - if (NCSCC_RC_SUCCESS != rc) >>> - goto done; >>> - } else { >>> - /* failed su is ready to take on si assignment.. >>> inform avd */ >>> - if (!comp->csi_list.n_nodes) { >>> - m_AVND_SU_IS_ENABLED(comp- >>>> su, is_en); >>> - if (true == is_en) { >>> - >>> m_AVND_SU_OPER_STATE_SET(comp- >>>> su,SA_AMF_OPERATIONAL_ENABLED); >>> - >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp->su, >>> AVND_CKPT_SU_OPER_STATE); >>> - rc = avnd_di_oper_send(cb, >>> comp->su, 0); >>> - if (NCSCC_RC_SUCCESS != rc) >>> - goto done; >>> + if (avnd_sufailover_in_progress(comp->su)) { >>> + /*Do not reset any flag, this will be done as a >>> part of repair.*/ >>> + } >>> + else { >>> + if (!m_AVND_COMP_IS_FAILED(comp)) { >>> + /* csi-set / csi-rem succeeded.. >>> generate csi-done indication */ >>> + csi = >>> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FI >>> RST(&comp->csi_list)); >>> + osafassert(csi); >>> + if >>> (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNING(csi)) >>> + rc = >>> avnd_comp_csi_assign_done(cb, comp, >>> + >>> m_AVND_COMP_IS_ALL_CSI(comp) ? 0 : csi); >>> + else if >>> (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_REMOVING(csi)) >>> + rc = >>> avnd_comp_csi_remove_done(cb, comp, >>> + >>> m_AVND_COMP_IS_ALL_CSI(comp) ? 0 : csi); >>> + if (NCSCC_RC_SUCCESS != rc) >>> + goto done; >>> + } else { >>> + /* failed su is ready to take on si >>> assignment.. inform avd */ >>> + if (!comp->csi_list.n_nodes) { >>> + >>> m_AVND_SU_IS_ENABLED(comp->su, is_en); >>> + if (true == is_en) { >>> + >>> m_AVND_SU_OPER_STATE_SET(comp- >>>> su,SA_AMF_OPERATIONAL_ENABLED); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp->su, >>> AVND_CKPT_SU_OPER_STATE); >>> + rc = >>> avnd_di_oper_send(cb, comp->su, 0); >>> + if >>> (NCSCC_RC_SUCCESS != rc) >>> + goto done; >>> + } >>> + >>> m_AVND_COMP_FAILED_RESET(comp); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, >>> +AVND_CKPT_COMP_FLAG_CHANGE); >>> } >>> - >>> m_AVND_COMP_FAILED_RESET(comp); >>> - >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, >>> AVND_CKPT_COMP_FLAG_CHANGE); >>> + >>> } >>> - >>> } >>> } >>> >>> @@ -1190,12 +1195,17 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_ >>> >>> /* terminating -> uninstantiated */ >>> if ((SA_AMF_PRESENCE_TERMINATING == prv_st) && >>> (SA_AMF_PRESENCE_UNINSTANTIATED == final_st)) { >>> - /* npi comps are enabled in uninstantiated state */ >>> - m_AVND_COMP_OPER_STATE_SET(comp, >>> SA_AMF_OPERATIONAL_ENABLED); >>> - m_AVND_COMP_OPER_STATE_AVD_SYNC(cb, >>> comp, rc); >>> - if (NCSCC_RC_SUCCESS != rc) >>> - goto done; >>> - m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, >>> comp, AVND_CKPT_COMP_OPER_STATE); >>> + if (avnd_sufailover_in_progress(comp->su)) { >>> + /*Do not reset any flag, this will be done as a >>> part of repair.*/ >>> + } >>> + else { >>> + /* npi comps are enabled in uninstantiated >>> state */ >>> + m_AVND_COMP_OPER_STATE_SET(comp, >>> SA_AMF_OPERATIONAL_ENABLED); >>> + >>> m_AVND_COMP_OPER_STATE_AVD_SYNC(cb, comp, rc); >>> + if (NCSCC_RC_SUCCESS != rc) >>> + goto done; >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, >>> AVND_CKPT_COMP_OPER_STATE); >>> + } >>> } >>> >>> /* Instantiating -> Instantiationfailed */ @@ -2763,7 +2773,7 >>> @@ uint32_t avnd_comp_clc_cmd_execute(AVND_ uint32_t >>> avnd_instfail_su_failover(AVND_CB *cb, AVND_SU *su, AVND_COMP >>> *failed_comp) { >>> uint32_t rc = NCSCC_RC_SUCCESS; >>> - TRACE_ENTER2("Executing SU Failover: Instantiation failed SU: >>> '%s' : >>> Failed component: '%s'", >>> + TRACE_ENTER2("Executing Component Failover: Instantiation failed >>> SU: >>> +'%s' : Failed component: '%s'", >>> su- >>>> name.value, failed_comp->name.value); >>> /* mark the comp failed */ >>> @@ -2812,12 +2822,12 @@ uint32_t avnd_instfail_su_failover(AVND_ >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> >>> /* inform AvD */ >>> - rc = avnd_di_oper_send(cb, su, >>> AVSV_ERR_RCVR_SU_FAILOVER); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> } >>> >>> done: >>> if (rc == NCSCC_RC_SUCCESS) >>> - LOG_NO("SU Failover trigerred for '%s': Failed component: >>> '%s'", >>> + LOG_NO("Component Failover trigerred for '%s': Failed >>> component: >>> +'%s'", >>> su->name.value, failed_comp->name.value); >>> TRACE_LEAVE2("%u", rc); >>> return rc; >>> diff --git a/osaf/services/saf/avsv/avnd/avnd_comp.c >>> b/osaf/services/saf/avsv/avnd/avnd_comp.c >>> --- a/osaf/services/saf/avsv/avnd/avnd_comp.c >>> +++ b/osaf/services/saf/avsv/avnd/avnd_comp.c >>> @@ -872,7 +872,7 @@ uint32_t avnd_comp_unreg_prc(AVND_CB *cb >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, >>> comp->su, AVND_CKPT_SU_OPER_STATE); >>> >>> /* inform AvD */ >>> - rc = avnd_di_oper_send(cb, comp->su, 0); >>> + rc = avnd_di_oper_send(cb, comp->su, >>> SA_AMF_COMPONENT_FAILOVER); >>> } >>> } >>> >>> diff --git a/osaf/services/saf/avsv/avnd/avnd_su.c >>> b/osaf/services/saf/avsv/avnd/avnd_su.c >>> --- a/osaf/services/saf/avsv/avnd/avnd_su.c >>> +++ b/osaf/services/saf/avsv/avnd/avnd_su.c >>> @@ -494,6 +494,7 @@ uint32_t avnd_evt_su_admin_op_req(AVND_C >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_ENABLED); >>> avnd_di_uns32_upd_send(AVSV_SA_AMF_SU, >>> saAmfSUOperState_ID, &su->name, su->oper); >>> avnd_su_pres_state_set(su, >>> SA_AMF_PRESENCE_UNINSTANTIATED); >>> + rc = avnd_di_oper_send(cb, su, 0); >>> >>> if (!comp_in_term_failed_state()) >>> avnd_failed_state_file_delete(); >>> 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 >>> @@ -56,7 +56,6 @@ static uint32_t avnd_su_pres_inst_compin static >>> uint32_t avnd_su_pres_instfailed_compuninst(AVND_CB *, AVND_SU *, >>> AVND_COMP *); >>> >>> static uint32_t avnd_su_pres_st_chng_prc(AVND_CB *, AVND_SU *, >>> SaAmfPresenceStateT, SaAmfPresenceStateT); >>> - >>> >>> /********************************************************** >>> ****************** >>> * S E R V I C E U N I T P R E S F S M M A T R I X D E F I N I >>> T I O N * >>> >>> ********************************************************** >>> ******************/ >>> @@ -1262,6 +1261,32 @@ done: >>> return rc; >>> } >>> >>> + >>> +/** >>> + * Check if all components have been terminated in the su. >>> + * @param su >>> + * @return bool >>> + */ >>> +static bool all_comps_terminated_in_su(AVND_SU *su) { >>> + AVND_COMP *comp; >>> + >>> + for (comp = >>> m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST( >>> &su->comp_list)); >>> + comp; >>> + comp = >>> +m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT( >>> &comp->su_dll_n >>> +ode))) { >>> + >>> + if ((comp->pres != SA_AMF_PRESENCE_UNINSTANTIATED) >>> && >>> + (comp->pres != >>> SA_AMF_PRESENCE_INSTANTIATION_FAILED) && >>> + (comp->pres != >>> SA_AMF_PRESENCE_TERMINATION_FAILED)) { >>> + >>> + TRACE("'%s' not terminated, pres.st=%u", comp- >>>> name.value, comp->pres); >>> + return false; >>> + } >>> + } >>> + >>> + return true; >>> +} >>> + >>> >>> /********************************************************** >>> ****************** >>> Name : avnd_su_pres_fsm_run >>> >>> @@ -1300,6 +1325,21 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *c >>> >>> TRACE_1("Exited SU presence state FSM: New State = %u",final_st); >>> >>> + /*Complete su failover at amfnd*/ >>> + if (avnd_sufailover_in_progress(su) && >>> (all_comps_terminated_in_su(su))) { >>> + TRACE("SU_FAILOVER for '%s'", su->name.value); >>> + /* Since all components got successfully terminated, >>> finish >>> sufailover at amfnd >>> + by deleting SUSIs at amfnd and informing amfd about >>> sufailover.*/ >>> + LOG_NO("Terminated all components in '%s'", >>> su->name.value); >>> + LOG_NO("Informing director of sufailover"); >>> + rc = avnd_di_oper_send(avnd_cb, su, >>> AVSV_ERR_RCVR_SU_FAILOVER); >>> + osafassert(NCSCC_RC_SUCCESS == rc); >>> + avnd_su_si_del(avnd_cb, &su->name); >>> + if (!m_AVND_SU_IS_PREINSTANTIABLE(su)) >>> + avnd_su_pres_state_set(su, >>> SA_AMF_PRESENCE_UNINSTANTIATED); >>> + goto done; >>> + } >>> + >>> /* process state change */ >>> if (prv_st != final_st) >>> rc = avnd_su_pres_st_chng_prc(cb, su, prv_st, final_st); @@ >>> -1411,17 +1451,24 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> /* terminating -> uninstantiated */ >>> if ((SA_AMF_PRESENCE_TERMINATING == prv_st) && >>> (SA_AMF_PRESENCE_UNINSTANTIATED == final_st)) { >>> TRACE("SU Terminating -> Uninstantiated"); >>> - /* reset the su failed flag */ >>> - if (m_AVND_SU_IS_FAILED(su)) { >>> - m_AVND_SU_FAILED_RESET(su); >>> - >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> + if (avnd_sufailover_in_progress(su)) { >>> + /*Do not reset any flag, this will be done as a >>> part of repair.*/ >>> } >>> + else >>> + { >>> + /* reset the su failed flag */ >>> + if (m_AVND_SU_IS_FAILED(su)) { >>> + m_AVND_SU_FAILED_RESET(su); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> + } >>> >>> - /* reset the su restart falg */ >>> - if (m_AVND_SU_IS_RESTART(su)) { >>> - m_AVND_SU_RESTART_RESET(su); >>> - >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> + /* reset the su restart flag */ >>> + if (m_AVND_SU_IS_RESTART(su)) { >>> + m_AVND_SU_RESTART_RESET(su); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> + } >>> } >>> + goto done; >>> } >>> >>> /* instantiating -> inst-failed */ >>> @@ -1430,7 +1477,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> /* send the su-oper state msg (to indicate that >>> instantiation failed) */ >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_DISABLED); >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> - rc = avnd_di_oper_send(cb, su, >>> AVSV_ERR_RCVR_SU_FAILOVER); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> if (NCSCC_RC_SUCCESS != rc) >>> goto done; >>> } >>> @@ -1457,7 +1504,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> TRACE("SU oper state is enabled"); >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_DISABLED); >>> >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> - rc = avnd_di_oper_send(cb, su, >>> AVSV_ERR_RCVR_SU_FAILOVER); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> if (NCSCC_RC_SUCCESS != rc) >>> goto done; >>> } >>> @@ -1471,7 +1518,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_DISABLED); >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> /* inform AvD about oper state change */ >>> - rc = avnd_di_oper_send(cb, su, 0); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> if (NCSCC_RC_SUCCESS != rc) >>> goto done; >>> >>> @@ -1515,7 +1562,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_DISABLED); >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> >>> - rc = avnd_di_oper_send(cb, su, >>> AVSV_ERR_RCVR_SU_FAILOVER); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> >>> } >>> >>> @@ -1531,15 +1578,21 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> /* terminating -> uninstantiated */ >>> if ((SA_AMF_PRESENCE_TERMINATING == prv_st) && >>> (SA_AMF_PRESENCE_UNINSTANTIATED == final_st)) { >>> TRACE("Terminating -> UnInstantiated"); >>> - /* si assignment/removal success.. generate si-oper >>> done indication */ >>> - rc = avnd_su_si_oper_done(cb, su, >>> m_AVND_SU_IS_ALL_SI(su) ? 0 : si); >>> - m_AVND_SU_ALL_SI_RESET(su); >>> - m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> + if (avnd_sufailover_in_progress(su)) { >>> + /*Do not reset any flag, this will be done as a >>> part of repair.*/ >>> + } >>> + else >>> + { >>> + /* si assignment/removal success.. generate >>> si-oper done indication */ >>> + rc = avnd_su_si_oper_done(cb, su, >>> m_AVND_SU_IS_ALL_SI(su) ? 0 : si); >>> + m_AVND_SU_ALL_SI_RESET(su); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_FLAG_CHANGE); >>> >>> - /* npi su is enabled in uninstantiated state */ >>> - m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_ENABLED); >>> - m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> - rc = avnd_di_oper_send(cb, su, 0); >>> + /* npi su is enabled in uninstantiated state */ >>> + m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_ENABLED); >>> + >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> + rc = avnd_di_oper_send(cb, su, 0); >>> + } >>> } >>> >>> /* terminating/instantiated/restarting -> term-failed */ @@ - >>> 1550,7 +1603,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C >>> m_AVND_SU_OPER_STATE_SET(su, >>> SA_AMF_OPERATIONAL_DISABLED); >>> m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su, >>> AVND_CKPT_SU_OPER_STATE); >>> /* inform AvD about oper state change */ >>> - rc = avnd_di_oper_send(cb, su, 0); >>> + rc = avnd_di_oper_send(cb, su, >>> SA_AMF_COMPONENT_FAILOVER); >>> >>> /* si assignment/removal failed.. inform AvD */ >>> rc = avnd_di_susi_resp_send(cb, su, >>> m_AVND_SU_IS_ALL_SI(su) ? 0 : si); @@ -2085,11 +2138,9 @@ uint32_t >>> avnd_su_pres_inst_compterming_h >>> TRACE_ENTER2("CompTerminating event in the Instantiated >>> state:'%s' : '%s'", >>> su->name.value, compname); >>> >>> - if (m_AVND_SU_IS_PREINSTANTIABLE(su)) { >>> - if (m_AVND_SU_IS_FAILED(su)) { >>> - /* transition to terminating state */ >>> - avnd_su_pres_state_set(su, >>> SA_AMF_PRESENCE_TERMINATING); >>> - } >>> + if (m_AVND_SU_IS_FAILED(su)) { >>> + /* transition to terminating state */ >>> + avnd_su_pres_state_set(su, >>> SA_AMF_PRESENCE_TERMINATING); >>> } >>> >>> TRACE_LEAVE2("%u", rc); >>> @@ -2258,7 +2309,9 @@ uint32_t avnd_su_pres_terming_compuninst >>> su->name.value, compname); >>> >>> /* This case is for handling the case of admn su term while su is >>> restarting */ >>> - if (m_AVND_SU_IS_PREINSTANTIABLE(su) && >>> m_AVND_SU_IS_FAILED(su) && m_AVND_SU_IS_ADMN_TERM(su)) { >>> + if (m_AVND_SU_IS_PREINSTANTIABLE(su) && >>> m_AVND_SU_IS_FAILED(su) && >>> + (m_AVND_SU_IS_ADMN_TERM(su) || >>> avnd_sufailover_in_progress(su))) >>> + { >>> TRACE("PI SU"); >>> for (curr_comp = >>> m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST( >>> &su->comp_list)); >>> curr_comp; >>> @@ -2274,6 +2327,7 @@ uint32_t avnd_su_pres_terming_compuninst >>> } >>> } >>> >>> + >>> /* >>> * If pi su, pick the prv pi comp & trigger it's FSM with TermEv. >>> */ >>> @@ -2304,7 +2358,7 @@ uint32_t avnd_su_pres_terming_compuninst >>> /* >>> * If npi su, pick the prv csi & trigger it's comp fsm with >>> TermEv. >>> */ >>> - if (!m_AVND_SU_IS_PREINSTANTIABLE(su)) { >>> + if (!m_AVND_SU_IS_PREINSTANTIABLE(su) && >>> !m_AVND_SU_IS_FAILED(su)) { >>> TRACE("NPI SU"); >>> /* get the only csi rec */ >>> curr_csi = >>> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FI >>> RST(&comp->csi_list)); >>> @@ -2730,3 +2784,18 @@ uint32_t avnd_su_pres_instfailed_compuni >>> return rc; >>> } >>> >>> +/** >>> + * This function checks if the sufailover is going on. >>> + * @param su: ptr to the SU . >>> + * >>> + * @return true/false. >>> + */ >>> +bool avnd_sufailover_in_progress(AVND_SU *su) { >>> + if (m_AVND_SU_IS_FAILED(su) && (su->sufailover) && >>> + ((su->sg_redundancy_model == >>> SA_AMF_2N_REDUNDANCY_MODEL) || >>> + (su->sg_redundancy_model == >>> SA_AMF_NO_REDUNDANCY_MODEL)) && >>> + (avnd_cb->oper_state != >>> SA_AMF_OPERATIONAL_DISABLED) && (!su->is_ncs)) >>> + return true; >>> + return false; >>> +} > > ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
