Ack (code review only).

Thanks
-Nagu

> -----Original Message-----
> From: Praveen Malviya
> Sent: 15 July 2014 17:39
> To: [email protected]; Nagendra Kumar; [email protected]
> Cc: [email protected]
> Subject: [PATCH 1 of 1] amfnd : mark SU UNINSTANTIATED if all comps are
> UNINSTANTIATED during compfailover [#359]
> 
>  osaf/services/saf/amf/amfnd/clc.cc            |   4 +++-
>  osaf/services/saf/amf/amfnd/err.cc            |  14 +++++++++++++-
>  osaf/services/saf/amf/amfnd/include/avnd_su.h |   1 +
>  osaf/services/saf/amf/amfnd/susm.cc           |   9 ++++-----
>  4 files changed, 21 insertions(+), 7 deletions(-)
> 
> 
> If a SU has one component and it moves to UNINSTANTIATED state then AMF
> does not generate presense state change notification for UNINSTANTIATED state
> of SU.
> 
> During component failover, a component moves to TERMINATING state as it is
> cleaned up by AMF. This leads to TERMINATING state of SU. After successful
> termination of the component it is marked as UNINSTANTIATED but SU remains
> in TERMINATING state. Repair of SU leads to re-instantiation of component.
> Thus component transtions from UNINSTANTIATED->INSTANTIATED->
> INSTANTIATED state. But SU is transitioning from TERMINATING to
> INSTANTIATED state directly.
> Since presence state of SU represents combined presence states of components,
> SU should also be marked as UNINSTANTIATED when a single component is
> marked as UNINSTANTIATED. Same behaviour is true if all the component are
> UNINSTANTIATED due to component failover.
> 
> Patch marks presence state of SU UNINSTANTIATED if all of its components are
> UNINSTANTIATED during component failover.
> 
> diff --git a/osaf/services/saf/amf/amfnd/clc.cc
> b/osaf/services/saf/amf/amfnd/clc.cc
> --- a/osaf/services/saf/amf/amfnd/clc.cc
> +++ b/osaf/services/saf/amf/amfnd/clc.cc
> @@ -1274,7 +1274,9 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_
>                       ev = AVND_SU_PRES_FSM_EV_COMP_TERM_FAIL;
>               else if ((SA_AMF_PRESENCE_TERMINATING == final_st) &&
> (comp->su->pres == SA_AMF_PRESENCE_RESTARTING))
>                       ev = AVND_SU_PRES_FSM_EV_COMP_TERMINATING;
> -             else if ((sufailover_in_progress(comp->su) ||
> sufailover_during_nodeswitchover(comp->su)) &&
> +             else if ((sufailover_in_progress(comp->su) ||
> +                                     (avnd_cb->term_state ==
> AVND_TERM_STATE_NODE_SWITCHOVER_STARTED) ||
> +                                     (all_comps_terminated_in_su(comp-
> >su) == true)) &&
>                               (SA_AMF_PRESENCE_UNINSTANTIATED ==
> final_st))
>                       /* If sufailover flag is enabled, then SU FSM needs to 
> be
> triggered in both sufailover
>                          and nodeswitchover escalation.
> diff --git a/osaf/services/saf/amf/amfnd/err.cc
> b/osaf/services/saf/amf/amfnd/err.cc
> --- a/osaf/services/saf/amf/amfnd/err.cc
> +++ b/osaf/services/saf/amf/amfnd/err.cc
> @@ -960,7 +960,7 @@ uint32_t avnd_err_rcvr_node_failover(AVN  uint32_t
> avnd_err_su_repair(AVND_CB *cb, AVND_SU *su)  {
>       AVND_COMP *comp = 0;
> -     bool is_en;
> +     bool is_en, is_uninst = false, is_comp_insting = false;
>       uint32_t rc = NCSCC_RC_SUCCESS;
>       TRACE_ENTER();
> 
> @@ -973,6 +973,9 @@ uint32_t avnd_err_su_repair(AVND_CB *cb,
>       if (su->pres == SA_AMF_PRESENCE_INSTANTIATION_FAILED)
>               return rc;
> 
> +     if (all_comps_terminated_in_su(su) == true)
> +             is_uninst = true;
> +
>       /* scan & instantiate failed pi comps */
>       for (comp =
> m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&s
> u->comp_list));
>            comp; comp =
> m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT(&c
> omp->su_dll_node))) { @@ -989,6 +992,9 @@ uint32_t
> avnd_err_su_repair(AVND_CB *cb,
> 
>       m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp,
> AVND_CKPT_COMP_FLAG_CHANGE);
>                       }
>               }
> +             if (comp->pres == SA_AMF_PRESENCE_INSTANTIATING)
> +                     is_comp_insting = true;
> +
>       }                       /* for */
> 
>       if (!m_AVND_SU_IS_PREINSTANTIABLE(su)) { @@ -1008,6 +1014,12
> @@ uint32_t avnd_err_su_repair(AVND_CB *cb,
>               }
>       }
> 
> +     /* This is the case when SU is in uninstantiated state and one of the
> components
> +        is moved to instantiating state. Mark SU
> SA_AMF_PRESENCE_INSTANTIATING as there
> +        is no such event handler and event in SU FSM.
> +      */
> +     if ((is_uninst == true) && (is_comp_insting == true))
> +            avnd_su_pres_state_set(su, SA_AMF_PRESENCE_INSTANTIATING);
>   done:
>       TRACE_LEAVE2("retval=%u", rc);
>       return rc;
> diff --git a/osaf/services/saf/amf/amfnd/include/avnd_su.h
> b/osaf/services/saf/amf/amfnd/include/avnd_su.h
> --- a/osaf/services/saf/amf/amfnd/include/avnd_su.h
> +++ b/osaf/services/saf/amf/amfnd/include/avnd_su.h
> @@ -407,6 +407,7 @@ extern bool sufailover_in_progress(const  extern bool
> sufailover_during_nodeswitchover(const AVND_SU *su);  extern bool
> all_csis_in_removed_state(const AVND_SU *su);  extern void
> su_reset_restart_count_in_comps(const AVND_SU *su);
> +extern bool all_comps_terminated_in_su(const AVND_SU *su);
> 
>  void su_increment_su_restart_count(AVND_SU& su);  void
> su_increment_comp_restart_count(AVND_SU& su); diff --git
> a/osaf/services/saf/amf/amfnd/susm.cc
> b/osaf/services/saf/amf/amfnd/susm.cc
> --- a/osaf/services/saf/amf/amfnd/susm.cc
> +++ b/osaf/services/saf/amf/amfnd/susm.cc
> @@ -1329,7 +1329,7 @@ done:
>   * @param su
>   * @return bool
>   */
> -static bool all_comps_terminated_in_su(const AVND_SU *su)
> +bool all_comps_terminated_in_su(const AVND_SU *su)
>  {
>       AVND_COMP *comp;
> 
> @@ -1566,7 +1566,7 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
>                       }
>                       else
>                       {
> -                             if (m_AVND_SU_IS_FAILED(su)) {
> +                             if (m_AVND_SU_IS_FAILED(su) && (su-
> >si_list.n_nodes == 0)) {
>                                       m_AVND_SU_FAILED_RESET(su);
> 
>       m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su,
> AVND_CKPT_SU_FLAG_CHANGE);
>                               }
> @@ -2472,9 +2472,8 @@ uint32_t avnd_su_pres_terming_compuninst
>       TRACE_ENTER2("Component Uninstantiated event in the Terminating
> state:'%s' : '%s'",
>                                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) ||
> sufailover_in_progress(su)))
> +     /* Mark failed PI SU uninstantiated whenever all components are
> uninstantiated. */
> +     if (m_AVND_SU_IS_PREINSTANTIABLE(su) &&
> m_AVND_SU_IS_FAILED(su))
>       {
>               TRACE("PI SU");
>               for (curr_comp =
> m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&s
> u->comp_list));

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to