Thanks Gary. Yes, OM re-initialization is required because when reading configuration if OM API fails, it marks Om handle as BAD_HANDLE and if we don't reinitialize it then it returns BAD handle again after successful OI initialize. I found it in testing, so added this fix.
Thanks -Nagu > -----Original Message----- > From: Gary Lee [mailto:gary....@dektech.com.au] > Sent: 16 March 2017 06:15 > To: Nagendra Kumar; hans.nordeb...@ericsson.com; Praveen Malviya; > minh.c...@dektech.com.au > Cc: opensaf-devel@lists.sourceforge.net > Subject: Re: [PATCH 1 of 1] amfd: handle BAD_HANDLE return during config > read [#2361] > > Hi Nagu > > Ack (review only + some legacy tests run). One question, is the OM reinit > strictly required? > > Thanks > Gary > > On 14/3/17, 8:54 pm, "nagendr...@oracle.com" <nagendr...@oracle.com> > wrote: > > 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