Ack -Nagu
-----Original Message----- From: Nagendra Kumar Sent: 31 May 2013 17:16 To: Hans Feldt; Praveen Malviya Cc: [email protected] Subject: Re: [devel] [PATCH 1 of 1] amfnd: fix admin comp restart to terminate [#7] Few early comment: 1. Please change the name of comp_restart like comp_admin _restart, etc. One variable with same name exists in comp. 2. Please add function header and description to it. 3. While space exist before "done." We are testing as of now, we will get back to you. Thanks -Nagu -----Original Message----- From: Hans Feldt [mailto:[email protected]] Sent: 17 May 2013 21:03 To: Praveen Malviya Cc: [email protected] Subject: [devel] [PATCH 1 of 1] amfnd: fix admin comp restart to terminate [#7] osaf/services/saf/avsv/avnd/avnd_comp.c | 46 ++++++++++++++++++++++++- osaf/services/saf/avsv/avnd/avnd_err.c | 35 +----------------- osaf/services/saf/avsv/avnd/include/avnd_comp.h | 1 + osaf/services/saf/avsv/avnd/include/avnd_err.h | 1 - 4 files changed, 49 insertions(+), 34 deletions(-) Since a common routine was used for both error handling and admin comp restart, cleanup was done also in the admin case. This was because the comp got marked "FAILED" also in the admin restart case. A new function comp_restart() is added. This function does not set the FAILED state on a component. Instead the error handling logic does it before calling the new function. Admin comp restart calls the function directly. 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 @@ -2612,6 +2612,50 @@ void avnd_comp_cmplete_all_csi_rec(AVND_ TRACE_LEAVE(); } +uint32_t comp_restart(AVND_COMP *comp) +{ + AVND_CB *cb = avnd_cb; + uint32_t rc; + + TRACE_ENTER2("%s", comp->name.value); + + rc = avnd_comp_curr_info_del(cb, comp); + if (NCSCC_RC_SUCCESS != rc) + goto done; + + rc = avnd_comp_clc_fsm_run(cb, comp, AVND_COMP_CLC_PRES_FSM_EV_RESTART); + if (NCSCC_RC_SUCCESS != rc) + goto done; + + /* for npi comp mark the CSI restarting/assigning */ + if (!m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(comp)) { + AVND_COMP_CSI_REC *csi = + m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&comp->csi_list)); + if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNED(csi) || + m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_RESTARTING(csi)) { + m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, + AVND_COMP_CSI_ASSIGN_STATE_RESTARTING); + m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, csi, + AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE); + } else if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_UNASSIGNED(csi)) { + /* we need not change the csi state. let it be in unassigned state. + * The instantiation success will not trigger any csi assignment done. + * If this component is assigned afterwards before completing restart, + * the csi will move to assinging. + */ + } else { + m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, + AVND_COMP_CSI_ASSIGN_STATE_ASSIGNING); + m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, csi, + AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE); + } + } + + done: + TRACE_LEAVE2("%u", rc); + return rc; +} + /** * Process component admin operation request from director * @@ -2638,7 +2682,7 @@ uint32_t avnd_evt_comp_admin_op_req(AVND /* Now trigger the component admin restart */ comp->admin_oper = SA_TRUE; LOG_NO("Admin restart requested for '%s'", info->dn.value); - rc = avnd_err_rcvr_comp_restart(cb, comp); + rc = comp_restart(comp); } else { LOG_NO("Admin restart failed '%s' Presence state '%d'", info->dn.value, comp->pres); diff --git a/osaf/services/saf/avsv/avnd/avnd_err.c b/osaf/services/saf/avsv/avnd/avnd_err.c --- a/osaf/services/saf/avsv/avnd/avnd_err.c +++ b/osaf/services/saf/avsv/avnd/avnd_err.c @@ -63,7 +63,7 @@ static uint32_t avnd_err_escalate(AVND_C static uint32_t avnd_err_recover(AVND_CB *, AVND_SU *, AVND_COMP *, AVSV_ERR_RCVR); -uint32_t avnd_err_rcvr_comp_restart(AVND_CB *, AVND_COMP *); +static uint32_t avnd_err_rcvr_comp_restart(AVND_CB *, AVND_COMP *); static uint32_t avnd_err_rcvr_su_restart(AVND_CB *, AVND_SU *, AVND_COMP *); static uint32_t avnd_err_rcvr_comp_failover(AVND_CB *, AVND_COMP *); static uint32_t avnd_err_rcvr_su_failover(AVND_CB *, AVND_SU *, AVND_COMP *); @@ -567,9 +567,8 @@ uint32_t avnd_err_recover(AVND_CB *cb, A Notes : None. ******************************************************************************/ -uint32_t avnd_err_rcvr_comp_restart(AVND_CB *cb, AVND_COMP *comp) +static uint32_t avnd_err_rcvr_comp_restart(AVND_CB *cb, AVND_COMP +*comp) { - AVND_COMP_CSI_REC *csi = 0; uint32_t rc = NCSCC_RC_SUCCESS; TRACE_ENTER(); @@ -577,36 +576,8 @@ uint32_t avnd_err_rcvr_comp_restart(AVND m_AVND_COMP_FAILED_SET(comp); m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, comp, AVND_CKPT_COMP_FLAG_CHANGE); - /* delete the comp current info */ - rc = avnd_comp_curr_info_del(cb, comp); - if (NCSCC_RC_SUCCESS != rc) - goto done; + rc = comp_restart(comp); - /* trigger comp-fsm with restart event */ - rc = avnd_comp_clc_fsm_run(cb, comp, AVND_COMP_CLC_PRES_FSM_EV_RESTART); - if (NCSCC_RC_SUCCESS != rc) - goto done; - - /* mark the csi assigning for npi comp */ - if (!m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(comp)) { - csi = m_AVND_CSI_REC_FROM_COMP_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&comp->csi_list)); - if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_ASSIGNED(csi) - || m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_RESTARTING(csi)) { - m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, AVND_COMP_CSI_ASSIGN_STATE_RESTARTING); - m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, csi, AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE); - } else if (m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_UNASSIGNED(csi)) { - /* we need not change the csi state. let it be in unassigned state. - * The instantiation success will not trigger any csi assignment done. - * If this component is assigned afterwards before completing restart, - * the csi will move to assinging. - */ - } else { - m_AVND_COMP_CSI_CURR_ASSIGN_STATE_SET(csi, AVND_COMP_CSI_ASSIGN_STATE_ASSIGNING); - m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, csi, AVND_CKPT_COMP_CSI_CURR_ASSIGN_STATE); - } - } - - done: TRACE_LEAVE2("%u", rc); return rc; } 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 @@ -887,5 +887,6 @@ extern unsigned int avnd_comp_config_get extern int avnd_comp_config_reinit(AVND_COMP *comp); extern void avnd_comp_delete(AVND_COMP *comp); extern void avnd_comp_pres_state_set(AVND_COMP *comp, SaAmfPresenceStateT newstate); +extern uint32_t comp_restart(AVND_COMP *comp); #endif /* !AVND_COMP_H */ diff --git a/osaf/services/saf/avsv/avnd/include/avnd_err.h b/osaf/services/saf/avsv/avnd/include/avnd_err.h --- a/osaf/services/saf/avsv/avnd/include/avnd_err.h +++ b/osaf/services/saf/avsv/avnd/include/avnd_err.h @@ -115,6 +115,5 @@ struct avnd_su_tag; extern uint32_t avnd_err_process(struct avnd_cb_tag *, struct avnd_comp_tag *, AVND_ERR_INFO *); extern uint32_t avnd_err_su_repair(struct avnd_cb_tag *, struct avnd_su_tag *); -extern uint32_t avnd_err_rcvr_comp_restart(struct avnd_cb_tag *cb, struct avnd_comp_tag *comp); #endif /* !AVND_ERR_H */ ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Opensaf-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensaf-devel
