osaf/services/saf/amf/amfnd/susm.cc | 123 ++++++++++++++++++++++++-----------
1 files changed, 85 insertions(+), 38 deletions(-)
If a SU has only one component and component enters into restarting state due to
component restart recovery, RESTARTING state of SU is not observed.
In the mentioned case, SU remain in INSTANTIATED state while its only
component is restarting. Thus a user application will not get state
change notification for SU. At present only in surestart escalation
a SU is marked RESTARTING.
Patch marks presence state of SU RESTARTING when its single component is
in RESTARTING state during component restart recovery.
diff --git a/osaf/services/saf/amf/amfnd/susm.cc
b/osaf/services/saf/amf/amfnd/susm.cc
--- a/osaf/services/saf/amf/amfnd/susm.cc
+++ b/osaf/services/saf/amf/amfnd/susm.cc
@@ -1459,6 +1459,62 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *c
return rc;
}
+
+
+/**
+ * @brief Reset flags when a NPI SU moves from RESTARTING to INSTANTIATED
state.
+ * @param su
+ * @return NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
+ */
+
+static uint32_t npi_su_restarting_to_instantiated(AVND_SU *su)
+{
+ uint32_t rc = NCSCC_RC_SUCCESS;
+
+ if (m_AVND_SU_IS_RESTART(su)) {
+ m_AVND_SU_FAILED_RESET(su);
+ m_AVND_SU_RESTART_RESET(su);
+ m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(avnd_cb, su,
AVND_CKPT_SU_FLAG_CHANGE);
+ }
+
+ return rc;
+}
+
+
+/**
+ * @brief Reset flags when a PI SU moves from RESTARTING to INSTANTIATED
state.
+ * @param su
+ * @return NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
+ */
+static uint32_t pi_su_restarting_to_instantiated(AVND_SU *su)
+{
+ uint32_t rc = NCSCC_RC_SUCCESS;
+
+ /* A SU can be restarted because all components faulted with component
+ restart recovery policy or because of surestart escalation. */
+ if (m_AVND_SU_IS_RESTART(su)) {
+ /* reset the su failed flag & set the oper state to enabled */
+ if (m_AVND_SU_IS_FAILED(su)) {
+ m_AVND_SU_FAILED_RESET(su);
+ m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(avnd_cb, su,
AVND_CKPT_SU_FLAG_CHANGE);
+ m_AVND_SU_OPER_STATE_SET(su,
SA_AMF_OPERATIONAL_ENABLED);
+ m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(avnd_cb, su,
AVND_CKPT_SU_OPER_STATE);
+ TRACE("Setting the Oper state to Enabled");
+ }
+
+ /*
+ * reassign all the sis...
+ * it's possible that the si was never assigned. send su-oper
+ * enable msg instead.
+ */
+ if (su->si_list.n_nodes)
+ rc = avnd_su_si_reassign(avnd_cb, su);
+ else
+ rc = avnd_di_oper_send(avnd_cb, su, 0);
+ }
+
+ return rc;
+}
/****************************************************************************
Name : avnd_su_pres_st_chng_prc
@@ -1479,7 +1535,8 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
AVND_SU_SI_REC *si = 0;
bool is_en;
uint32_t rc = NCSCC_RC_SUCCESS;
- TRACE_ENTER2("'%s'", su->name.value);
+
+ TRACE_ENTER2("'%s' %s => %s",su->name.value,
presence_state[prv_st],presence_state[final_st]);
/* pi su */
if (m_AVND_SU_IS_PREINSTANTIABLE(su)) {
@@ -1508,32 +1565,9 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
}
/* restarting -> instantiated */
- if ((SA_AMF_PRESENCE_RESTARTING == prv_st) &&
(SA_AMF_PRESENCE_INSTANTIATED == final_st)) {
- TRACE("SU Restarting -> Instantiated");
- /* reset the su failed flag & set the oper state to
enabled */
- if (m_AVND_SU_IS_FAILED(su)) {
- m_AVND_SU_FAILED_RESET(su);
- m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su,
AVND_CKPT_SU_FLAG_CHANGE);
- m_AVND_SU_OPER_STATE_SET(su,
SA_AMF_OPERATIONAL_ENABLED);
- m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su,
AVND_CKPT_SU_OPER_STATE);
- TRACE("Setting the Oper state to Enabled");
- }
-
- /*
- * reassign all the sis...
- * it's possible that the si was never assigned. send
su-oper
- * enable msg instead.
- */
- if (su->si_list.n_nodes) {
- TRACE("Reassigning the SIs");
- rc = avnd_su_si_reassign(cb, su);
- }
- else
- rc = avnd_di_oper_send(cb, su, 0);
- if (NCSCC_RC_SUCCESS != rc)
- goto done;
-
- }
+ if ((SA_AMF_PRESENCE_RESTARTING == prv_st) &&
(SA_AMF_PRESENCE_INSTANTIATED == final_st))
+ rc = pi_su_restarting_to_instantiated(su);
+
/* terminating -> instantiated */
if ((SA_AMF_PRESENCE_TERMINATING == prv_st) &&
(SA_AMF_PRESENCE_INSTANTIATED == final_st)) {
@@ -1682,14 +1716,8 @@ uint32_t avnd_su_pres_st_chng_prc(AVND_C
}
- /* restarting -> instantiated */
- if ((SA_AMF_PRESENCE_RESTARTING == prv_st) &&
(SA_AMF_PRESENCE_INSTANTIATED == final_st)) {
- TRACE("Restarting -> Instantiated");
- /* reset the failed & restart flag */
- m_AVND_SU_FAILED_RESET(su);
- m_AVND_SU_RESTART_RESET(su);
- m_AVND_SEND_CKPT_UPDT_ASYNC_UPDT(cb, su,
AVND_CKPT_SU_FLAG_CHANGE);
- }
+ if ((SA_AMF_PRESENCE_RESTARTING == prv_st) &&
(SA_AMF_PRESENCE_INSTANTIATED == final_st))
+ rc = npi_su_restarting_to_instantiated(su);
/* terminating -> uninstantiated */
if ((SA_AMF_PRESENCE_TERMINATING == prv_st) &&
(SA_AMF_PRESENCE_UNINSTANTIATED == final_st)) {
@@ -2230,6 +2258,19 @@ uint32_t avnd_su_pres_inst_surestart_hdl
return rc;
}
+static bool su_evaluate_restarting_state(AVND_SU *su)
+{
+ for (AVND_COMP *comp =
m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_FIRST(&su->comp_list));
+ comp;
+ comp =
m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT(&comp->su_dll_node))) {
+ if (comp->pres !=SA_AMF_PRESENCE_RESTARTING) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
/****************************************************************************
Name : avnd_su_pres_inst_comprestart_hdler
@@ -2248,8 +2289,12 @@ uint32_t avnd_su_pres_inst_comprestart_h
{ /* TBD */
uint32_t rc = NCSCC_RC_SUCCESS;
const char *compname = comp ? (char*)comp->name.value : "none";
- TRACE_1("Component restart event in the Instantiated state, returning
success:'%s' : '%s'",
+ TRACE_1("Component restart event in the Instantiated state, '%s' :
'%s'",
su->name.value, compname);
+
+ if (su_evaluate_restarting_state(su) == true)
+ avnd_su_pres_state_set(su, SA_AMF_PRESENCE_RESTARTING);
+
return rc;
}
@@ -2662,7 +2707,8 @@ uint32_t avnd_su_pres_restart_compinst_h
curr_comp =
m_AVND_COMP_FROM_SU_DLL_NODE_GET(m_NCS_DBLIST_FIND_NEXT(&curr_comp->su_dll_node)))
{
TRACE("PI SU:'%s'", su->name.value);
/* restart the pi comp */
- if (m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(curr_comp)) {
+ if (m_AVND_COMP_TYPE_IS_PREINSTANTIABLE(curr_comp) &&
+ (m_AVND_SU_IS_RESTART(su))) {
rc = avnd_comp_clc_fsm_run(cb, curr_comp,
AVND_COMP_CLC_PRES_FSM_EV_RESTART);
if (NCSCC_RC_SUCCESS != rc)
goto done;
@@ -2708,7 +2754,8 @@ uint32_t avnd_su_pres_restart_compinst_h
*/
if ((curr_csi != NULL) &&
(m_AVND_COMP_CSI_CURR_ASSIGN_STATE_IS_UNASSIGNED(curr_csi) == true) &&
- (curr_csi->comp->pres != SA_AMF_PRESENCE_RESTARTING)) {
+ (curr_csi->comp->pres != SA_AMF_PRESENCE_RESTARTING) &&
+ (m_AVND_SU_IS_RESTART(su))) {
/* we have another csi. trigger the comp fsm with
RestartEv */
rc = avnd_comp_clc_fsm_trigger(cb, curr_csi->comp,
AVND_COMP_CLC_PRES_FSM_EV_RESTART);
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel