Hi Nagu, Thanks for comments. I will revise the patch as your suggestion, but I was reading the code to understand more your idea. To me it happens only when the su wants to get assignment but the limit of number of assigned su is over, and at that time the sg has been stable already. And why we need to update_si_dep if no si is going to be assigned. But as you said there're the cases that I have not thought of. Can you give an example, or just brief description about the "test cases" you mentioned? Thanks again. BRs/Minh On 3/14/2014 8:52 PM, Nagendra Kumar wrote:
Nack. These kind of check has to be done in avd_sg_nway_si_assign or avd_sg_nacvred_s u_chose_asgn and that too after avd_sidep_update_si_dep_state_for_all_sis(). In way, red model, in some of the test cases, avd_sg_nway_si_assign is required t o call to make sg stable(sg->sg_fsm_state = AVD_SG_FSM_STABLE;). Thanks -Nagu -----Original Message----- From: Minh Hon Chau [[1]mailto:[email protected]] Sent: 07 March 2014 11:18 To: Nagendra Kumar; [2][email protected]; [3][email protected] Cc: [4][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 | 5 +++++ osaf/services/saf/amf/amfd/sg_nwayact_fsm.cc | 6 ++++++ 4 files changed, 33 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 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 @@ -1612,3 +1612,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 @@ -285,6 +285,11 @@ uint32_t avd_sg_nway_su_insvc_func(AVD_C if ((cb->init_state != AVD_APP_STATE) && (su->sg_of_su->sg_ncs_spec == SA_FALSE)) goto done; + /* If current number of assigned su exceeds the saAmfSGNumPrefAssignedSUs, + just skip the assignment. */ + if (sg_assigned_su_count(su->sg_of_su) >= su->sg_of_su- saAmfSGNumPrefAssignedSUs) + goto done; + /* a new su is available for assignments.. start assigning */ rc = avd_sg_nway_si_assign(cb, su->sg_of_su); 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 @@ -575,6 +575,12 @@ uint32_t avd_sg_nacvred_su_insvc_func(AV return NCSCC_RC_SUCCESS; } + /* If current number of active assigned su exceeds the saAmfSGNumPrefAssignedSUs, + just return success. */ + if (sg_assigned_su_count(su->sg_of_su) >= su->sg_of_su- saAmfSGNumPrefAssignedSUs) { + return NCSCC_RC_SUCCESS; + } + if (avd_sg_nacvred_su_chose_asgn(cb, su->sg_of_su) == NULL) { avd_sg_app_su_inst_func(cb, su->sg_of_su); if (AVD_SG_FSM_STABLE == su->sg_of_su->sg_fsm_state) { References 1. mailto:[email protected] 2. mailto:[email protected] 3. mailto:[email protected] 4. mailto:[email protected] ------------------------------------------------------------------------------ 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/13534_NeoTech _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
