New patch please, see inline.
Thanks,
Hans

On 25 April 2014 13:13,  <nagendr...@oracle.com> wrote:
>  osaf/services/saf/avsv/avd/avd_csi.c         |  46 
> ++++++++++++++++++++-------
>  osaf/services/saf/avsv/avd/avd_sgproc.c      |  17 ++++++++++
>  osaf/services/saf/avsv/avd/include/avd_csi.h |   1 +
>  3 files changed, 51 insertions(+), 13 deletions(-)
>
>
> Problem: Amf rejects csi addition if previous csi addition is in progress.
>
> Analysis: Amfd can allow csi addition in sequence but can delay applying
> subsequent csi addition.
>
> Fix: Next csi addition are delayed till the first csi addition procers if

s/are/is, till/until, first/previous, procers/process

> finished.
>
> diff --git a/osaf/services/saf/avsv/avd/avd_csi.c 
> b/osaf/services/saf/avsv/avd/avd_csi.c
> --- a/osaf/services/saf/avsv/avd/avd_csi.c
> +++ b/osaf/services/saf/avsv/avd/avd_csi.c
> @@ -441,12 +441,8 @@ static SaAisErrorT csi_ccb_completed_cre
>                         t_sisu = avd_si->list_of_sisu;
>                         while(t_sisu) {
>                                 if (t_sisu->csi_add_rem == true) {
> -                                       LOG_WA("CSI create of '%s' rejected: 
> pending assignment for '%s'",
> +                                       LOG_WA("CSI create of '%s' in queue: 
> pending assignment for '%s'",

Is this a log really? Definitively not WA, perhaps NO

>                                                         
> opdata->objectName.value, t_sisu->su->name.value);
> -                                       if (avd_cb->avail_state_avd == 
> SA_AMF_HA_ACTIVE) {
> -                                               rc = SA_AIS_ERR_BAD_OPERATION;
> -                                               goto done;
> -                                       }
>                                 }
>                                 t_sisu = t_sisu->si_next;
>                         }/*  while(t_sisu) */
> @@ -794,20 +790,20 @@ static void csi_ccb_apply_modify_hdlr(st
>  }
>
>  
> /*****************************************************************************
> - * Function: csi_ccb_apply_create_hdlr
> + * Function: csi_create_assign_hdlr
>   *
> - * Purpose: This routine handles create operations on SaAmfCSI objects.
> + * Purpose: This routine creates Csi if doesn't exist and then assign the 
> csi.
>   *
>   *
> - * Input  : Ccb Util Oper Data.
> + * Input  : Ccb Util Oper Data and Csi.
>   *
> - * Returns: None.
> + * Returns: OK or NO OP.
>   *
> - * NOTES  : None.
> + * NOTES  : If the opdata is NULL, csi should be passed as arguement.
>   *
>   *
>   **************************************************************************/
> -static void csi_ccb_apply_create_hdlr(struct CcbUtilOperationData *opdata)
> +SaAisErrorT csi_create_assign_hdlr(struct CcbUtilOperationData *opdata, 
> AVD_CSI *avd_csi)

Please don't do this, so far we have a design pattern that is easy to
understand.

Create a new function for the new use case you have. In case they have
99% code in common refactor that out into a new function.

>  {
>          AVD_CSI *csi = NULL;
>          AVD_COMP *t_comp;
> @@ -815,8 +811,15 @@ static void csi_ccb_apply_create_hdlr(st
>         SaBoolT first_sisu = true;
>         AVD_COMP_CSI_REL *compcsi;
>         AVD_COMPCS_TYPE *cst;
> +       SaAisErrorT rc = SA_AIS_ERR_NO_OP;
>
> -        TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, 
> opdata->objectName.value);
> +       if (opdata == NULL) {
> +               /* This csi should be assigned now.*/
> +               csi = avd_csi;
> +               osafassert(csi != NULL);
> +               goto csi_assign;
> +       }
> +       TRACE_ENTER2("CCB ID %llu, '%s'", opdata->ccbId, 
> opdata->objectName.value);
>
>
>         if ((csi = avd_csi_get (&opdata->objectName)) == NULL) {
> @@ -827,8 +830,23 @@ static void csi_ccb_apply_create_hdlr(st
>         }
>         csi_get_attr_and_add_to_model(csi, opdata->param.create.attrValues, 
> opdata->param.create.parentName);
>
> +csi_assign:
> +
>         if (avd_cb->avail_state_avd != SA_AMF_HA_ACTIVE)
>                 goto done;
> +       /* Check whether csi assignment is already in progress and if yes, 
> then return.
> +          This csi will be assigned after the undergoing csi assignment gets 
> over.*/
> +       if (NULL != csi->si->list_of_sisu) {

reverse the statement, we should have a coding style that disallow this

> +               t_sisu = csi->si->list_of_sisu;
> +               while(t_sisu) {

for loop please

> +                       if (t_sisu->csi_add_rem == true) {
> +                               LOG_WA("CSI create '%s' delayed: pending 
> assignment for '%s'",

NO not WA

> +                                               opdata->objectName.value, 
> t_sisu->su->name.value);
> +                               goto done;
> +                       }
> +                       t_sisu = t_sisu->si_next;
> +               }/*  while(t_sisu) */

please remove comments on closing braces

> +       }
>
>         /* Check whether si has been assigned to any SU. */
>         if (NULL != csi->si->list_of_sisu) {
> @@ -907,6 +925,7 @@ static void csi_ccb_apply_create_hdlr(st
>                                         avd_susi_delete(avd_cb, t_sisu, true);
>                                         goto done;
>                                 }
> +                               rc = SA_AIS_OK;
>
>                         }
>                         t_sisu->csi_add_rem = true;
> @@ -922,6 +941,7 @@ static void csi_ccb_apply_create_hdlr(st
>                 csi->si->sg_of_si->si_func(avd_cb, csi->si);
>         }
>  done:
> +       return rc;
>         TRACE_LEAVE();
>  }
>
> @@ -932,7 +952,7 @@ static void csi_ccb_apply_cb(CcbUtilOper
>
>         switch (opdata->operationType) {
>         case CCBUTIL_CREATE:
> -                csi_ccb_apply_create_hdlr(opdata);
> +               csi_create_assign_hdlr(opdata, NULL);
>                 break;
>          case CCBUTIL_MODIFY:
>                  csi_ccb_apply_modify_hdlr(opdata);
> diff --git a/osaf/services/saf/avsv/avd/avd_sgproc.c 
> b/osaf/services/saf/avsv/avd/avd_sgproc.c
> --- a/osaf/services/saf/avsv/avd/avd_sgproc.c
> +++ b/osaf/services/saf/avsv/avd/avd_sgproc.c
> @@ -533,6 +533,7 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb,
>         AVD_AVND *node;
>         AVD_SU *su, *temp_su;
>         AVD_SU_SI_REL *susi;
> +       SaAisErrorT rc = SA_AIS_ERR_NO_OP;
>         bool q_flag = false, qsc_flag = false, all_su_unassigned = true, 
> all_csi_rem = true;
>
>         TRACE_ENTER2("id:%u, node:%x, act:%u, '%s', '%s', ha:%u, err:%u, 
> single:%u",
> @@ -798,6 +799,22 @@ void avd_su_si_assign_evh(AVD_CL_CB *cb,
>                                         }
>                                         t_sisu = t_sisu->si_next;
>                                 }/* while(t_sisu) */
> +                               if (t_sisu == NULL) {
> +                                       /* Since csi assignment is over, 
> walkthrough other
> +                                          unassigned CSIs for assignment. */
> +                                       AVD_CSI *temp_csi;

why temp_csi and not just csi?

> +                                       for (temp_csi = 
> susi->si->list_of_csi; temp_csi; temp_csi =
> +                                                       
> temp_csi->si_list_of_csi_next) {
> +                                               if (temp_csi->list_compcsi == 
> NULL) {
> +                                                       rc = 
> csi_create_assign_hdlr(NULL, temp_csi);
> +                                                       /* Get going for this 
> csi and when the assignment

get going?

> +                                                          will be over for 
> this csi, then other
> +                                                          unassigned CSIs 
> will be taken. */
> +                                                       if (rc == SA_AIS_OK)
> +                                                               goto done;
> +                                               }
> +                                       }
> +                               }
>                                 /* Comsume this message. */
>                                 goto done;
>                         }
> diff --git a/osaf/services/saf/avsv/avd/include/avd_csi.h 
> b/osaf/services/saf/avsv/avd/include/avd_csi.h
> --- a/osaf/services/saf/avsv/avd/include/avd_csi.h
> +++ b/osaf/services/saf/avsv/avd/include/avd_csi.h
> @@ -160,5 +160,6 @@ extern void avd_csi_delete(struct avd_cs
>  extern void csi_cmplt_delete(struct avd_csi_tag *csi, SaBoolT ckpt);
>  extern AVD_CSI *csi_create(const SaNameT *csi_name);
>  extern bool csi_assignment_validate(struct avd_sg_tag *sg);
> +extern SaAisErrorT csi_create_assign_hdlr(struct CcbUtilOperationData 
> *opdata, AVD_CSI *csi);
>
>  #endif
>
> ------------------------------------------------------------------------------
> Start Your Social Network Today - Download eXo Platform
> Build your Enterprise Intranet with eXo Platform Software
> Java Based Open Source Intranet - Social, Extensible, Cloud Ready
> Get Started Now And Turn Your Intranet Into A Collaboration Platform
> http://p.sf.net/sfu/ExoPlatform
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to