Ack with minor comment :

+               TRACE_1("su'%s', current number of active SIs'%u'", 
su->name.value, su->saAmfSUNumCurrActiveSIs);

Should be 
+               TRACE_1("su'%s', current number of active SIs'%u', 
standbySIs'%u"", su->name.value, su->saAmfSUNumCurrActiveSIs,
                        su->saAmfSUNumCurrStandbySIs);


Thanks
-Nagu

> -----Original Message-----
> From: Minh Hon Chau [mailto:[email protected]]
> Sent: 07 April 2014 12:10
> To: Nagendra Kumar; [email protected]; [email protected]
> Cc: [email protected]
> Subject: [PATCH 1 of 1]
> 
>  osaf/services/saf/amf/amfd/include/sg.h      |   2 +-
>  osaf/services/saf/amf/amfd/sg.cc             |  21 +++++++++++++++++++++
>  osaf/services/saf/amf/amfd/sg_nway_fsm.cc    |  27
> +++++++++++++++++++++++++++
>  osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc |  24
> ++++++++++++++++++++++++
>  4 files changed, 73 insertions(+), 1 deletions(-)
> 
> 
> #
> #Problem: The implementation has not respected the AMF spec
> #according to the configuration of saAmfSGNumPrefAssignedSUs
> #
> #Analysis: In AMF spec, the 3.6.4.3 and 3.6.5.3 mention that the
> #saAmfSGNumPrefAssignedSUs affected in assignment in nway and
> #nway-active sg
> #
> #Change: Skip the SI assignment for the unassigned SU if the
> #current number of assigned SU exceeding the saAmfSGNumPrefAssignedSUs
> 
> diff --git a/osaf/services/saf/amf/amfd/include/sg.h
> b/osaf/services/saf/amf/amfd/include/sg.h
> --- a/osaf/services/saf/amf/amfd/include/sg.h
> +++ b/osaf/services/saf/amf/amfd/include/sg.h
> @@ -356,6 +356,6 @@ extern void avd_su_role_failover(struct
>  extern bool sg_is_tolerance_timer_running_for_any_si(AVD_SG *sg);
>  extern void avd_sg_adjust_config(AVD_SG *sg);
>  extern uint32_t sg_instantiated_su_count(const AVD_SG *sg);
> -
> +extern uint32_t sg_assigned_su_count(const AVD_SG *sg);
> 
>  #endif
> diff --git a/osaf/services/saf/amf/amfd/sg.cc
> b/osaf/services/saf/amf/amfd/sg.cc
> --- a/osaf/services/saf/amf/amfd/sg.cc
> +++ b/osaf/services/saf/amf/amfd/sg.cc
> @@ -1617,3 +1617,24 @@ uint32_t sg_instantiated_su_count(const
>       return inst_su_count;
>  }
> 
> +/**
> + * @brief Counts number of assigned su in the sg.
> + * @param Service Group
> + *
> + * @return Number of assigned su in the sg.
> + */
> +uint32_t sg_assigned_su_count(const AVD_SG *sg)
> +{
> +       uint32_t su_count;
> +       const AVD_SU *su;
> +
> +       for (su = sg->list_of_su, su_count = 0; su != NULL; su = 
> su->sg_list_su_next)
> {
> +               TRACE_1("su'%s', current number of active SIs'%u'", 
> su->name.value,
> su->saAmfSUNumCurrActiveSIs);
> +               if (su->saAmfSUNumCurrActiveSIs > 0 || su-
> >saAmfSUNumCurrStandbySIs > 0) {
> +                       su_count++;
> +               }
> +       }
> +
> +       return su_count;
> +}
> +
> diff --git a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> --- a/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> +++ b/osaf/services/saf/amf/amfd/sg_nway_fsm.cc
> @@ -1318,6 +1318,13 @@ AVD_SU *avd_sg_nway_get_su_std_equal(AVD
>                                (curr_su->saAmfSUNumCurrStandbySIs >=
> curr_su->sg_of_su->saAmfSGMaxStandbySIsperSU)))
>                       continue;
> 
> +             /* Do not pick up unassigned su if current number of assigned
> su
> +              * exceeds the saAmfSGNumPrefAssignedSUs
> +              */
> +             if ((sg_assigned_su_count(curr_su->sg_of_su) >= curr_su-
> >sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                     (curr_su->saAmfSUNumCurrActiveSIs == 0) &&
> (curr_su->saAmfSUNumCurrStandbySIs == 0))
> +                     continue;
> +
>               l_flag = true;
> 
>               /* Get the current no of Standby assignments on the su */
> @@ -1508,6 +1515,14 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
>                       if (!curr_su)
>                               continue;
> 
> +                     /* Do not pick up unassigned su if current number of
> assigned su
> +                      * exceeds the saAmfSGNumPrefAssignedSUs
> +                      */
> +                     if ((sg_assigned_su_count(curr_su->sg_of_su) >=
> curr_su->sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                             (curr_su->saAmfSUNumCurrActiveSIs == 0)
> && (curr_su->saAmfSUNumCurrStandbySIs == 0)) {
> +                             curr_su = 0;
> +                             continue;
> +                     }
>                       if ((curr_su->saAmfSuReadinessState ==
> SA_AMF_READINESS_IN_SERVICE) &&
>                           ((curr_su->sg_of_su->saAmfSGMaxActiveSIsperSU
> == 0) ||
>                            (curr_su->saAmfSUNumCurrActiveSIs < curr_su-
> >sg_of_su->saAmfSGMaxActiveSIsperSU)))
> @@ -1525,6 +1540,10 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
>                       for (curr_su = sg->list_of_su; curr_su; curr_su =
> curr_su->sg_list_su_next) {
>                               if (SA_AMF_READINESS_IN_SERVICE ==
> curr_su->saAmfSuReadinessState) {
>                                       is_all_su_oos = false;
> +                                     if ((sg_assigned_su_count(curr_su-
> >sg_of_su) >= curr_su->sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                                             (curr_su-
> >saAmfSUNumCurrActiveSIs == 0) && (curr_su->saAmfSUNumCurrStandbySIs
> == 0))
> +                                             continue;
> +
>                                       /* if equal distribution is needed when
> all SUs are of
>                                        * equal rank or no rank configured for
> any of the SU
>                                        */
> @@ -1614,6 +1633,10 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
>                            (curr_su->saAmfSUNumCurrStandbySIs >= curr_su-
> >sg_of_su->saAmfSGMaxStandbySIsperSU)))
>                               continue;
> 
> +                     if ((sg_assigned_su_count(curr_su->sg_of_su) >=
> curr_su->sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                             (curr_su->saAmfSUNumCurrActiveSIs == 0)
> && (curr_su->saAmfSUNumCurrStandbySIs == 0))
> +                             continue;
> +
>                       /* verify if this su does not have this assignment */
>                       if (avd_su_susi_find(cb, curr_su, &curr_si->name) !=
> AVD_SU_SI_REL_NULL)
>                               continue;
> @@ -1677,6 +1700,10 @@ uint32_t avd_sg_nway_si_assign(AVD_CL_CB
>                                        (curr_su-
> >saAmfSUNumCurrStandbySIs >= curr_su->sg_of_su-
> >saAmfSGMaxStandbySIsperSU)))
>                               continue;
> 
> +                     if ((sg_assigned_su_count(curr_su->sg_of_su) >=
> curr_su->sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                             (curr_su->saAmfSUNumCurrActiveSIs == 0)
> && (curr_su->saAmfSUNumCurrStandbySIs == 0))
> +                             continue;
> +
>                       su_found = true;
> 
>                       /* verify if this su does not have this assignment */
> diff --git a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
> b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
> --- a/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
> +++ b/osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc
> @@ -105,6 +105,14 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD
>                               continue;
>                       }
> 
> +                     /* Do not pick up unassigned su if current number of
> assigned su
> +                      * exceeds the saAmfSGNumPrefAssignedSUs
> +                      */
> +                     if ((sg_assigned_su_count(i_su->sg_of_su) >= i_su-
> >sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                             (i_su->saAmfSUNumCurrActiveSIs == 0)) {
> +                             i_su = i_su->sg_list_su_next;
> +                             continue;
> +                     }
>                       if (avd_su_susi_find(cb, i_su, &i_si->name)
>                           != AVD_SU_SI_REL_NULL) {
>                               /* This SU has already a assignment for this SI
> go to the
> @@ -145,6 +153,12 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD
>                               continue;
>                       }
> 
> +                     if ((sg_assigned_su_count(i_su->sg_of_su) >= i_su-
> >sg_of_su->saAmfSGNumPrefAssignedSUs) &&
> +                             (i_su->saAmfSUNumCurrActiveSIs == 0)) {
> +                             i_su = i_su->sg_list_su_next;
> +                             continue;
> +                     }
> +
>                       l_flag = true;
> 
>                       if (m_AVD_SI_ACTV_MAX_SU(i_si) <=
> m_AVD_SI_ACTV_CURR_SU(i_si)) {
> @@ -1998,6 +2012,16 @@ static AVD_SU *avd_get_qualified_su(AVD_
>                       i_su = i_su->sg_list_su_next;
>                       continue;
>               }
> +
> +             /* Do not pick up unassigned su if current number of assigned
> su
> +              * exceeds the saAmfSGNumPrefAssignedSUs
> +              */
> +             if ((sg_assigned_su_count(i_su->sg_of_su) >= i_su->sg_of_su-
> >saAmfSGNumPrefAssignedSUs) &&
> +                     (i_su->saAmfSUNumCurrActiveSIs == 0)) {
> +                     i_su = i_su->sg_list_su_next;
> +                     continue;
> +             }
> +
>               l_flag = true;
>               if (avd_su_susi_find(avd_cb, i_su, &i_si->name) !=
> AVD_SU_SI_REL_NULL) {
>                       /* This SU has already a assignment for this SI go to 
> the

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to