To add on, my comments at a high level, is also to nitpick any possible 
problems born out of  parallelism.
-Mathi.

> -----Original Message-----
> From: Mathivanan Naickan Palanivelu
> Sent: Tuesday, June 25, 2013 3:20 PM
> To: Hans Feldt
> Cc: [email protected]
> Subject: Re: [devel] [PATCH 6 of 6] amf: handle sufailover in SU FSM and
> Comp FSM at amfnd [#98]
> 
> > -----Original Message-----
> > From: Hans Feldt [mailto:[email protected]]
> > Sent: Tuesday, June 25, 2013 3:01 PM
> > To: Mathivanan Naickan Palanivelu
> > Cc: Praveen Malviya; Nagendra Kumar;
> > [email protected]
> > Subject: Re: [PATCH 6 of 6] amf: handle sufailover in SU FSM and Comp
> > FSM at amfnd [#98]
> >
> >
> > On 06/24/2013 04:39 PM, Mathivanan Naickan Palanivelu wrote:
> > > Hi Praveen,
> > >
> > > Thanks for the clarification.
> > > Please find some other comments below:
> > >
> > > - I'm sure you would have had a reason to do it this way, but I
> > > thought
> > alternatively performing the repair at the AMFND itself(instead of
> > notifying to AMFD) is one viable option!
> >
> > Guess not it interferes with a potential auto adjust feature right?
> 
> I meant that we could avoid the 'extra step' of informing AMFD.
> May be, we could reduce the latency (in repairing) if avoid going through
> AMFD.
> Well, AMFND could be made aware of autoadjust attributes, isn't it!
> 
> >
> > > Some other comments I had in mind are:
> > > - is si-si dependencies automatically taken care by these changes?
> > > - are we honouring 'order' of termination of components based on the
> > 'instantiationlevel'(in reverse)?
> >
> > 3.11.1.3.2 SU failover:
> >
> > "If the service unit is configured to fail over as a single entity
> > (saAmfSUFailover set to SA_TRUE), all other components of the service
> > unit are abruptly terminated"
> >
> > Does not say anything about ordering. Should we add some defined
> > ordering semantics on top of that you mean?
> >
> >
> I meant the below. Also, SU failover 'effectively' involves restart of the 
> failed
> SU!
> 
> > FYI just realized ordering and semantics of "SU restart" is wrong.
> > Will write a defect.
> 
> I suspected this problem could exist.
> 
> Thanks,
> Mathi.
> 
> >
> > Thanks,
> > Hans
> >
> > >
> > > Thanks,
> > > Mathi.
> > >
> > >
> > >> -----Original Message-----
> > >> From: praveen malviya
> > >> Sent: Friday, June 21, 2013 6:20 PM
> > >> To: Mathivanan Naickan Palanivelu
> > >> Cc: [email protected]; Nagendra Kumar; opensaf-
> > >> [email protected]
> > >> Subject: Re: [PATCH 6 of 6] amf: handle sufailover in SU FSM and
> > >> Comp
> > FSM
> > >> at amfnd [#98]
> > >>
> > >>>> Can you briefly highlight during which scenario the **autorepair
> > >>>> is
> > taken
> > >> into account by this patch.
> > >>
> > >> **autorepiar is one of the attributes of SG (saAmfSGAutoRepair).
> > >> During sufailover AMF will perform recovery first.
> > >> If saAmfSGAutoRepair is true for the SG of faulted SU then AMF will
> > perform
> > >> auto-repair by enabling the SU.
> > >>
> > >> Thanks
> > >> Praveen
> > >>
> > >> On 21-Jun-13 5:39 PM, Mathivanan Naickan Palanivelu wrote:
> > >>> Hi Praveen,
> > >>>
> > >>> Good that you have sent them as patch series and thanks for
> > >>> working on
> > >> this long awaited ticket.
> > >>> A quick question.
> > >>>
> > >>> Can you briefly highlight during which scenario the **autorepair
> > >>> is taken
> > >> into account by this patch.
> > >>>
> > >>> Thanks,
> > >>> Mathi.
> > >>>
> > >>>> -----Original Message-----
> > >>>> From: Praveen Malviya
> > >>>> Sent: Friday, June 07, 2013 12:10 PM
> > >>>> To: [email protected]; Mathivanan Naickan Palanivelu;
> > Nagendra
> > >>>> Kumar
> > >>>> Cc: [email protected]
> > >>>> Subject: [PATCH 6 of 6] amf: handle sufailover in SU FSM and Comp
> > FSM
> > >>>> at amfnd [#98]
> > >>>>
> > >>>>    osaf/services/saf/avsv/avnd/avnd_clc.c  |  130
> > >>>> ++++++++++++++++++++++-
> > >>>> --------
> > >>>>    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 |   81 +++++++++++++---
> --
> > -
> > >>>>    4 files changed, 150 insertions(+), 64 deletions(-)
> > >>>>
> > >>>>
> > >>>>    With this patch amfnd informs amfd for failover of assignments
> > >>>> when all components are terminated successfully during
> > >>>> suFailover. If some component faults and SU moves to inst/term
> > >>>> failed state, compFailover 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
> > >>>> @@ -72,6 +72,7 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_
> > >>>>
> > >>>>    static uint32_t
> > >>>> avnd_comp_clc_resp(NCS_OS_PROC_EXECUTE_TIMED_CB_INFO *);
> > >>>>    static uint32_t avnd_instfail_su_failover(AVND_CB *, AVND_SU
> > >>>> *, AVND_COMP *);
> > >>>> +static bool all_comps_terminated_in_su(AVND_SU *su);
> > >>>>
> > >>>>
> > >>>>
> > >>
> >
> /**********************************************************
> > >>>> *****************
> > >>>>     ** C O M P O N E N T   C L C   F S M   M A T R I X   D E F I N I T 
> > >>>> I O N **
> > >>>> @@ -840,9 +841,29 @@ uint32_t avnd_comp_clc_fsm_run(AVND_CB
> *
> > >>>>                        break;
> > >>>>                }
> > >>>>        }
> > >>>> -
> > >>>>        /* get the prv presence state */
> > >>>>        prv_st = comp->pres;
> > >>>> +
> > >>>> +      if (avnd_sufailover_in_progress(comp->su) &&
> > >>>> +                      ((ev ==
> > >>>> AVND_COMP_CLC_PRES_FSM_EV_CLEANUP_SUCC) ||
> > >>>> +                       (ev ==
> > >>>> AVND_COMP_CLC_PRES_FSM_EV_CLEANUP_FAIL)))
> > >>>> +      {
> > >>>> +              TRACE("SU_FAILOVER is in progress, event '%s'",
> > >>>> pres_state_evt[ev]);
> > >>>> +              if (ev ==
> AVND_COMP_CLC_PRES_FSM_EV_CLEANUP_FAIL)
> > >>>> +                      avnd_comp_pres_state_set(comp,
> > >>>> SA_AMF_PRESENCE_TERMINATION_FAILED);
> > >>>> +              else
> > >>>> +                      avnd_comp_pres_state_set(comp,
> > >>>> SA_AMF_PRESENCE_UNINSTANTIATED);
> > >>>> +              /* If all components terminated, finish sufailover at
> amfnd.
> > >>>> */
> > >>>> +              if (all_comps_terminated_in_su(comp->su))
> > >>>> +              {
> > >>>> +                      LOG_NO("Terminated all components in
> '%s'", comp-
> > >>>>> su->name.value);
> > >>>> +                      LOG_NO("Informing director of sufailover");
> > >>>> +                      rc = avnd_di_oper_send(cb, comp->su,
> > >>>> AVSV_ERR_RCVR_SU_FAILOVER);
> > >>>> +                      osafassert(NCSCC_RC_SUCCESS == rc);
> > >>>> +                      avnd_su_si_del(cb, &comp->su->name);
> > >>>> +              }
> > >>>> +      }
> > >>>> +
> > >>>>
> > >>>>        /* if already enabled, stop PM & AM */
> > >>>>        if (prv_st == SA_AMF_PRESENCE_INSTANTIATED && @@ -
> 1065,8
> > >> +1086,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 +1120,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 +1216,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
> > >>>> +2794,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,14 +2843,39 @@ 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;
> > >>>>    }
> > >>>>
> > >>>> +/**
> > >>>> + * 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_node))) {
> > >>>> +
> > >>>> +              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;
> > >>>> +}
> > >>>> +
> > >>>> 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
> > >>>> @@ -1411,17 +1411,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 +1437,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;
> > >>>>                }
> > >>>> @@ -1445,7 +1452,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;
> > >>>>                        }
> > >>>> @@ -1459,7 +1466,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;
> > >>>>
> > >>>> @@ -1503,7 +1510,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);
> > >>>>
> > >>>>                }
> > >>>>
> > >>>> @@ -1521,13 +1528,19 @@ uint32_t
> > avnd_su_pres_st_chng_prc(AVND_C
> > >>>>                        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
> > >>>> +                      {
> > >>>> +                              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
> */
> > >>>> @@ -1538,7 +1551,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);
> > >>>> @@ -2073,11 +2086,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);
> > >>>> @@ -2246,7 +2257,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;
> > >>>> @@ -2262,6 +2275,7 @@ uint32_t
> avnd_su_pres_terming_compuninst
> > >>>>                }
> > >>>>        }
> > >>>>
> > >>>> +
> > >>>>        /*
> > >>>>         * If pi su, pick the prv pi comp & trigger it's FSM with 
> > >>>> TermEv.
> > >>>>         */
> > >>>> @@ -2292,7 +2306,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));
> > >>>> @@ -2718,3 +2732,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

------------------------------------------------------------------------------
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

Reply via email to