osaf/services/saf/amf/amfd/include/node.h | 2 +-
osaf/services/saf/amf/amfd/main.cc | 10 +-----
osaf/services/saf/amf/amfd/ndfsm.cc | 49 +++++++++++++++---------------
3 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/osaf/services/saf/amf/amfd/include/node.h
b/osaf/services/saf/amf/amfd/include/node.h
--- a/osaf/services/saf/amf/amfd/include/node.h
+++ b/osaf/services/saf/amf/amfd/include/node.h
@@ -62,7 +62,6 @@ typedef enum {
/* Fail-over Node List */
typedef struct avd_fail_over_node {
- NCS_PATRICIA_NODE tree_node_id_node;
SaClmNodeIdT node_id;
} AVD_FAIL_OVER_NODE;
@@ -147,6 +146,7 @@ struct NodeNameCompare: public std::bina
extern AmfDb<std::string, AVD_AVND> *node_name_db;
extern AmfDb<uint32_t, AVD_AVND> *node_id_db;
+extern AmfDb<uint32_t, AVD_FAIL_OVER_NODE> *node_list_db;
typedef struct avd_ng_tag {
diff --git a/osaf/services/saf/amf/amfd/main.cc
b/osaf/services/saf/amf/amfd/main.cc
--- a/osaf/services/saf/amf/amfd/main.cc
+++ b/osaf/services/saf/amf/amfd/main.cc
@@ -380,7 +380,8 @@ static void handle_event_in_failover_sta
m_AVD_EVT_QUEUE_ENQUEUE(cb, queue_evt);
}
- if (cb->node_list.n_nodes == 0) {
+ std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator it =
node_list_db->begin();
+ if (it == node_list_db->end()) {
AVD_EVT_QUEUE *queue_evt;
/* We have received the info from all the nodes. */
@@ -455,7 +456,6 @@ static void rda_cb(uint32_t notused, PCS
static uint32_t initialize(void)
{
AVD_CL_CB *cb = avd_cb;
- NCS_PATRICIA_PARAMS patricia_params = {0};
int rc = NCSCC_RC_FAILURE;
SaVersionT ntfVersion = { 'A', 0x01, 0x01 };
SaAmfHAStateT role;
@@ -524,12 +524,6 @@ static uint32_t initialize(void)
}
}
- patricia_params.key_size = sizeof(SaClmNodeIdT);
- if (ncs_patricia_tree_init(&cb->node_list, &patricia_params) !=
NCSCC_RC_SUCCESS) {
- LOG_ER("ncs_patricia_tree_init FAILED");
- goto done;
- }
-
/* get the node id of the node on which the AVD is running. */
cb->node_id_avd = m_NCS_GET_NODE_ID;
diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc
b/osaf/services/saf/amf/amfd/ndfsm.cc
--- a/osaf/services/saf/amf/amfd/ndfsm.cc
+++ b/osaf/services/saf/amf/amfd/ndfsm.cc
@@ -29,6 +29,8 @@
#include <cluster.h>
#include <daemon.h>
+AmfDb<uint32_t, AVD_FAIL_OVER_NODE> *node_list_db = 0; /* SaClmNodeIdT
index */
+
/*****************************************************************************
* Function: avd_node_up_func
*
@@ -350,13 +352,14 @@ void avd_mds_avnd_down_evh(AVD_CL_CB *cb
/* Find if node is there in the f-over node list.
* If yes then remove entry
*/
- AVD_FAIL_OVER_NODE *node_fovr;
- node_fovr = (AVD_FAIL_OVER_NODE
*)ncs_patricia_tree_get(&cb->node_list,
- (uint8_t *)&evt->info.node_id);
-
- if (NULL != node_fovr) {
- ncs_patricia_tree_del(&cb->node_list,
&node_fovr->tree_node_id_node);
- delete node_fovr;
+ for (std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator
it = node_list_db->begin();
+ it != node_list_db->end(); it++) {
+ AVD_FAIL_OVER_NODE *node_fovr = it->second;
+ if (node_fovr->node_id == evt->info.node_id) {
+ node_list_db->erase(node_fovr->node_id);
+ delete node_fovr;
+ break;
+ }
}
}
TRACE_LEAVE();
@@ -421,12 +424,8 @@ void avd_fail_over_event(AVD_CL_CB *cb)
node_to_add = new AVD_FAIL_OVER_NODE();
node_to_add->node_id = avnd->node_info.nodeId;
- node_to_add->tree_node_id_node.key_info = (uint8_t
*)&(node_to_add->node_id);
- node_to_add->tree_node_id_node.bit = 0;
- node_to_add->tree_node_id_node.left =
NCS_PATRICIA_NODE_NULL;
- node_to_add->tree_node_id_node.right =
NCS_PATRICIA_NODE_NULL;
- if (ncs_patricia_tree_add(&cb->node_list,
&node_to_add->tree_node_id_node) != NCSCC_RC_SUCCESS) {
+ if (node_list_db->insert(avnd->node_info.nodeId,
node_to_add) != NCSCC_RC_SUCCESS) {
/* log an error */
delete node_to_add;
return;
@@ -467,7 +466,6 @@ void avd_ack_nack_evh(AVD_CL_CB *cb, AVD
AVD_AVND *avnd;
AVD_SU *su_ptr;
AVD_SU_SI_REL *rel_ptr;
- AVD_FAIL_OVER_NODE *node_fovr;
AVD_DND_MSG *n2d_msg;
TRACE_ENTER();
@@ -476,17 +474,20 @@ void avd_ack_nack_evh(AVD_CL_CB *cb, AVD
/* Find if node is there in the f-over node list. If yes then remove
entry
* and process the message. Else just return.
*/
- if (NULL != (node_fovr =
- (AVD_FAIL_OVER_NODE *)ncs_patricia_tree_get(&cb->node_list,
- (uint8_t
*)&evt->info.avnd_msg->msg_info.
-
n2d_ack_nack_info.node_id))) {
- ncs_patricia_tree_del(&cb->node_list,
&node_fovr->tree_node_id_node);
- delete node_fovr;
- } else {
- /* do i need to log an error */
- avsv_dnd_msg_free(n2d_msg);
- evt->info.avnd_msg = NULL;
- goto done;
+ for (std::map<uint32_t, AVD_FAIL_OVER_NODE *>::const_iterator it =
node_list_db->begin();
+ it != node_list_db->end(); it++) {
+ AVD_FAIL_OVER_NODE *node_fovr = it->second;
+ if (node_fovr->node_id == evt->info.avnd_msg->msg_info.
+ n2d_ack_nack_info.node_id) {
+ node_list_db->erase(node_fovr->node_id);
+ delete node_fovr;
+ break;
+ } else {
+ /* do i need to log an error */
+ avsv_dnd_msg_free(n2d_msg);
+ evt->info.avnd_msg = NULL;
+ goto done;
+ }
}
/*
------------------------------------------------------------------------------
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