Hi Thang, Thanks for your comment. Yes, the scenario is not recommended in document, but every step is allowed by AMF. And I think the code can be updated for better. That's why I create ticket as enhancement, not defect. Let see what is AMF experts' opinion.
Best Regards, ThuanTr -----Original Message----- From: Thang Nguyen <thang.d.ngu...@dektech.com.au> Sent: Monday, April 8, 2019 10:21 AM To: 'thuan.tran' <thuan.t...@dektech.com.au>; gary....@dektech.com.au; minh.c...@dektech.com.au Cc: opensaf-devel@lists.sourceforge.net Subject: RE: [devel] [PATCH 1/1] amf: fix no active assignment even one in-service SU can be assigned [#3020] Hi Thuan, Currently from AMF Release 5.2 Programmer's Reference (Nov 2018 ). There already two use cases that support adding new component/csi to SG (e.i, dynamic configurations change). You can refer section 7.1.1.1 and 7.1.1.2 for more info. So I'm not sure you new use case is valid or not. Or if it's valid, document need to updated too. B.R /Thang -----Original Message----- From: thuan.tran <thuan.t...@dektech.com.au> Sent: Monday, March 18, 2019 3:05 PM To: gary....@dektech.com.au; minh.c...@dektech.com.au Cc: opensaf-devel@lists.sourceforge.net Subject: [devel] [PATCH 1/1] amf: fix no active assignment even one in-service SU can be assigned [#3020] AMFD should try assign SI active for other in-service SUs if fail to assign for current in-service SU --- src/amf/amfd/sg_2n_fsm.cc | 75 +++++++++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 29 deletions(-) diff --git a/src/amf/amfd/sg_2n_fsm.cc b/src/amf/amfd/sg_2n_fsm.cc index 91ffc63..ba0f72e 100644 --- a/src/amf/amfd/sg_2n_fsm.cc +++ b/src/amf/amfd/sg_2n_fsm.cc @@ -630,6 +630,43 @@ done: } /*************************************************************************** ** + * Function: avd_sg_2n_assign_si + * + * Purpose: This function choose and assign SIs in the SG that dont have + * active assignment. + * + * Input: cb - the AVD control block + * sg - The pointer to the service group. + * su - The pointer to the service unit to be assigned ACTIVE. + * + * Returns: True if assign succeed, otherwise return false + * + +*********************************************************************** +***/ static bool avd_sg_2n_assign_si(AVD_CL_CB *cb, AVD_SG *sg, AVD_SU +*su) { + bool l_flag = false; + AVD_SU_SI_REL *tmp_susi; + /* choose and assign SIs in the SG that dont have active assignment +*/ + for (const auto &i_si : sg->list_of_si) { + if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) && + (i_si->list_of_csi != nullptr) && + (i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) && + (i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) && + (i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) && + (i_si->list_of_sisu == AVD_SU_SI_REL_NULL) && + (su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) { + /* found a SI that needs active assignment. */ + if (avd_new_assgn_susi(cb, su, i_si, SA_AMF_HA_ACTIVE, false, + &tmp_susi) == NCSCC_RC_SUCCESS) { + l_flag = true; + } else { + LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str()); + } + } + } + return l_flag; +} + +/********************************************************************** +******* * Function: avd_sg_2n_su_chose_asgn * * Purpose: This function will identify the current active SU. @@ -675,7 +712,10 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, AVD_SG *sg) { for (const auto &iter : sg->list_of_su) { if (iter->saAmfSuReadinessState == SA_AMF_READINESS_IN_SERVICE) { a_su = iter; - break; + l_flag = avd_sg_2n_assign_si(cb, sg, a_su); + if (l_flag == true) { + break; + } } } @@ -683,36 +723,13 @@ static AVD_SU *avd_sg_2n_su_chose_asgn(AVD_CL_CB *cb, AVD_SG *sg) { TRACE("No in service SUs available in the SG"); goto done; } - } else { /* if (a_susi == AVD_SU_SI_REL_NULL) */ - + } else { /* if (a_susi != AVD_SU_SI_REL_NULL) */ a_su = a_susi->su; - } - - if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) { - TRACE("The current active SU is OOS so return"); - goto done; - } - - /* check if any more active SIs can be assigned to this SU */ - l_flag = false; - - /* choose and assign SIs in the SG that dont have active assignment */ - for (const auto &i_si : sg->list_of_si) { - if ((i_si->saAmfSIAdminState == SA_AMF_ADMIN_UNLOCKED) && - (i_si->list_of_csi != nullptr) && - (i_si->si_dep_state != AVD_SI_SPONSOR_UNASSIGNED) && - (i_si->si_dep_state != AVD_SI_UNASSIGNING_DUE_TO_DEP) && - (i_si->si_dep_state != AVD_SI_READY_TO_UNASSIGN) && - (i_si->list_of_sisu == AVD_SU_SI_REL_NULL) && - (a_su->saAmfSUNumCurrActiveSIs < sg->saAmfSGMaxActiveSIsperSU)) { - /* found a SI that needs active assignment. */ - if (avd_new_assgn_susi(cb, a_su, i_si, SA_AMF_HA_ACTIVE, false, - &tmp_susi) == NCSCC_RC_SUCCESS) { - l_flag = true; - } else { - LOG_ER("%s:%u: %s", __FILE__, __LINE__, i_si->name.c_str()); - } + if (a_su->saAmfSuReadinessState != SA_AMF_READINESS_IN_SERVICE) { + TRACE("The current active SU is OOS so return"); + goto done; } + l_flag = avd_sg_2n_assign_si(cb, sg, a_su); } /* if any assignments have been done return the SU */ -- 2.7.4 _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel