osaf/services/saf/smfsv/smfd/SmfExecControlHdl.cc  |  69 ++++++++++++++-------
 osaf/services/saf/smfsv/smfd/SmfExecControlHdl.h   |  13 +--
 osaf/services/saf/smfsv/smfd/SmfUpgradeCampaign.cc |   1 +
 3 files changed, 51 insertions(+), 32 deletions(-)


diff --git a/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.cc 
b/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.cc
--- a/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.cc
+++ b/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.cc
@@ -41,7 +41,10 @@ SmfExecControlObjHandler::SmfExecControl
   m_exec_ctrl_name_ad(0),
   m_procExecMode_ad(0),
   m_numberOfSingleSteps_ad(0),
-  m_nodesForSingleStep_ad(0)
+  m_nodesForSingleStep_ad(0),
+  m_omHandle(0),
+  m_ownerHandle(0),
+  m_ccbHandle(0)
 {
   p_immutil_object = new SmfImmUtils; // Deleted by uninstall and in destructor
 }
@@ -57,8 +60,10 @@ SmfExecControlObjHandler::~SmfExecContro
   // overwritten the next time a copy has to be created
   //
   TRACE_ENTER();
-  if (p_immutil_object != 0)
+  if (p_immutil_object != NULL) {
     delete p_immutil_object;
+    p_immutil_object = NULL;
+  }
   TRACE_LEAVE();
 }
 
@@ -94,8 +99,10 @@ bool SmfExecControlObjHandler::install()
 
 void SmfExecControlObjHandler::uninstall() {
   TRACE_ENTER();
-  if (p_immutil_object != 0)
+  if (p_immutil_object != NULL) {
     delete p_immutil_object;
+    p_immutil_object = NULL;
+  }
   removeExecControlObjectCopy();
   TRACE_LEAVE();
 }
@@ -311,6 +318,20 @@ void SmfExecControlObjHandler::removeExe
 
   TRACE("Deleting object '%s'", c_openSafSmfExecControl_copy);
 
+  if (createImmOmHandles() == false) {
+    TRACE("createCcbHandle Fail");
+  }
+
+  const SaNameT *names[2];
+  names[0] = &node_name;
+  names[1] = NULL;
+  ais_rc = immutil_saImmOmAdminOwnerSet(m_ownerHandle, names, SA_IMM_ONE);
+
+  if (ais_rc != SA_AIS_OK) {
+    LOG_NO("%s - saImmOmAdminOwnerSet FAILED: %s",
+           __FUNCTION__, saf_error(ais_rc));
+  }
+
   ais_rc = immutil_saImmOmCcbObjectDelete(m_ccbHandle,
           &node_name);
   if (ais_rc != SA_AIS_OK) {
@@ -325,6 +346,8 @@ void SmfExecControlObjHandler::removeExe
           }
   }
 
+  finalizeImmOmHandles();
+
   TRACE_LEAVE();
 }
 
@@ -344,10 +367,8 @@ bool SmfExecControlObjHandler::copyExecC
   // ------------------------------------
   // Create handles needed
   //
-  rc = createAllImmHandles();
-  if (rc == false) {
-    LOG_NO("%s: createAllImmHandles Fail", __FUNCTION__);
-    return rc;
+  if (createImmOmHandles() == false) {
+    TRACE("createCcbHandle Fail");
   }
 
   // ------------------------------------
@@ -398,6 +419,7 @@ bool SmfExecControlObjHandler::copyExecC
     }
   }
 
+  finalizeImmOmHandles();
   TRACE_LEAVE();
   return rc;
 }
@@ -428,7 +450,7 @@ void SmfExecControlObjHandler::saveAttri
  * 
  * @return false on Fail
  */
-bool SmfExecControlObjHandler::createAllImmHandles() {
+bool SmfExecControlObjHandler::createImmOmHandles() {
   SaAisErrorT ais_rc = SA_AIS_ERR_TRY_AGAIN;
   int timeout_try_cnt = 6;
   bool rc = true;
@@ -448,23 +470,6 @@ bool SmfExecControlObjHandler::createAll
     rc = false;
   }
 
-  // Accessors handle
-  if (rc == true) {
-    timeout_try_cnt = 6;
-    while (timeout_try_cnt > 0) {
-      ais_rc = immutil_saImmOmAccessorInitialize(m_omHandle,
-                                                 &m_accessorHandle);
-      if (ais_rc != SA_AIS_ERR_TIMEOUT)
-        break;
-      timeout_try_cnt--;
-    }
-    if (ais_rc != SA_AIS_OK) {
-      LOG_NO("%s: saImmOmAccessorInitialize Fail %s",
-             __FUNCTION__, saf_error(ais_rc));
-      rc = false;
-    }
-  }
-
   // Admin owner handle
   if (rc == true) {
     timeout_try_cnt = 6;
@@ -504,3 +509,17 @@ bool SmfExecControlObjHandler::createAll
   TRACE_LEAVE();
   return rc;
 }
+
+void SmfExecControlObjHandler::finalizeImmOmHandles() {
+  if (m_omHandle != 0) {
+    SaAisErrorT ais_rc = immutil_saImmOmFinalize(m_omHandle);
+    if (ais_rc != SA_AIS_OK) {
+      LOG_NO("%s: immutil_saImmOmFinalize Fail %s",
+             __FUNCTION__, saf_error(ais_rc));
+    }
+  }
+
+  m_omHandle = 0;
+  m_ownerHandle = 0;
+  m_ccbHandle = 0;
+}
diff --git a/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.h 
b/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.h
--- a/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.h
+++ b/osaf/services/saf/smfsv/smfd/SmfExecControlHdl.h
@@ -85,7 +85,8 @@ class SmfExecControlObjHandler {
   bool readOpenSafSmfConfig();
   bool copyExecControlObject();
   void removeExecControlObjectCopy();
-  bool createAllImmHandles();
+  bool createImmOmHandles();
+  void finalizeImmOmHandles();
   void saveAttributeDescriptors();
 
 
@@ -104,7 +105,7 @@ class SmfExecControlObjHandler {
 
   
   // For OpenSafSmfExecControl object copy
-  const char* c_openSafSmfExecControl_copy = "openSafSmfExecControl_copy";
+  const char* c_openSafSmfExecControl_copy = 
"openSafSmfExecControl=SmfHdlCopy";
   SaImmAttrValuesT_2 **m_attributes;
   SaImmAttrValuesT_2 *m_exec_ctrl_name_ad;
   SaImmAttrValuesT_2 *m_procExecMode_ad;
@@ -114,11 +115,9 @@ class SmfExecControlObjHandler {
 
   // For storing IMM handles
   const SaVersionT m_immVersion {'A', 2, 1};
-  SaImmHandleT m_omHandle {0};
-  SaImmAdminOwnerHandleT m_ownerHandle {0};
-  SaImmCcbHandleT m_ccbHandle {0};
-  SaImmAccessorHandleT m_accessorHandle {0};
-
+  SaImmHandleT m_omHandle;
+  SaImmAdminOwnerHandleT m_ownerHandle;
+  SaImmCcbHandleT m_ccbHandle;
 
   DELETE_COPY_AND_MOVE_OPERATORS(SmfExecControlObjHandler);
 };
diff --git a/osaf/services/saf/smfsv/smfd/SmfUpgradeCampaign.cc 
b/osaf/services/saf/smfsv/smfd/SmfUpgradeCampaign.cc
--- a/osaf/services/saf/smfsv/smfd/SmfUpgradeCampaign.cc
+++ b/osaf/services/saf/smfsv/smfd/SmfUpgradeCampaign.cc
@@ -93,6 +93,7 @@ SmfUpgradeCampaign::~SmfUpgradeCampaign(
         }
         m_originalProcedures.clear();
 
+        m_execControlHdl->uninstall();
         delete m_execControlHdl;
 
         TRACE_LEAVE();

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