osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc |  49 +++++++++++++++++--------
 1 files changed, 33 insertions(+), 16 deletions(-)


Fix the deleteNodeGroup() method must be so that if the delete operation fails
with bad handles new handles are created so that the node group can be deleted

diff --git a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc 
b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
--- a/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
+++ b/osaf/services/saf/smfsv/smfd/SmfUpgradeStep.cc
@@ -3580,22 +3580,36 @@ bool SmfAdminOperation::deleteNodeGroup(
                &nodeGroupName);
 
        TRACE("\t Deleting nodeGroup '%s'", nodeGroupName_s.c_str());
-
-       m_errno = immutil_saImmOmCcbObjectDelete(m_ccbHandle,
-               &nodeGroupName);
-       if (m_errno != SA_AIS_OK) {
-               LOG_NO("%s: saImmOmCcbObjectDelete '%s' Fail %s",
-                __FUNCTION__, nodeGroupName_s.c_str(),
-                saf_error(m_errno));
-               rc = false;
-       } else {
-               m_errno = saImmOmCcbApply(m_ccbHandle);
-               if (m_errno != SA_AIS_OK) {
-               LOG_NO("%s: saImmOmCcbApply() Fail '%s'",
-                       __FUNCTION__, saf_error(m_errno));
-                       rc = false;
-               }
-       }
+        while (true) {
+                m_errno = immutil_saImmOmCcbObjectDelete(m_ccbHandle,
+                        &nodeGroupName);
+                if (m_errno == SA_AIS_ERR_BAD_HANDLE) {
+                        // Handles may have been invalidated/timed out
+                        (void)immutil_saImmOmFinalize(m_omHandle);
+                        bool rc = getAllImmHandles();
+                        if (rc == false) {
+                                LOG_NO("%s: getAllImmHandles Fail",
+                                       __FUNCTION__);
+                                break;
+                        }
+                        continue;
+                }
+                if (m_errno != SA_AIS_OK) {
+                      LOG_NO("%s: saImmOmCcbObjectDelete '%s' Fail %s",
+                      __FUNCTION__, nodeGroupName_s.c_str(),
+                      saf_error(m_errno));
+                      rc = false;
+                      break;
+                } else {
+                        m_errno = saImmOmCcbApply(m_ccbHandle);
+                        if (m_errno != SA_AIS_OK) {
+                        LOG_NO("%s: saImmOmCcbApply() Fail '%s'",
+                              __FUNCTION__, saf_error(m_errno));
+                              rc = false;
+                        }
+                        break;
+                }
+        }
 
        TRACE_LEAVE();
        return rc;
@@ -3633,6 +3647,9 @@ bool SmfAdminOperation::nodeGroupAdminOp
                        &nodeGroupName, 0, adminOp, params,
                        &oi_rc, smfd_cb->adminOpTimeout);
 
+                if (m_errno == SA_AIS_OK && oi_rc == SA_AIS_OK)
+                        break;
+
                if (retry <= 0) {
                        LOG_NO("Fail to invoke admin operation, too many OI "
                                "TRY_AGAIN, giving up. %s", __FUNCTION__);

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

Reply via email to