---
 src/amf/amfd/imm.cc  |  2 ++
 src/amf/amfd/node.cc | 26 ++++++++++++++++++++++++++
 src/amf/amfd/node.h  |  1 +
 3 files changed, 29 insertions(+)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index 82d2b13..03a91cc 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -41,6 +41,7 @@
 #include "amf/common/amf_defs.h"
 #include "amf/amfd/imm.h"
 #include "amf/amfd/cluster.h"
+#include "amf/amfd/node.h"
 #include "amf/amfd/app.h"
 #include "amf/amfd/sgtype.h"
 #include "amf/amfd/sg.h"
@@ -2167,6 +2168,7 @@ static void *avd_imm_reinit_bg_thread(void *_cb) {
         osaf_mutex_unlock_ordie(&imm_reinit_mutex);
         exit(EXIT_FAILURE);
       }
+      avd_check_nodes_after_renit_imm();
     } else {
       /* become applier and re-read the config */
       rc = avd_imm_applier_set();
diff --git a/src/amf/amfd/node.cc b/src/amf/amfd/node.cc
index 0ffcfb7..b6e57f2 100644
--- a/src/amf/amfd/node.cc
+++ b/src/amf/amfd/node.cc
@@ -46,6 +46,32 @@ bool NodeNameCompare::operator()(const AVD_AVND *lhs, const 
AVD_AVND *rhs) {
   return *lhs < *rhs;
 }
 
+void avd_check_nodes_after_renit_imm() {
+  TRACE_ENTER();
+  SaImmAccessorHandleT accessorHandle;
+  immutil_saImmOmAccessorInitialize(avd_cb->immOmHandle, &accessorHandle);
+
+  AmfDb<std::string, AVD_AVND>::iterator it;
+  for (it = node_name_db->begin(); it != node_name_db->end(); it++)
+  {
+    const SaImmAttrValuesT_2 **attributes;
+    const std::string dn = it->first.c_str();
+    SaImmAttrNameT attrName = const_cast<SaImmAttrNameT>("saAmfNodeClmNode");
+    SaImmAttrNameT attributeNames[] = {attrName, nullptr};
+    SaAisErrorT rc =
+        immutil_saImmOmAccessorGet_o2(accessorHandle, dn.c_str(),
+                                      attributeNames,
+                                      (SaImmAttrValuesT_2 ***)&attributes);
+    if (rc == SA_AIS_ERR_NOT_EXIST) {
+      LOG_WA("Remove node %s after reinit IMM", dn.c_str());
+      avd_node_delete_nodeid(it->second);
+      avd_node_delete(it->second);
+    }
+  }
+  immutil_saImmOmAccessorFinalize(accessorHandle);
+  TRACE_LEAVE();
+}
+
 uint32_t avd_node_add_nodeid(AVD_AVND *node) {
   if ((node_id_db->find(node->node_info.nodeId) == nullptr) &&
       (node->node_info.nodeId != 0)) {
diff --git a/src/amf/amfd/node.h b/src/amf/amfd/node.h
index e64bf8c..9fe9f19 100644
--- a/src/amf/amfd/node.h
+++ b/src/amf/amfd/node.h
@@ -240,5 +240,6 @@ extern bool are_all_ngs_in_unlocked_state(const AVD_AVND 
*node);
 extern bool any_ng_in_locked_in_state(const AVD_AVND *node);
 void avd_ng_restore_headless_states(AVD_CL_CB *cb,
                                     struct avd_su_si_rel_tag *susi);
+void avd_check_nodes_after_renit_imm();
 
 #endif  // AMF_AMFD_NODE_H_
-- 
2.7.4



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to