This commit reverts commit of d231ba43, which depends on node id to set
the node state as SHUTTING_DOWN. In node shutting down phase, the node id
can be removed from amfd since CLMD are termitated first.
This commit also introduces a new IMM state to determine whether IMM
service to be initialized.
---
src/amf/amfd/cb.h | 1 +
src/amf/amfd/imm.cc | 13 +++----------
src/amf/amfd/ndfsm.cc | 3 ++-
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/src/amf/amfd/cb.h b/src/amf/amfd/cb.h
index c7d7ddd..60bb554 100644
--- a/src/amf/amfd/cb.h
+++ b/src/amf/amfd/cb.h
@@ -63,6 +63,7 @@ typedef enum {
AVD_IMM_INIT_BASE = 1,
AVD_IMM_INIT_ONGOING = 2,
AVD_IMM_INIT_DONE = 3,
+ AVD_IMM_TERMINATING = 4,
} AVD_IMM_INIT_STATUS;
/*
* Sync state of the Standby.
diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index aef988f..47c0e5a 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -2185,25 +2185,18 @@ void avd_imm_reinit_bg(void) {
pthread_t thread;
pthread_attr_t attr;
int rc = 0;
- AVD_AVND *node = nullptr;
TRACE_ENTER();
if (avd_cb->avd_imm_status == AVD_IMM_INIT_ONGOING) {
TRACE("Already IMM init is going in another thread");
return;
}
- node = avd_node_find_nodeid(avd_cb->node_id_avd);
- if (node == nullptr) {
- LOG_ER("%s: invalid node ID (%x)", __FUNCTION__,
- avd_cb->node_id_avd);
- return;
- }
- if (node->node_state == AVD_AVND_STATE_SHUTTING_DOWN) {
- // the node is shutting down phase, no need to reinitialize
- // IMM service
+ if (avd_cb->avd_imm_status == AVD_IMM_TERMINATING) {
+ TRACE("IMMND/IMMD are being terminated by AMFND");
return;
}
+
avd_cb->avd_imm_status = AVD_IMM_INIT_ONGOING;
LOG_NO("Re-initializing with IMM");
diff --git a/src/amf/amfd/ndfsm.cc b/src/amf/amfd/ndfsm.cc
index 8501bad..9d54df1 100644
--- a/src/amf/amfd/ndfsm.cc
+++ b/src/amf/amfd/ndfsm.cc
@@ -587,9 +587,10 @@ void avd_node_down_evh(AVD_CL_CB *cb, AVD_EVT *evt)
n2d_msg->msg_info.n2d_node_down_info.msg_id) != NCSCC_RC_SUCCESS) {
/* log error that the director is not able to send the message */
LOG_ER("%s:%u: %u", __FILE__, __LINE__, node->node_info.nodeId);
+ goto done;
}
+ cb->avd_imm_status = AVD_IMM_TERMINATING;
}
- avd_node_state_set(node, AVD_AVND_STATE_SHUTTING_DOWN);
done:
avsv_dnd_msg_free(n2d_msg);
evt->info.avnd_msg = nullptr;
--
2.7.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel