osaf/services/saf/amf/amfd/imm.cc  |  18 +++++++++++++-----
 osaf/services/saf/amf/amfd/role.cc |   4 ++--
 2 files changed, 15 insertions(+), 7 deletions(-)


If Immnd is killed, Amfd re-initializes with imm and re-reads configuration.
During configuration read if Immnd is again killed, Amfd exits.
The fix is to re-initialize if configuration reading fails.
Also, the fix re-initializes Om handles in case it is stale.

diff --git a/osaf/services/saf/amf/amfd/imm.cc 
b/osaf/services/saf/amf/amfd/imm.cc
--- a/osaf/services/saf/amf/amfd/imm.cc
+++ b/osaf/services/saf/amf/amfd/imm.cc
@@ -1663,7 +1663,7 @@ done:
        if (rc == NCSCC_RC_SUCCESS)
                TRACE("AMF Configuration successfully read from IMM");
        else
-               LOG_ER("Failed to read configuration, AMF will not start");
+               LOG_WA("Failed to read configuration.");
 
        TRACE_LEAVE2("%u", rc);
        return rc;
@@ -1964,11 +1964,19 @@ static void *avd_imm_reinit_bg_thread(vo
                                osaf_mutex_unlock_ordie(&imm_reinit_mutex);
                                exit(EXIT_FAILURE);
                        }
-
+                       /* Lets re-initialize Om interface also. */
+                       (void) immutil_saImmOmFinalize(cb->immOmHandle);
+                       if ((rc = immutil_saImmOmInitialize(&cb->immOmHandle, 
nullptr, &immVersion)) != SA_AIS_OK) {
+                               LOG_ER("saImmOmInitialize failed %u", rc);
+                               continue;
+                       }
                        if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
-                               LOG_ER("avd_imm_config_get FAILED");
-                               osaf_mutex_unlock_ordie(&imm_reinit_mutex);
-                               exit(EXIT_FAILURE);
+                               /* This can come when Immnd is killed again 
during
+                                  config read and reading the config returned 
BAD_HANDLE.
+                                  In other return types also, it is good to 
retry.
+                                  In normal situations, retry will help. */
+                               LOG_WA("avd_imm_config_get FAILED");
+                               continue;
                        }
                }
                break;
diff --git a/osaf/services/saf/amf/amfd/role.cc 
b/osaf/services/saf/amf/amfd/role.cc
--- a/osaf/services/saf/amf/amfd/role.cc
+++ b/osaf/services/saf/amf/amfd/role.cc
@@ -270,7 +270,7 @@ uint32_t avd_active_role_initialization(
         }
 
        if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
-               LOG_ER("avd_imm_config_get FAILED");
+               LOG_ER("avd_imm_config_get FAILED, AMF will not start.");
                goto done;
        }
 
@@ -304,7 +304,7 @@ uint32_t avd_standby_role_initialization
         }
 
        if (avd_imm_config_get() != NCSCC_RC_SUCCESS) {
-               LOG_ER("avd_imm_config_get FAILED");
+               LOG_ER("avd_imm_config_get FAILED, AMF will not start.");
                goto done;
        }
 

------------------------------------------------------------------------------
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
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to