Hi Nagu, Hans F, Hans N,

Can you please help to review the patch of #584?
This patch has been revised as last comments from Nagu which moving the 
'check' into avd_sg_nway_si_assign and avd_sg_nacvred_su_chose_asgn. Thanks

BR/Minh
On 4/7/2014 4:40 PM, opensaf-devel-requ...@lists.sourceforge.net wrote:
> Send Opensaf-devel mailing list submissions to
>       opensaf-devel@lists.sourceforge.net
>
> To subscribe or unsubscribe via the World Wide Web, visit
>       https://lists.sourceforge.net/lists/listinfo/opensaf-devel
> or, via email, send a message with subject or body 'help' to
>       opensaf-devel-requ...@lists.sourceforge.net
>
> You can reach the person managing the list at
>       opensaf-devel-ow...@lists.sourceforge.net
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Opensaf-devel digest..."
>
>
> Today's Topics:
>
>     1. [PATCH 2 of 3] avsv: include and use comp capability in SUSI
>        msg [#574] (Hans Feldt)
>     2. [PATCH 3 of 3] avsv: include su_failover in REG_SU msg [#574]
>        (Hans Feldt)
>     3. [PATCH 1 of 1] (Minh Hon Chau)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 07 Apr 2014 07:35:01 +0200
> From: Hans Feldt <osafde...@gmail.com>
> Subject: [devel] [PATCH 2 of 3] avsv: include and use comp capability
>       in SUSI msg [#574]
> To: praveen.malv...@oracle.com, nagendr...@oracle.com,
>       hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Message-ID: <41c3d1aa41d0a6e28188.1396848901@localhost6.localdomain6>
> Content-Type: text/plain; charset="us-ascii"
>
>   osaf/libs/common/avsv/avsv_d2nedu.c             |   7 +
>   osaf/libs/common/avsv/include/avsv_d2nmsg.h     |   1 +
>   osaf/services/saf/avsv/avd/avd_util.c           |  20 +++++
>   osaf/services/saf/avsv/avnd/avnd_comp.c         |  51 +-------------
>   osaf/services/saf/avsv/avnd/avnd_sidb.c         |  92 
> ++++++++++++++++++------
>   osaf/services/saf/avsv/avnd/avnd_su.c           |  16 +++-
>   osaf/services/saf/avsv/avnd/include/avnd_comp.h |   2 +-
>   7 files changed, 112 insertions(+), 77 deletions(-)
>
>
> When the AMF node director receives the SUSI ASGN message, for each CSI it 
> reads
> the saAmfCSType attribute from IMM.
>
> When the AMF node director receives the SUSI MOD message, for each CSI it 
> reads
> the saAmfCtCompCapability attribute from the comp and csi associated
> SaAmfCtCsType instance.
>
> In any of these cases if IMM does not respond in a timely manner the amfnd
> process will be aborted and the node restarted.
>
> By including component capability (an int) in the SUSI ASG msg, these reads
> from IMM can be completely skipped in the node director.
>
> diff --git a/osaf/libs/common/avsv/avsv_d2nedu.c 
> b/osaf/libs/common/avsv/avsv_d2nedu.c
> --- a/osaf/libs/common/avsv/avsv_d2nedu.c
> +++ b/osaf/libs/common/avsv/avsv_d2nedu.c
> @@ -750,6 +750,7 @@ uint32_t avsv_edp_susi_asgn(EDU_HDL *hdl
>   {
>       uint32_t rc = NCSCC_RC_SUCCESS;
>       AVSV_SUSI_ASGN *struct_ptr = NULL, **d_ptr = NULL;
> +     uint16_t ver5 = AVSV_AVD_AVND_MSG_FMT_VER_5;
>   
>       EDU_INST_SET avsv_susi_asgn_rules[] = {
>               {EDU_START, avsv_edp_susi_asgn, EDQ_LNKLIST, 0, 0,
> @@ -767,6 +768,12 @@ uint32_t avsv_edp_susi_asgn(EDU_HDL *hdl
>                (long)&((AVSV_SUSI_ASGN *)0)->stdby_rank, 0, NULL},
>               {EDU_EXEC, m_NCS_EDP_SAAMFCSITRANSITIONDESCRIPTORT, 0, 0, 0,
>                (long)&((AVSV_SUSI_ASGN *)0)->active_comp_dsc, 0, NULL},
> +
> +             /* Include comp capability in version 5 and higher */
> +             {EDU_VER_GE, NULL, 0, 0, 2, 0, 0, (EDU_EXEC_RTINE)((uint16_t 
> *)(&(ver5)))},
> +             {EDU_EXEC, ncs_edp_uns32, 0, 0, 0,
> +              (long)&((AVSV_SUSI_ASGN *)0)->capability, 0, NULL},
> +
>               {EDU_EXEC, avsv_edp_csi_attr_info, 0, 0, 0,
>                (long)&((AVSV_SUSI_ASGN *)0)->attrs, 0, NULL},
>   
> diff --git a/osaf/libs/common/avsv/include/avsv_d2nmsg.h 
> b/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> --- a/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> +++ b/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> @@ -290,6 +290,7 @@ typedef struct avsv_susi_asgn {
>       uint32_t csi_rank;              /* The rank of the CSI in the SI */
>       uint32_t stdby_rank;
>       SaAmfCSITransitionDescriptorT active_comp_dsc;
> +     SaAmfCompCapabilityModelT capability;
>       AVSV_CSI_ATTRS attrs;   /* Inside the struct there is a
>                                        * array of param vals.*/
>       struct avsv_susi_asgn *next;
> diff --git a/osaf/services/saf/avsv/avd/avd_util.c 
> b/osaf/services/saf/avsv/avd/avd_util.c
> --- a/osaf/services/saf/avsv/avd/avd_util.c
> +++ b/osaf/services/saf/avsv/avd/avd_util.c
> @@ -770,6 +770,24 @@ static uint32_t avd_prep_csi_attr_info(A
>       return NCSCC_RC_SUCCESS;
>   }
>   
> +/**
> + * Get saAmfCtCompCapability from the SaAmfCtCsType instance associated with 
> the
> + * types of csi and comp.
> + * @param csi
> + * @param comp
> + * @return SaAmfCompCapabilityModelT
> + */
> +static SaAmfCompCapabilityModelT get_comp_capability(const AVD_CSI *csi,
> +             const AVD_COMP *comp)
> +{
> +     SaNameT dn;
> +     avsv_create_association_class_dn(&csi->cstype->name,
> +             &comp->comp_type->name, "safSupportedCsType", &dn);
> +     AVD_CTCS_TYPE *ctcs_type = avd_ctcstype_get(&dn);
> +     osafassert(ctcs_type);
> +     return ctcs_type->saAmfCtCompCapability;
> +}
> +
>   
> /*****************************************************************************
>    * Function: avd_snd_susi_msg
>    *
> @@ -1001,6 +1019,8 @@ uint32_t avd_snd_susi_msg(AVD_CL_CB *cb,
>                       compcsi_info->csi_name = l_compcsi->csi->name;
>                       compcsi_info->csi_rank = l_compcsi->csi->rank;
>                       compcsi_info->active_comp_dsc = trans_dsc;
> +                     compcsi_info->capability =
> +                             get_comp_capability(l_compcsi->csi, 
> l_compcsi->comp);
>   
>                       /* fill the Attributes for the CSI if new. */
>                       if (actn == AVSV_SUSI_ACT_ASGN) {
> 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
> @@ -876,54 +876,6 @@ uint32_t avnd_comp_unreg_prc(AVND_CB *cb
>   }
>   
>   
> /****************************************************************************
> -  Name          : avnd_comp_cap_x_act_or_1_act_check
> -
> -  Description   : This routine checks the capability of component wrt cs 
> type.
> -
> -  Arguments     : comp - ptr to the comp
> -                  csi  - ptr to the csi
> -
> -  Return Values : true if comp cap is either x_act or 1_act , else false.
> -
> -******************************************************************************/
> -static bool avnd_comp_cap_x_act_or_1_act_check(SaNameT *comp_type, SaNameT 
> *csi_type)
> -{
> -     bool rc = false;
> -     SaAisErrorT error;
> -     SaNameT dn;
> -     SaImmAccessorHandleT accessorHandle;
> -     const SaImmAttrValuesT_2 **attributes;
> -     SaAmfCompCapabilityModelT comp_cap;
> -     SaImmAttrNameT attributeNames[2] = {"saAmfCtCompCapability", NULL};
> -     SaImmHandleT immOmHandle;
> -     SaVersionT immVersion = { 'A', 2, 1 };
> -
> -     TRACE_ENTER2("comptype = '%s' : csitype = '%s'", comp_type->value, 
> csi_type->value);
> -
> -     avsv_create_association_class_dn(csi_type, comp_type, 
> "safSupportedCsType", &dn);
> -
> -     immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion);
> -     immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle);
> -
> -     if ((error = immutil_saImmOmAccessorGet_2(accessorHandle, &dn, 
> attributeNames, (SaImmAttrValuesT_2 ***)&attributes)) != SA_AIS_OK) {
> -             LOG_ER("saImmOmAccessorGet FAILED %u for'%s'", error, dn.value);
> -             goto done;
> -     }
> -
> -     if (immutil_getAttr("saAmfCtCompCapability", attributes, 0, &comp_cap) 
> != SA_AIS_OK)
> -             osafassert(0);
> -
> -     if((SA_AMF_COMP_X_ACTIVE == comp_cap) || (SA_AMF_COMP_1_ACTIVE == 
> comp_cap))
> -             rc = true;
> -done:
> -     immutil_saImmOmAccessorFinalize(accessorHandle);
> -     immutil_saImmOmFinalize(immOmHandle);
> -
> -     TRACE_LEAVE2("%u", rc);
> -     return rc;
> -}
> -
> -/****************************************************************************
>     Name          : avnd_comp_csi_assign
>    
>     Description   : This routine assigns the CSI to the component. It is
> @@ -1009,7 +961,8 @@ uint32_t avnd_comp_csi_assign(AVND_CB *c
>       /* skip standby assignment to x_active or 1_active capable comp */
>       curr_csi = (csi) ? csi : 
> m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&comp->csi_list));
>       if (curr_csi && (SA_AMF_HA_STANDBY == curr_csi->si->curr_state) &&
> -                     (true == 
> avnd_comp_cap_x_act_or_1_act_check(&comp->saAmfCompType, 
> &curr_csi->saAmfCSType))) {
> +             ((curr_csi->capability == SA_AMF_COMP_X_ACTIVE) ||
> +                     (curr_csi->capability == SA_AMF_COMP_1_ACTIVE))) {
>               m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(curr_csi, 
> AVND_COMP_CSI_ASSIGN_STATE_ASSIGNED);
>               m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, curr_csi, 
> AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE);
>               rc = avnd_comp_csi_assign_done(cb, comp, csi);
> diff --git a/osaf/services/saf/avsv/avnd/avnd_sidb.c 
> b/osaf/services/saf/avsv/avnd/avnd_sidb.c
> --- a/osaf/services/saf/avsv/avnd/avnd_sidb.c
> +++ b/osaf/services/saf/avsv/avnd/avnd_sidb.c
> @@ -246,6 +246,68 @@ AVND_SU_SI_REC *avnd_su_si_rec_add(AVND_
>       return 0;
>   }
>   
> +static void get_cstype(SaImmHandleT immOmHandle,
> +             SaImmAccessorHandleT accessorHandle,
> +             const SaNameT *csi_name, SaNameT *cstype)
> +{
> +     SaAisErrorT error;
> +     const SaImmAttrValuesT_2 **attributes;
> +     SaImmAttrNameT attributeNames[2] = {"saAmfCSType", NULL};
> +
> +     // TODO remove, just for test
> +     LOG_NO("get_cstype: csi = '%s'", csi_name->value);
> +
> +     if ((error = immutil_saImmOmAccessorGet_2(accessorHandle, csi_name,
> +                     attributeNames, (SaImmAttrValuesT_2 ***)&attributes)) 
> != SA_AIS_OK) {
> +             LOG_ER("saImmOmAccessorGet FAILED %u for %s", error, 
> csi_name->value);
> +             osafassert(0);
> +     }
> +
> +     if (immutil_getAttr("saAmfCSType", attributes, 0, cstype) != SA_AIS_OK)
> +             osafassert(0);
> +}
> +
> +static SaAmfCompCapabilityModelT get_comp_capability(const SaNameT 
> *comp_type,
> +             const SaNameT *csi_name)
> +{
> +     SaAisErrorT error;
> +     SaNameT dn;
> +     SaImmAccessorHandleT accessorHandle = 0;
> +     const SaImmAttrValuesT_2 **attributes;
> +     SaAmfCompCapabilityModelT comp_cap;
> +     SaImmAttrNameT attributeNames[2] = {"saAmfCtCompCapability", NULL};
> +     SaImmHandleT immOmHandle = 0;
> +     SaVersionT immVersion = { 'A', 2, 1 };
> +     SaNameT cs_type;
> +
> +     // TODO remove, just for test
> +     LOG_NO("get_comp_capability: comptype = '%s' : csi = '%s'", 
> comp_type->value, csi_name->value);
> +
> +     TRACE_ENTER2("comptype = '%s' : csi = '%s'", comp_type->value, 
> csi_name->value);
> +
> +     immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion);
> +     immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle);
> +
> +     get_cstype(immOmHandle, accessorHandle, csi_name, &cs_type);
> +     avsv_create_association_class_dn(&cs_type, comp_type, 
> "safSupportedCsType", &dn);
> +
> +     if ((error = immutil_saImmOmAccessorGet_2(accessorHandle, &dn, 
> attributeNames,
> +                     (SaImmAttrValuesT_2 ***)&attributes)) != SA_AIS_OK) {
> +             LOG_ER("saImmOmAccessorGet FAILED %u for'%s'", error, dn.value);
> +             goto done;
> +     }
> +
> +     if (immutil_getAttr("saAmfCtCompCapability", attributes, 0, &comp_cap) 
> != SA_AIS_OK)
> +             osafassert(0);
> +
> +done:
> +     immutil_saImmOmAccessorFinalize(accessorHandle);
> +     immutil_saImmOmFinalize(immOmHandle);
> +
> +     TRACE_LEAVE2("%u", comp_cap);
> +     return comp_cap;
> +}
> +
>   
> /****************************************************************************
>     Name          : avnd_su_si_csi_rec_add
>    
> @@ -315,30 +377,12 @@ AVND_COMP_CSI_REC *avnd_su_si_csi_rec_ad
>       memcpy(&csi_rec->name, &param->csi_name, sizeof(SaNameT));
>       csi_rec->rank = param->csi_rank;
>   
> -     {
> -             /* Fill the cs type param from imm db, it will be used in 
> finding comp capability */
> -             SaAisErrorT error;
> -             SaImmAccessorHandleT accessorHandle;
> -             const SaImmAttrValuesT_2 **attributes;
> -             SaImmAttrNameT attributeNames[2] = {"saAmfCSType", NULL};
> -             SaImmHandleT immOmHandle;
> -             SaVersionT immVersion = { 'A', 2, 1 };
> -
> -             immutil_saImmOmInitialize(&immOmHandle, NULL, &immVersion);
> -             immutil_saImmOmAccessorInitialize(immOmHandle, &accessorHandle);
> -
> -             if ((error = immutil_saImmOmAccessorGet_2(accessorHandle, 
> &param->csi_name, attributeNames,
> -                                             (SaImmAttrValuesT_2 
> ***)&attributes)) != SA_AIS_OK) {
> -                     LOG_ER("saImmOmAccessorGet FAILED %u for %s", error, 
> param->csi_name.value);
> -                     osafassert(0);
> -             }
> -
> -             if (immutil_getAttr("saAmfCSType", attributes, 0, 
> &csi_rec->saAmfCSType) != SA_AIS_OK)
> -                     osafassert(0);
> -
> -             immutil_saImmOmAccessorFinalize(accessorHandle);
> -             immutil_saImmOmFinalize(immOmHandle);
> -     }
> +     /* If CSI capability is not valid, read it from IMM */
> +     if (param->capability == ~0)
> +             csi_rec->capability =
> +                     get_comp_capability(&comp->saAmfCompType, 
> &csi_rec->name);
> +     else
> +             csi_rec->capability = param->capability;
>   
>       /* update the assignment related parameters */
>       memcpy(&csi_rec->act_comp_name, &param->active_comp_name, 
> sizeof(SaNameT));
> 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
> @@ -306,10 +306,20 @@ uint32_t avnd_evt_avd_info_su_si_assign_
>       cb->rcv_msg_id = info->msg_id;
>   
>       if (info->msg_act == AVSV_SUSI_ACT_ASGN) {
> -             /* SI rank was introduced in version 5 of the amfnd protocol, 
> if the
> -              * message version is older then that, read SI rank from IMM */
> -             if (evt->msg_fmt_ver < 5)
> +             /* SI rank and CSI capability (originally from SaAmfCtCsType) 
> was
> +              * introduced in version 5 of the amfnd protocol. If the
> +              * message version is older, take action. */
> +             if (evt->msg_fmt_ver < 5) {
> +                     AVSV_SUSI_ASGN *csi;
> +
> +                     /* indicate that capability is invalid for later use 
> when
> +                      * creating CSI_REC */
> +                     for (csi = info->list; csi != NULL; csi = csi->next) {
> +                             csi->capability = ~0;
> +                     }
> +
>                       info->si_rank = get_sirank(&info->si_name);
> +             }
>       } else {
>               if (info->si_name.length > 0) {
>                       if (avnd_su_si_rec_get(cb, &info->su_name, 
> &info->si_name) == NULL)
> diff --git a/osaf/services/saf/avsv/avnd/include/avnd_comp.h 
> b/osaf/services/saf/avsv/avnd/include/avnd_comp.h
> --- a/osaf/services/saf/avsv/avnd/include/avnd_comp.h
> +++ b/osaf/services/saf/avsv/avnd/include/avnd_comp.h
> @@ -164,7 +164,7 @@ typedef struct avnd_comp_csi_rec {
>       NCS_DB_LINK_LIST_NODE si_dll_node;      /* node in the si dll */
>       NCS_DB_LINK_LIST_NODE comp_dll_node;    /* node in the comp-csi dll */
>       SaNameT name;   /* csi name */
> -     SaNameT saAmfCSType; /* cs type name */
> +     SaAmfCompCapabilityModelT capability; /* capability for this CSI */
>       uint32_t rank;          /* csi rank */
>   
>       /* state info */
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 07 Apr 2014 07:35:02 +0200
> From: Hans Feldt <osafde...@gmail.com>
> Subject: [devel] [PATCH 3 of 3] avsv: include su_failover in REG_SU
>       msg     [#574]
> To: praveen.malv...@oracle.com, nagendr...@oracle.com,
>       hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Message-ID: <d1a8ee59493a2893e172.1396848902@localhost6.localdomain6>
> Content-Type: text/plain; charset="us-ascii"
>
>   osaf/libs/common/avsv/avsv_d2nedu.c         |  8 +++++++-
>   osaf/libs/common/avsv/include/avsv_d2nmsg.h |  1 +
>   osaf/services/saf/avsv/avd/avd_util.c       |  1 +
>   3 files changed, 9 insertions(+), 1 deletions(-)
>
>
> AMF in 4.3 does not have support for SU-Failover, it was added in 4.4. So in
> 4.4 the AMF node director reads su_failover from IMM when processing the 
> REG_SU
> message.
>
> While anyway changing the messaging version in 4.3 for other reasons (SI rank)
> we add su_failover and can thereby leverage from that in the 4.4 branch.
>
> diff --git a/osaf/libs/common/avsv/avsv_d2nedu.c 
> b/osaf/libs/common/avsv/avsv_d2nedu.c
> --- a/osaf/libs/common/avsv/avsv_d2nedu.c
> +++ b/osaf/libs/common/avsv/avsv_d2nedu.c
> @@ -575,6 +575,7 @@ uint32_t avsv_edp_su_info_msg(EDU_HDL *h
>       uint32_t rc = NCSCC_RC_SUCCESS;
>       AVSV_SU_INFO_MSG *struct_ptr = NULL, **d_ptr = NULL;
>       uint16_t ver2 = AVSV_AVD_AVND_MSG_FMT_VER_2;
> +     uint16_t ver5 = AVSV_AVD_AVND_MSG_FMT_VER_5;
>   
>       EDU_INST_SET avsv_su_info_msg_rules[] = {
>               {EDU_START, avsv_edp_su_info_msg, EDQ_LNKLIST, 0, 0,
> @@ -595,11 +596,16 @@ uint32_t avsv_edp_su_info_msg(EDU_HDL *h
>               {EDU_EXEC, ncs_edp_ncs_bool, 0, 0, 0,
>                (long)&((AVSV_SU_INFO_MSG *)0)->is_ncs, 0, NULL},
>   
> +             /* Include su_is_external in version 2 and higher */
>               {EDU_VER_GE, NULL, 0, 0, 2, 0, 0, (EDU_EXEC_RTINE)((uint16_t 
> *)(&(ver2)))},
> -
>               {EDU_EXEC, ncs_edp_ncs_bool, 0, 0, 0,
>                (long)&((AVSV_SU_INFO_MSG *)0)->su_is_external, 0, NULL},
>   
> +             /* Include su_failover in version 5 and higher */
> +             {EDU_VER_GE, NULL, 0, 0, 2, 0, 0, (EDU_EXEC_RTINE)((uint16_t 
> *)(&(ver5)))},
> +             {EDU_EXEC, ncs_edp_ncs_bool, 0, 0, 0,
> +              (long)&((AVSV_SU_INFO_MSG *)0)->su_failover, 0, NULL},
> +
>               {EDU_TEST_LL_PTR, avsv_edp_su_info_msg, 0, 0, 0,
>                (long)&((AVSV_SU_INFO_MSG *)0)->next, 0, NULL},
>               {EDU_END, 0, 0, 0, 0, 0, 0, NULL},
> diff --git a/osaf/libs/common/avsv/include/avsv_d2nmsg.h 
> b/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> --- a/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> +++ b/osaf/libs/common/avsv/include/avsv_d2nmsg.h
> @@ -113,6 +113,7 @@ typedef struct avsv_su_info_msg {
>       uint32_t su_restart_max;
>       bool is_ncs;
>       bool su_is_external;    /*indicates if this SU is external */
> +     bool su_failover;
>       struct avsv_su_info_msg *next;
>   } AVSV_SU_INFO_MSG;
>   
> diff --git a/osaf/services/saf/avsv/avd/avd_util.c 
> b/osaf/services/saf/avsv/avd/avd_util.c
> --- a/osaf/services/saf/avsv/avd/avd_util.c
> +++ b/osaf/services/saf/avsv/avd/avd_util.c
> @@ -509,6 +509,7 @@ static uint32_t avd_prep_su_info(AVD_CL_
>       su_info->su_restart_prob = su->sg_of_su->saAmfSGSuRestartProb;
>       su_info->is_ncs = su->sg_of_su->sg_ncs_spec;
>       su_info->su_is_external = su->su_is_external;
> +     su_info->su_failover = su->saAmfSUFailover;
>   
>       su_info->next = su_msg->msg_info.d2n_reg_su.su_list;
>       su_msg->msg_info.d2n_reg_su.su_list = su_info;
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 07 Apr 2014 16:40:13 +1000
> From: Minh Hon Chau <minh.c...@dektech.com.au>
> Subject: [devel] [PATCH 1 of 1]
> To: nagendr...@oracle.com, hans.nordeb...@ericsson.com,
>       hans.fe...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Message-ID: <a7a95eba4d7d581e8b0a.1396852813@minh-ubuntu12>
> Content-Type: text/plain; charset="us-ascii"
>
>   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
>
>
>
> ------------------------------
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees_APR
>
> ------------------------------
>
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>
>
> End of Opensaf-devel Digest, Vol 11, Issue 27
> *********************************************
>


------------------------------------------------------------------------------
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to