osaf/services/saf/amf/amfd/comp.cc | 38 +++++++++++++++++++++++++-----
osaf/services/saf/amf/amfd/include/util.h | 1 +
osaf/services/saf/amf/amfd/sgproc.cc | 38 -------------------------------
osaf/services/saf/amf/amfd/util.cc | 20 ++++++++++++++++
4 files changed, 52 insertions(+), 45 deletions(-)
When a component enters the TERM-FAILED presence state and if all the repair
conditions on SG and node are true, a node reboot request is ordered. The comp
presence state is also SAFlogged.
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
@@ -74,23 +74,47 @@ AVD_COMP *avd_comp_new(const SaNameT *dn
return comp;
}
+/**
+ * Set the presence state of a component. Updates the IMM copy. If newstate is
+ * TERM-FAILED an alarm is sent and possibly a node reboot request is ordered.
+ *
+ * @param comp
+ * @param pres_state
+ */
void avd_comp_pres_state_set(AVD_COMP *comp, SaAmfPresenceStateT pres_state)
{
+ AVD_AVND *node = comp->su->su_on_node;
+ SaAmfPresenceStateT old_state = comp->saAmfCompPresenceState;
+
osafassert(pres_state <= SA_AMF_PRESENCE_TERMINATION_FAILED);
- TRACE_ENTER2("'%s' %s => %s",
- comp->comp_info.name.value,
avd_pres_state_name[comp->saAmfCompPresenceState],
+ TRACE_ENTER2("'%s' %s => %s", comp->comp_info.name.value,
+ avd_pres_state_name[comp->saAmfCompPresenceState],
avd_pres_state_name[pres_state]);
comp->saAmfCompPresenceState = pres_state;
avd_saImmOiRtObjectUpdate(&comp->comp_info.name,
-
const_cast<SaImmAttrNameT>("saAmfCompPresenceState"), SA_IMM_ATTR_SAUINT32T,
&comp->saAmfCompPresenceState);
+
const_cast<SaImmAttrNameT>("saAmfCompPresenceState"),
+ SA_IMM_ATTR_SAUINT32T,
&comp->saAmfCompPresenceState);
m_AVSV_SEND_CKPT_UPDT_ASYNC_UPDT(avd_cb, comp,
AVSV_CKPT_COMP_PRES_STATE);
- /* alarm & notifications */
if(comp->saAmfCompPresenceState == SA_AMF_PRESENCE_INSTANTIATION_FAILED)
- avd_send_comp_inst_failed_alarm(&comp->comp_info.name,
&comp->su->su_on_node->name);
- else if(comp->saAmfCompPresenceState ==
SA_AMF_PRESENCE_TERMINATION_FAILED)
- avd_send_comp_clean_failed_alarm(&comp->comp_info.name,
&comp->su->su_on_node->name);
+ avd_send_comp_inst_failed_alarm(&comp->comp_info.name,
&node->name);
+ else if (comp->saAmfCompPresenceState ==
SA_AMF_PRESENCE_TERMINATION_FAILED) {
+ avd_send_comp_clean_failed_alarm(&comp->comp_info.name,
&node->name);
+
+ saflog(LOG_NOTICE, amfSvcUsrName, "%s PresenceState %s => %s",
+ comp->comp_info.name.value,
avd_pres_state_name[old_state],
+ avd_pres_state_name[pres_state]);
+
+ if ((comp->su->sg_of_su->saAmfSGAutoRepair == true) &&
+ (node->saAmfNodeAutoRepair == true) &&
+ (node->saAmfNodeFailfastOnTerminationFailure ==
true)) {
+ saflog(LOG_NOTICE, amfSvcUsrName,
+ "Ordering reboot of '%s' as repair
action",
+ node->name.value);
+ avd_d2n_reboot_snd(node);
+ }
+ }
}
void avd_comp_oper_state_set(AVD_COMP *comp, SaAmfOperationalStateT oper_state)
diff --git a/osaf/services/saf/amf/amfd/include/util.h
b/osaf/services/saf/amf/amfd/include/util.h
--- a/osaf/services/saf/amf/amfd/include/util.h
+++ b/osaf/services/saf/amf/amfd/include/util.h
@@ -94,6 +94,7 @@ struct avd_comp_tag;
struct avd_comp_csi_rel_tag;
struct avd_csi_tag;
+void avd_d2n_reboot_snd(struct avd_avnd_tag *node);
void amflog(int priority, const char *format, ...);
void d2n_msg_free(AVD_DND_MSG *msg);
uint32_t avd_d2n_msg_dequeue(struct cl_cb_tag *cb);
diff --git a/osaf/services/saf/amf/amfd/sgproc.cc
b/osaf/services/saf/amf/amfd/sgproc.cc
--- a/osaf/services/saf/amf/amfd/sgproc.cc
+++ b/osaf/services/saf/amf/amfd/sgproc.cc
@@ -35,8 +35,6 @@
#include <clm.h>
#include <si_dep.h>
-static SaAisErrorT avd_d2n_reboot_snd(AVD_AVND *node);
-
/*****************************************************************************
* Function: avd_new_assgn_susi
*
@@ -2038,42 +2036,6 @@ done:
return rc;
}
-/****************************************************************************
- Name : avd_d2n_reboot_snd
-
- Description : This is a routine sends reboot command to amfnd.
-
- Arguments : node: Node director node to which this message
- will be sent.
-
- Return Values : OK/ERROR
-
- Notes : None.
-*****************************************************************************/
-static SaAisErrorT avd_d2n_reboot_snd(AVD_AVND *node)
-{
- SaAisErrorT rc = SA_AIS_OK;
-
- TRACE("Sending REBOOT MSG to %x", node->node_info.nodeId);
-
- /* Send reboot request to amfnd to reboot that node. */
- AVD_DND_MSG *d2n_msg;
-
- d2n_msg = new AVD_DND_MSG();
-
- d2n_msg->msg_type = AVSV_D2N_REBOOT_MSG;
- d2n_msg->msg_info.d2n_reboot_info.node_id = node->node_info.nodeId;
- d2n_msg->msg_info.d2n_reboot_info.msg_id = ++(node->snd_msg_id);
-
- /* Now send the message to the node director */
- if (avd_d2n_msg_snd(avd_cb, node, d2n_msg) != NCSCC_RC_SUCCESS) {
- LOG_ER("%s: snd to %x failed", __FUNCTION__,
node->node_info.nodeId);
- d2n_msg_free(d2n_msg);
- rc = SA_AIS_ERR_FAILED_OPERATION;
- }
-
- return rc;
-}
/**
* @brief This routine does the following functionality
* a. Checks the dependencies of the SI's to see whether
diff --git a/osaf/services/saf/amf/amfd/util.cc
b/osaf/services/saf/amf/amfd/util.cc
--- a/osaf/services/saf/amf/amfd/util.cc
+++ b/osaf/services/saf/amf/amfd/util.cc
@@ -1729,6 +1729,26 @@ void d2n_msg_free(AVSV_DND_MSG *msg)
}
/**
+ * Sends a reboot command to amfnd
+ * @param node
+ */
+void avd_d2n_reboot_snd(AVD_AVND *node)
+{
+ TRACE("Sending REBOOT MSG to %x", node->node_info.nodeId);
+
+ AVD_DND_MSG *d2n_msg = new AVD_DND_MSG();
+
+ d2n_msg->msg_type = AVSV_D2N_REBOOT_MSG;
+ d2n_msg->msg_info.d2n_reboot_info.node_id = node->node_info.nodeId;
+ d2n_msg->msg_info.d2n_reboot_info.msg_id = ++(node->snd_msg_id);
+
+ if (avd_d2n_msg_snd(avd_cb, node, d2n_msg) != NCSCC_RC_SUCCESS) {
+ LOG_ER("%s: snd to %x failed", __FUNCTION__,
node->node_info.nodeId);
+ d2n_msg_free(d2n_msg);
+ }
+}
+
+/**
* Logs to saflog if active
* @param priority
* @param format
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel