Hi Vu,
Ack with a comment,  make sure to reset local_version wherever API is called in 
a loop 
Thanks,
Ravi

-----Original Message-----
From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au] 
Sent: Thursday, April 05, 2018 4:09 PM
To: ravisekhar.ko...@oracle.com; hans.nordeb...@ericsson.com; 
anders.wid...@ericsson.com; lennart.l...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen 
<vu.m.ngu...@dektech.com.au>
Subject: [PATCH 1/1] imm: make version parameter in immutil_xxx non-const 
[#2830]

The version in saImmO{m,i}Initialize is input/output parameter and is declared 
as non-constant for both IMM OM and OI API according to SAF spec.
But in immutil wrapper library, some are declared as constant and don't update 
the in/out version before returning from such wrappers.

This patch makes that parameter non-const and do update the version before 
returning from wrapper APIs. Also fix the wrong usage of these wrapper, passed 
const version, in some services/applications.
---
 src/amf/amfd/imm.cc                      | 11 +++++++----
 src/amf/amfnd/util.cc                    |  3 ++-
 src/log/apitest/imm_tstutil.c            |  5 ++++-
 src/log/apitest/logtest.c                |  9 ++++++---
 src/log/apitest/logtestfr.c              |  6 ++++--
 src/log/apitest/tet_log_runtime_cfgobj.c |  3 ++-
 src/log/logd/lgs_config.cc               |  3 ++-
 src/log/logd/lgs_imm.cc                  | 15 ++++++++++-----
 src/log/logd/lgs_imm_gcfg.cc             |  7 +++++--
 src/osaf/immutil/immutil.c               | 20 +++++++++++++++-----
 src/osaf/immutil/immutil.h               |  6 +++---
 src/smf/smfd/SmfAdminState.cc            |  4 ++--
 src/smf/smfd/SmfExecControlHdl.cc        |  3 ++-
 13 files changed, 64 insertions(+), 31 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc index 47c0e5a..8c70325 
100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -1461,6 +1461,7 @@ done:
 SaAisErrorT avd_imm_init(void *avd_cb) {
   SaAisErrorT error = SA_AIS_OK;
   AVD_CL_CB *cb = (AVD_CL_CB *)avd_cb;
+  SaVersionT local_version = immVersion;
 
   TRACE_ENTER();
 
@@ -1471,13 +1472,13 @@ SaAisErrorT avd_imm_init(void *avd_cb) {
 
   cb->avd_imm_status = AVD_IMM_INIT_ONGOING;
   if ((error = immutil_saImmOiInitialize_2(&cb->immOiHandle, &avd_callbacks,
-                                           &immVersion)) != SA_AIS_OK) {
+                                           &local_version)) != 
+ SA_AIS_OK) {
     LOG_ER("saImmOiInitialize failed %u", error);
     goto done;
   }
 
   if ((error = immutil_saImmOmInitialize(&cb->immOmHandle, nullptr,
-                                         &immVersion)) != SA_AIS_OK) {
+                                         &local_version)) != SA_AIS_OK) 
+ {
     LOG_ER("saImmOmInitialize failed %u", error);
     goto done;
   }
@@ -2075,6 +2076,7 @@ void avd_imm_update_runtime_attrs(void) {
  */
 static void *avd_imm_reinit_bg_thread(void *_cb) {
   SaAisErrorT rc = SA_AIS_OK;
+  SaVersionT local_version;
   AVD_CL_CB *cb = (AVD_CL_CB *)_cb;
   AVD_EVT *evt;
   uint32_t status;
@@ -2098,9 +2100,10 @@ static void *avd_imm_reinit_bg_thread(void *_cb) {
 
     avd_cb->immOiHandle = 0;
     avd_cb->is_implementer = false;
+    local_version = immVersion;
 
     if ((rc = immutil_saImmOiInitialize_2(&cb->immOiHandle, &avd_callbacks,
-                                          &immVersion)) != SA_AIS_OK) {
+                                          &local_version)) != 
+ SA_AIS_OK) {
       LOG_ER("saImmOiInitialize failed %u", rc);
       osaf_mutex_unlock_ordie(&imm_reinit_mutex);
       exit(EXIT_FAILURE);
@@ -2141,7 +2144,7 @@ static void *avd_imm_reinit_bg_thread(void *_cb) {
       /* Lets re-initialize Om interface also. */
       (void)immutil_saImmOmFinalize(cb->immOmHandle);
       if ((rc = immutil_saImmOmInitialize(&cb->immOmHandle, nullptr,
-                                          &immVersion)) != SA_AIS_OK) {
+                                          &local_version)) != 
+ SA_AIS_OK) {
         LOG_ER("saImmOmInitialize failed %u", rc);
         continue;
       }
diff --git a/src/amf/amfnd/util.cc b/src/amf/amfnd/util.cc index 
f6dbb49..38bf426 100644
--- a/src/amf/amfnd/util.cc
+++ b/src/amf/amfnd/util.cc
@@ -250,8 +250,9 @@ const char *avnd_failed_state_file_location(void) {  
SaAisErrorT saImmOmInitialize_cond(SaImmHandleT *immHandle,
                                    const SaImmCallbacksT *immCallbacks,
                                    const SaVersionT *version) {
+  SaVersionT local_version = *version;
   if (avnd_cb->scs_absence_max_duration == 0) {
-    return immutil_saImmOmInitialize(immHandle, immCallbacks, version);
+    return immutil_saImmOmInitialize(immHandle, immCallbacks, 
+ &local_version);
   }
 
   SaVersionT localVer = *version;
diff --git a/src/log/apitest/imm_tstutil.c b/src/log/apitest/imm_tstutil.c 
index 194dffa..2143f83 100644
--- a/src/log/apitest/imm_tstutil.c
+++ b/src/log/apitest/imm_tstutil.c
@@ -32,6 +32,7 @@ bool get_multivalue_type_string_from_imm(SaImmHandleT 
*omHandle,  {
        SaAisErrorT om_rc = SA_AIS_OK;
        SaImmAccessorHandleT accessorHandle;
+       SaVersionT local_version;
        SaImmAttrValuesT_2 *attribute;
        SaImmAttrValuesT_2 **attributes;
        bool func_rc = true;
@@ -39,10 +40,12 @@ bool get_multivalue_type_string_from_imm(SaImmHandleT 
*omHandle,
        // printf(">> get_multivalue_string_type_from_imm()\n");
 
        do {
+               local_version = kImmVersion;
                /* Make sure this is a NULL pointer if no values are found */
                *multivalue_array = NULL;
 
-               om_rc = immutil_saImmOmInitialize(omHandle, NULL, &kImmVersion);
+               om_rc = immutil_saImmOmInitialize(omHandle, NULL,
+                                                 &local_version);
                if (om_rc != SA_AIS_OK) {
                        printf("immutil_saImmOmInitialize Fail '%s'\n",
                               saf_error(om_rc));
diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c index 
f8fe135..aabd1e5 100644
--- a/src/log/apitest/logtest.c
+++ b/src/log/apitest/logtest.c
@@ -102,6 +102,7 @@ void init_logrootpath(void)
        SaImmHandleT omHandle;
        SaConstStringT config = "logConfig=1,safApp=safLogService";
        SaNameT objectName;
+       SaVersionT local_version = kImmVersion;
        SaImmAccessorHandleT accessorHandle;
        SaImmAttrValuesT_2 *attribute;
        SaImmAttrValuesT_2 **attributes;
@@ -112,7 +113,7 @@ void init_logrootpath(void)
 
        saAisNameLend(config, &objectName);
        /* NOTE: immutil init osaf_assert if error */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Get all attributes of the object */ @@ -140,6 +141,7 @@ int 
get_attr_value(SaNameT *inObjName, char *inAttr, void *outValue)  {
        SaImmHandleT omHandle;
        SaImmAccessorHandleT accessorHandle;
+       SaVersionT local_version = kImmVersion;
        SaImmAttrValuesT_2 *attribute = NULL;
        SaImmAttrValuesT_2 **attributes;
        SaAisErrorT ais_rc = SA_AIS_OK;
@@ -147,7 +149,7 @@ int get_attr_value(SaNameT *inObjName, char *inAttr, void 
*outValue)
        int rc = 0;
 
        /* NOTE: immutil init osaf_assert if error */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Get all attributes of the object */ @@ -286,6 +288,7 @@ int 
get_active_sc(void)
        SaImmHandleT omHandle;
        SaConstStringT objname = "safSu=SC-1,safSg=2N,safApp=OpenSAF";
        SaNameT objectName1;
+       SaVersionT local_version = kImmVersion;
        SaImmAccessorHandleT accessorHandle;
        SaImmAttrValuesT_2 **attributes;
        const char saAmfSUNumCurrActiveSIs[] = "saAmfSUNumCurrActiveSIs"; @@ 
-296,7 +299,7 @@ int get_active_sc(void)
        saAisNameLend(objname, &objectName1);
        /* NOTE: immutil init osaf_assert if error
         */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Get attributes of the object
diff --git a/src/log/apitest/logtestfr.c b/src/log/apitest/logtestfr.c index 
b2ef30b..a110240 100644
--- a/src/log/apitest/logtestfr.c
+++ b/src/log/apitest/logtestfr.c
@@ -91,11 +91,12 @@ static int get_active_sc(void)
        const char saAmfSUNumCurrActiveSIs[] = "saAmfSUNumCurrActiveSIs";
        SaImmAttrNameT attributeNames[2] = {(char *)saAmfSUNumCurrActiveSIs,
                                            NULL};
+       SaVersionT local_version = kImmVersion;
        SaUint32T curr_act_sis = 0;
 
        /* NOTE: immutil init osaf_assert if error
         */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Get attributes of the object
@@ -191,9 +192,10 @@ void get_logRootDirectory(char *path_str)
        const char logRootDirectory_name[] = "logRootDirectory";
        SaImmAttrNameT attributeNames[2] = {(char *)logRootDirectory_name,
                                            NULL};
+       SaVersionT local_version = kImmVersion;
 
        /* NOTE: immutil init osaf_assert if error */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Get all attributes of the object */ diff --git 
a/src/log/apitest/tet_log_runtime_cfgobj.c 
b/src/log/apitest/tet_log_runtime_cfgobj.c
index 047296c..ae83e65 100644
--- a/src/log/apitest/tet_log_runtime_cfgobj.c
+++ b/src/log/apitest/tet_log_runtime_cfgobj.c
@@ -37,13 +37,14 @@ void log_rt_cf_obj_compare(void)
        SaNameT object_name;
        SaImmAccessorHandleT accessorHandle;
        SaImmAttrValuesT_2 **attributes;
+       SaVersionT local_version = kImmVersion;
        uint32_t r_cnt = 0; /* Counter for attributes in runtime object */
        uint32_t c_cnt = 0;
        SaAisErrorT ais_rc = SA_AIS_OK;
        int tst_res = 0; /* Test result: 0 = PASS */
 
        /* NOTE: immutil will osaf_assert if error */
-       (void)immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+       (void)immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
        (void)immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle);
 
        /* Count attributes in configuration object diff --git 
a/src/log/logd/lgs_config.cc b/src/log/logd/lgs_config.cc index 
4190e30..71d7318 100644
--- a/src/log/logd/lgs_config.cc
+++ b/src/log/logd/lgs_config.cc
@@ -975,6 +975,7 @@ static void read_logsv_config_obj_2() {
   SaImmAccessorHandleT accessorHandle;
   SaImmAttrValuesT_2 *attribute;
   SaImmAttrValuesT_2 **attributes;
+  SaVersionT local_version = kImmVersion;
   int i = 0;
   int n;
 
@@ -982,7 +983,7 @@ static void read_logsv_config_obj_2() {
 
   /* NOTE: immutil init will osaf_assert if error */
   SaAisErrorT om_rc =
-      immutil_saImmOmInitialize(&omHandle, nullptr, &kImmVersion);
+      immutil_saImmOmInitialize(&omHandle, nullptr, &local_version);
   if (om_rc != SA_AIS_OK) {
     LOG_ER("immutil_saImmOmInitialize failed: %s", saf_error(om_rc));
     osaf_abort(0);
diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc index 
60870fa..f772dd5 100644
--- a/src/log/logd/lgs_imm.cc
+++ b/src/log/logd/lgs_imm.cc
@@ -973,6 +973,7 @@ static lgs_stream_defval_t *get_SaLogStreamConfig_default() 
{
   SaImmClassCategoryT cc;
   SaImmAttrDefinitionT_2 **attributes = NULL;
   SaImmAttrDefinitionT_2 *attribute = NULL;
+  SaVersionT local_version = kImmVersion;
 
   TRACE_ENTER();
   if (lgs_stream_defval_updated_flag == false) { @@ -980,7 +981,7 @@ static 
lgs_stream_defval_t *get_SaLogStreamConfig_default() {
      * We are only interested in saLogStreamMaxLogFileSize and
      * saLogStreamFixedLogRecordSize
      */
-    rc = immutil_saImmOmInitialize(&om_handle, NULL, &kImmVersion);
+    rc = immutil_saImmOmInitialize(&om_handle, NULL, &local_version);
     if (rc != SA_AIS_OK) {
       TRACE("immutil_saImmOmInitialize fail rc=%d", rc);
     }
@@ -2908,6 +2909,7 @@ SaAisErrorT lgs_imm_init_configStreams(lgs_cb_t *cb) {
   SaImmSearchParametersT_2 objectSearch;
   SaImmAttrValuesT_2 **attributes;
   SaImmAttrDefinitionT_2** attr_definitions;
+  SaVersionT local_version = kImmVersion;
   int wellknownStreamId = 0;
   int appStreamId = 3;
   uint32_t streamId = 0;
@@ -2916,7 +2918,7 @@ SaAisErrorT lgs_imm_init_configStreams(lgs_cb_t *cb) {
   SaBoolT endloop = SA_FALSE, jstart = SA_TRUE;
   TRACE_ENTER();
 
-  om_rc = immutil_saImmOmInitialize(&omHandle, NULL, &kImmVersion);
+  om_rc = immutil_saImmOmInitialize(&omHandle, NULL, &local_version);
   if (om_rc != SA_AIS_OK) {
     LOG_ER("immutil_saImmOmInitialize failed %s", saf_error(om_rc));
     osaf_abort(0);
@@ -3309,13 +3311,14 @@ void lgs_search_stream_objects() {
   SaAisErrorT ais_rc = SA_AIS_OK;
   SaImmHandleT immOmHandle;
   SaImmSearchHandleT immSearchHandle;
+  SaVersionT local_version = kImmVersion;
   const char *class_name = "SaLogStream";
 
   TRACE_ENTER();
 
   /* Intialize Om API
    */
-  ais_rc = immutil_saImmOmInitialize(&immOmHandle, NULL, &kImmVersion);
+  ais_rc = immutil_saImmOmInitialize(&immOmHandle, NULL, 
+ &local_version);
   if (ais_rc != SA_AIS_OK) {
     LOG_WA("%s saImmOmInitialize FAIL %d", __FUNCTION__, ais_rc);
     goto done;
@@ -3479,6 +3482,7 @@ int lgs_get_streamobj_attr(SaImmAttrValuesT_2 
***attrib_out,
   int rc = 0;
   SaAisErrorT ais_rc = SA_AIS_OK;
   SaImmAccessorHandleT accessorHandle;
+  SaVersionT local_version = kImmVersion;
   char *attribute_names[] = {
       const_cast<char *>("saLogStreamFileName"),
       const_cast<char *>("saLogStreamPathName"), @@ -3503,7 +3507,7 @@ int 
lgs_get_streamobj_attr(SaImmAttrValuesT_2 ***attrib_out,
 
   /* Initialize Om API
    */
-  ais_rc = immutil_saImmOmInitialize(immOmHandle, NULL, &kImmVersion);
+  ais_rc = immutil_saImmOmInitialize(immOmHandle, NULL, 
+ &local_version);
   if (ais_rc != SA_AIS_OK) {
     LOG_WA("\t%s saImmOmInitialize FAIL %d", __FUNCTION__, ais_rc);
     rc = -1;
@@ -3584,6 +3588,7 @@ SaUint32T *lgs_get_scAbsenceAllowed_attr(SaUint32T 
*attr_val) {
   SaImmHandleT immOmHandle;
   SaImmAttrValuesT_2 *attribute;
   SaImmAttrValuesT_2 **attributes;
+  SaVersionT local_version = kImmVersion;
 
   TRACE_ENTER();
   char *attribute_names[] = {const_cast<char *>("scAbsenceAllowed"), NULL}; @@ 
-3599,7 +3604,7 @@ SaUint32T *lgs_get_scAbsenceAllowed_attr(SaUint32T 
*attr_val) {
 
   /* Initialize Om API
    */
-  ais_rc = immutil_saImmOmInitialize(&immOmHandle, NULL, &kImmVersion);
+  ais_rc = immutil_saImmOmInitialize(&immOmHandle, NULL, 
+ &local_version);
   if (ais_rc != SA_AIS_OK) {
     LOG_WA("\t%s saImmOmInitialize FAIL %d", __FUNCTION__, ais_rc);
     goto done;
diff --git a/src/log/logd/lgs_imm_gcfg.cc b/src/log/logd/lgs_imm_gcfg.cc index 
f7d59d1..64a5f3f 100644
--- a/src/log/logd/lgs_imm_gcfg.cc
+++ b/src/log/logd/lgs_imm_gcfg.cc
@@ -571,6 +571,7 @@ static int read_network_name() {
   SaNameT object_name;
   SaImmAttrValuesT_2 **attributes;
   SaImmAttrValuesT_2 *attribute;
+  SaVersionT local_version = kImmVersion;
   void *value = NULL;
 
   /* Setup search initialize parameters */ @@ -589,7 +590,7 @@ static int 
read_network_name() {
   /*
    * Initialize an IMM object manager
    */
-  ais_rc = immutil_saImmOmInitialize(&om_handle, NULL, &kImmVersion);
+  ais_rc = immutil_saImmOmInitialize(&om_handle, NULL, &local_version);
   if (ais_rc != SA_AIS_OK) {
     TRACE("immutil_saImmOmInitialize FAIL %s", saf_error(ais_rc));
     rc = -1;
@@ -685,6 +686,7 @@ done:
 static int applier_init(SaImmOiHandleT *imm_appl_hdl,
                         SaSelectionObjectT *imm_appl_selobj) {
   SaAisErrorT ais_rc = SA_AIS_OK;
+  SaVersionT local_version = kImmVersion;
   int rc = 0;
 
   TRACE_ENTER();
@@ -705,7 +707,8 @@ static int applier_init(SaImmOiHandleT *imm_appl_hdl,
   }
 
   /* Initialize OI for applier and get OI handle */
-  ais_rc = immutil_saImmOiInitialize_2(imm_appl_hdl, &callbacks, &kImmVersion);
+  ais_rc = immutil_saImmOiInitialize_2(imm_appl_hdl, &callbacks,
+                                       &local_version);
   if (ais_rc != SA_AIS_OK) {
     LOG_WA("immutil_saImmOiInitialize_2 Failed %s", saf_error(ais_rc));
     rc = -1;
diff --git a/src/osaf/immutil/immutil.c b/src/osaf/immutil/immutil.c index 
1add1d0..e10a8ff 100644
--- a/src/osaf/immutil/immutil.c
+++ b/src/osaf/immutil/immutil.c
@@ -610,8 +610,9 @@ SaImmClassNameT immutil_get_className(const SaNameT 
*objectName)
        SaImmAccessorHandleT accessorHandle;
        SaImmAttrValuesT_2 **attributes;
        SaImmAttrNameT attributeNames[] = {"SaImmAttrClassName", NULL};
+       SaVersionT localVer = immVersion;
 
-       if (immutil_saImmOmInitialize(&omHandle, NULL, &immVersion) !=
+       if (immutil_saImmOmInitialize(&omHandle, NULL, &localVer) !=
            SA_AIS_OK)
                goto done;
        if (immutil_saImmOmAccessorInitialize(omHandle, &accessorHandle) != @@ 
-639,9 +640,10 @@ SaAisErrorT immutil_get_attrValueType(const SaImmClassNameT 
className,
        SaImmClassCategoryT classCategory;
        SaImmAttrDefinitionT_2 *attrDef;
        SaImmAttrDefinitionT_2 **attrDefinitions;
+       SaVersionT localVer = immVersion;
        int i = 0;
 
-       if ((rc = immutil_saImmOmInitialize(&omHandle, NULL, &immVersion)) !=
+       if ((rc = immutil_saImmOmInitialize(&omHandle, NULL, &localVer)) !=
            SA_AIS_OK) {
                return rc;
        }
@@ -1083,7 +1085,7 @@ struct ImmutilWrapperProfile immutilWrapperProfile = {1, 
25, 400};  SaAisErrorT  immutil_saImmOiInitialize_2(SaImmOiHandleT *immOiHandle,
                            const SaImmOiCallbacksT_2 *immOiCallbacks,
-                           const SaVersionT *version)
+                           SaVersionT *version)
 {
        /* Version parameter is in/out i.e. must be mutable and should not be
           re-used from previous call in a retry loop. */ @@ -1100,6 +1102,8 @@ 
immutil_saImmOiInitialize_2(SaImmOiHandleT *immOiHandle,
                    saImmOiInitialize_2(immOiHandle, immOiCallbacks, &localVer);
                nTries++;
        }
+
+       *version = localVer;
        if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal)
                immutilError("saImmOiInitialize FAILED, rc = %d", (int)rc);
        return rc;
@@ -1108,7 +1112,7 @@ immutil_saImmOiInitialize_2(SaImmOiHandleT *immOiHandle,  
SaAisErrorT  immutil_saImmOiInitialize_o3(SaImmOiHandleT *immOiHandle,
                             const SaImmOiCallbacksT_o3 *immOiCallbacks,
-                            const SaVersionT *version)
+                            SaVersionT *version)
 {
        /* Version parameter is in/out i.e. must be mutable and should not be
           re-used from previous call in a retry loop. */ @@ -1125,6 +1129,8 @@ 
immutil_saImmOiInitialize_o3(SaImmOiHandleT *immOiHandle,
                                          &localVer);
                nTries++;
        }
+
+       *version = localVer;
        if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal)
                immutilError("saImmOiInitialize_o3 FAILED, rc = %d", (int)rc);
        return rc;
@@ -1515,7 +1521,7 @@ SaAisErrorT immutil_saImmOiAugmentCcbInitialize(
 
 SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle,
                                      const SaImmCallbacksT *immCallbacks,
-                                     const SaVersionT *version)
+                                     SaVersionT *version)
 {
        /* Version parameter is in/out i.e. must be mutable and should not be
           re-used from previous call in a retry loop. */ @@ -1530,6 +1536,8 @@ 
SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle,
                rc = saImmOmInitialize(immHandle, immCallbacks, &localVer);
                nTries++;
        }
+
+       *version = localVer;
        if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal)
                immutilError("saImmOmInitialize FAILED, rc = %d", (int)rc);
        return rc;
@@ -1553,6 +1561,8 @@ SaAisErrorT immutil_saImmOmInitialize_o2(SaImmHandleT 
*immHandle,
                rc = saImmOmInitialize_o2(immHandle, immCallbacks, &localVer);
                nTries++;
        }
+
+       *version = localVer;
        if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal)
                immutilError(" FAILED, rc = %d", (int)rc);
        return rc;
diff --git a/src/osaf/immutil/immutil.h b/src/osaf/immutil/immutil.h index 
dc6449b..63e710f 100644
--- a/src/osaf/immutil/immutil.h
+++ b/src/osaf/immutil/immutil.h
@@ -421,11 +421,11 @@ struct ImmutilWrapperProfile {
  */
 EXTERN_C SaAisErrorT immutil_saImmOiInitialize_2(
     SaImmOiHandleT *immOiHandle, const SaImmOiCallbacksT_2 *immOiCallbacks,
-    const SaVersionT *version);
+    SaVersionT *version);
 
 EXTERN_C SaAisErrorT immutil_saImmOiInitialize_o3(
     SaImmOiHandleT *immOiHandle, const SaImmOiCallbacksT_o3 *immOiCallbacks,
-    const SaVersionT *version);
+    SaVersionT *version);
 
 EXTERN_C SaAisErrorT immutil_saImmOiSelectionObjectGet(
     SaImmOiHandleT immOiHandle, SaSelectionObjectT *selectionObject); @@ 
-500,7 +500,7 @@ EXTERN_C SaAisErrorT immutil_saImmOiAugmentCcbInitialize(
 
 EXTERN_C SaAisErrorT immutil_saImmOmInitialize(
     SaImmHandleT *immHandle, const SaImmCallbacksT *immCallbacks,
-    const SaVersionT *version);
+    SaVersionT *version);
 
 EXTERN_C SaAisErrorT immutil_saImmOmInitialize_o2(
     SaImmHandleT *immHandle, const SaImmCallbacksT_o2 *immCallbacks, diff 
--git a/src/smf/smfd/SmfAdminState.cc b/src/smf/smfd/SmfAdminState.cc index 
9508447..52bdf4b 100644
--- a/src/smf/smfd/SmfAdminState.cc
+++ b/src/smf/smfd/SmfAdminState.cc
@@ -264,12 +264,13 @@ done:
 //
 bool SmfAdminStateHandler::initImmOmAndSetAdminOwnerName() {
   SaAisErrorT ais_rc = SA_AIS_ERR_TRY_AGAIN;
+  SaVersionT local_version = immVersion_;
   int timeout_try_cnt = 6;
   bool rc = true;
 
   // OM handle
   while (timeout_try_cnt > 0) {
-    ais_rc = immutil_saImmOmInitialize(&omHandle_, NULL, &immVersion_);
+    ais_rc = immutil_saImmOmInitialize(&omHandle_, NULL, 
+ &local_version);
     if (ais_rc != SA_AIS_ERR_TIMEOUT) break;
     timeout_try_cnt--;
   }
@@ -973,4 +974,3 @@ bool 
SmfAdminStateHandler::adminOperation(SaAmfAdminOperationIdT adminOperation,
   TRACE_LEAVE2("rc=%d", rc);
   return rc;
 }
-
diff --git a/src/smf/smfd/SmfExecControlHdl.cc 
b/src/smf/smfd/SmfExecControlHdl.cc
index e97b765..bb5f9a5 100644
--- a/src/smf/smfd/SmfExecControlHdl.cc
+++ b/src/smf/smfd/SmfExecControlHdl.cc
@@ -373,6 +373,7 @@ bool SmfExecControlObjHandler::copyExecControlObject() {
  */
 bool SmfExecControlObjHandler::createImmOmHandles() {
   SaAisErrorT ais_rc = SA_AIS_ERR_TRY_AGAIN;
+  SaVersionT local_version = m_immVersion;
   int timeout_try_cnt = 6;
   bool rc = true;
 
@@ -382,7 +383,7 @@ bool SmfExecControlObjHandler::createImmOmHandles() {
 
   // OM handle
   while (timeout_try_cnt > 0) {
-    ais_rc = immutil_saImmOmInitialize(&m_omHandle, NULL, &m_immVersion);
+    ais_rc = immutil_saImmOmInitialize(&m_omHandle, NULL, 
+ &local_version);
     if (ais_rc != SA_AIS_ERR_TIMEOUT) break;
     timeout_try_cnt--;
   }
--
1.9.1

------------------------------------------------------------------------------
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