Commit message:
- short description: verb missing as first word, probably add?
- long description: completely missing, please add purpose of this change

General:
- too long lines, please stick with the 80 char rule
- mixed white space type (space/tabs)

See inline

Please send a new patch

Thanks,
Hans

On 21 January 2014 09:58,  <[email protected]> wrote:
>  osaf/services/saf/amf/amfd/comp.cc              |  20 ++++++++++++++++++
>  osaf/services/saf/amf/amfd/ndproc.cc            |   5 +++-
>  osaf/services/saf/amf/amfnd/clc.cc              |   6 +++++
>  osaf/services/saf/amf/amfnd/compdb.cc           |  27 
> +++++++++++++++++++++++-
>  osaf/services/saf/amf/amfnd/include/avnd_comp.h |   1 +
>  osaf/services/saf/amf/amfnd/su.cc               |  16 ++++++++++++-
>  6 files changed, 70 insertions(+), 5 deletions(-)
>
>
> diff --git a/osaf/services/saf/amf/amfd/comp.cc 
> b/osaf/services/saf/amf/amfd/comp.cc
> --- a/osaf/services/saf/amf/amfd/comp.cc
> +++ b/osaf/services/saf/amf/amfd/comp.cc
> @@ -173,6 +173,7 @@ void avd_comp_delete(AVD_COMP *comp)
>  static void comp_add_to_model(AVD_COMP *comp)
>  {
>         SaNameT dn;
> +       AVD_AVND *node;

move definition down and initialise directly
add su ptr at top and initialize in definition, use below instead of comp->su

>
>         TRACE_ENTER2("%s", comp->comp_info.name.value);
>
> @@ -222,6 +223,25 @@ static void comp_add_to_model(AVD_COMP *
>                 comp->su->saAmfSUPreInstantiable = static_cast<SaBoolT>(true);
>         }
>
> +       /* This is a case of adding a component in SU which is instantiated 
> state. This could be used
> +          in upgrade scenarios. When components are added, it is sent to 
> Amfnd for instantiation and
> +          Amfnd instantiates it. Amfnd has capability for finding which 
> component has been added newly. */
> +       if ((comp->su->saAmfSUAdminState != 
> SA_AMF_ADMIN_LOCKED_INSTANTIATION) &&
> +                       (comp->su->saAmfSUPresenceState == 
> SA_AMF_PRESENCE_INSTANTIATED) &&
> +                       (avd_cb->avail_state_avd == SA_AMF_HA_ACTIVE)) {
> +               node = comp->su->su_on_node;

define node here

the below change uses space and not tabs (which is still the current
indentation char)

> +                if ((node->node_state == AVD_AVND_STATE_PRESENT) ||
> +                    (node->node_state == AVD_AVND_STATE_NO_CONFIG) ||
> +                    (node->node_state == AVD_AVND_STATE_NCS_INIT)) {
> +
> +                        if (avd_snd_su_msg(avd_cb, comp->su) != 
> NCSCC_RC_SUCCESS) {
> +                                LOG_ER("%s: avd_snd_su_msg failed %s", 
> __FUNCTION__, comp->su->name.value);
> +                                goto done;
> +                        }
> +
> +                }
> +        }
> +
>         /* Set runtime cached attributes. */
>         avd_saImmOiRtObjectUpdate(&comp->su->name, 
> const_cast<SaImmAttrNameT>("saAmfSUPreInstantiable"),
>                 SA_IMM_ATTR_SAUINT32T, &comp->su->saAmfSUPreInstantiable);
> diff --git a/osaf/services/saf/amf/amfd/ndproc.cc 
> b/osaf/services/saf/amf/amfd/ndproc.cc
> --- a/osaf/services/saf/amf/amfd/ndproc.cc
> +++ b/osaf/services/saf/amf/amfd/ndproc.cc
> @@ -608,7 +608,10 @@ void avd_data_update_req_evh(AVD_CL_CB *
>         case AVSV_SA_AMF_COMP:{
>                         /* Find the component record in the database, 
> specified in the message. */
>                         if ((comp = 
> avd_comp_get(&n2d_msg->msg_info.n2d_data_req.param_info.name)) == NULL) {
> -                               LOG_ER("%s: Invalid Comp '%s' (%u)", 
> __FUNCTION__,
> +                               /* In case of component delete, component 
> gets deleted at Amfd first and then
> +                                  it gets uninstantiated and then deleted at 
> Amfnd. So, when update for presence
> +                                  state comes from Amfnd, the component 
> doesn't exists in Amfd. */
> +                               LOG_IN("%s: Invalid Comp '%s' (%u)", 
> __FUNCTION__,
>                                         
> n2d_msg->msg_info.n2d_data_req.param_info.name.value,
>                                         
> n2d_msg->msg_info.n2d_data_req.param_info.name.length);

remove logging of length above

>                                 goto done;
> diff --git a/osaf/services/saf/amf/amfnd/clc.cc 
> b/osaf/services/saf/amf/amfnd/clc.cc
> --- a/osaf/services/saf/amf/amfnd/clc.cc
> +++ b/osaf/services/saf/amf/amfnd/clc.cc
> @@ -1305,6 +1305,12 @@ uint32_t avnd_comp_clc_st_chng_prc(AVND_
>                                 goto done;
>                 }
>         }

add blank line

> +       /* This is a case of 'component delete' when su is in intantiated 
> state. Component can go into uninstantiated

very long lines

> +          state or termination failed state, but the component information 
> needs to be deleted from data base. */
> +       if (comp && (comp->pending_delete == true) && ((comp->pres == 
> SA_AMF_PRESENCE_UNINSTANTIATED) ||

no need to check comp it has already been dereferenced

> +                               (comp->pres == 
> SA_AMF_PRESENCE_TERMINATION_FAILED)) &&
> +                       (comp->su->pres == SA_AMF_PRESENCE_INSTANTIATED))
> +               rc = avnd_compdb_rec_del(cb, &comp->name);
>
>   done:
>         TRACE_LEAVE2("%u", rc);
> diff --git a/osaf/services/saf/amf/amfnd/compdb.cc 
> b/osaf/services/saf/amf/amfnd/compdb.cc
> --- a/osaf/services/saf/amf/amfnd/compdb.cc
> +++ b/osaf/services/saf/amf/amfnd/compdb.cc
> @@ -837,15 +837,38 @@ uint32_t avnd_comp_oper_req(AVND_CB *cb,
>
>         case AVSV_OBJ_OPR_DEL:
>                 {
> +                       /* This request can come when any component is being 
> deleted. When this request comes from Amfd,

"can come", why should the message otherwise come? Change to "comes"
too long lines

> +                          component can be in instantiated or uninstantiated 
> state and in that case, Amfnd will
> +                          uninstantiate the component and delete the record 
> from its data base. This is kind of
> +                          automatic termination of a component when comp is 
> getting deleted. */
>                         AVND_COMP *comp = 0;
>
>                         /* get the record */
>                         comp = m_AVND_COMPDB_REC_GET(cb->compdb, param->name);

merge assignment with initialization

> -                       if (comp) {
> -                               /* delete the record */
> +                       if (comp && (comp->pres == 
> SA_AMF_PRESENCE_UNINSTANTIATED) &&

check the comp pointer for non NULL once and log an error message and
get out, do not check comp ptr several times as below

white space issues below

> +                                       (comp->su->pres == 
> SA_AMF_PRESENCE_UNINSTANTIATED)) {
> +                               /* delete the record in case su is in 
> locked-in. */
>                                 m_AVND_SEND_CKPT_UPDT_ASYNC_RMV(cb, comp, 
> AVND_CKPT_COMP_CONFIG);
>                                 rc = avnd_compdb_rec_del(cb, &param->name);
> +                               goto done;
>                         }
> +
> +                       /* Terminate the pi comp. It will terminate the 
> component and delete the comp record. */
> +                        if (comp && 
> m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(comp)) {
> +                               comp->pending_delete = true;
> +                                TRACE("Running the component clc FSM, 
> terminate the component");

remove trace, there is one inside avnd_comp_clc_fsm_run

> +                               rc = avnd_comp_clc_fsm_run(cb, comp, 
> AVND_COMP_CLC_PRES_FSM_EV_TERM);
> +                               goto done;
> +                        }
> +                       /* Terminate the Npi comp. After deleting the csi, 
> comp will be already terminated, so
> +                          we just want to delete the comp record.. */
> +                        if (comp && 
> !m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(comp)) {
> +                                /* delete the record */

remove comment

> +                                m_AVND_SEND_CKPT_UPDT_ASYNC_RMV(cb, comp, 
> AVND_CKPT_COMP_CONFIG);
> +                               rc = avnd_compdb_rec_del(cb, &param->name);
> +                               goto done;
> +                        }
> +
>                 }
>                 break;
>
> diff --git a/osaf/services/saf/amf/amfnd/include/avnd_comp.h 
> b/osaf/services/saf/amf/amfnd/include/avnd_comp.h
> --- a/osaf/services/saf/amf/amfnd/include/avnd_comp.h
> +++ b/osaf/services/saf/amf/amfnd/include/avnd_comp.h
> @@ -359,6 +359,7 @@ typedef struct avnd_comp_tag {
>         SaBoolT admin_oper;   /*set to true if undergoing admin operation */
>         int config_is_valid; /* Used to indicate that config has to be 
> refreshed from IMM */
>         bool assigned_flag; /* Used in finding multiple csi for a single comp 
> while csi mod.*/
> +       bool pending_delete; /* Used in deleting component when su is in 
> instantiated state.*/
>
>  } AVND_COMP;
>
> diff --git a/osaf/services/saf/amf/amfnd/su.cc 
> b/osaf/services/saf/amf/amfnd/su.cc
> --- a/osaf/services/saf/amf/amfnd/su.cc
> +++ b/osaf/services/saf/amf/amfnd/su.cc
> @@ -56,6 +56,7 @@ uint32_t avnd_evt_avd_reg_su_evh(AVND_CB
>         AVSV_SU_INFO_MSG *su_info = 0;
>         AVND_SU *su = 0;
>         uint32_t rc = NCSCC_RC_SUCCESS;
> +       bool is;
>
>         TRACE_ENTER();
>
> @@ -79,9 +80,9 @@ uint32_t avnd_evt_avd_reg_su_evh(AVND_CB
>
>         /* scan the su list & add each su to su-db */
>         for (su_info = info->su_list; su_info; su = 0, su_info = 
> su_info->next) {
> -               su = avnd_sudb_rec_add(cb, su_info, &rc);
> +               su = m_AVND_SUDB_REC_GET(cb->sudb, su_info->name);
>                 if (!su)

check for su == NULL
comment why this new check is needed (probably because a single comp
is added and the SU already exist?)

> -                       break;
> +                       su = avnd_sudb_rec_add(cb, su_info, &rc);
>
>                 m_AVND_SEND_CKPT_UPDT_ASYNC_ADD(cb, su, AVND_CKPT_SU_CONFIG);
>
> @@ -93,11 +94,22 @@ uint32_t avnd_evt_avd_reg_su_evh(AVND_CB
>                         rc = NCSCC_RC_FAILURE;
>                         break;
>                 }
> +
> +               /* When NPI comp is added into PI SU, we don't have to run SU 
> FSM as anyway, we are not
> +                  instantiating NPI component. In this case, anyway, SU will 
> remain in instantiated state.
> +                  NPI comp will get instantiated when corresponding csi is 
> added. */

add to this comment that now a new comp might have been added that is
UNINSTANTIATED

move definition of "is" here are name it better like

> +               m_AVND_SU_IS_INSTANTIATED(su, is);
> +
> +               if ((su->pres == SA_AMF_PRESENCE_INSTANTIATED) && (false == 
> is)) {

false == is, please swap the expresssion, is == false

> +                       avnd_su_pres_state_set(su, 
> SA_AMF_PRESENCE_UNINSTANTIATED);
> +                       rc = avnd_su_pres_fsm_run(cb, su, 0, 
> AVND_SU_PRES_FSM_EV_INST);
> +               }
>         }
>
>         /*** send the response to AvD ***/
>         rc = avnd_di_reg_su_rsp_snd(cb, &info->su_list->name, rc);
>
> +
>  done:
>         TRACE_LEAVE();
>         return rc;
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Opensaf-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to