src/smf/smfd/SmfImmOperation.cc |  22 +++++++++++++++++++++-
 src/smf/smfd/SmfUpgradeStep.cc  |  23 +++++++++++++++++++++--
 2 files changed, 42 insertions(+), 3 deletions(-)


Create a campaign containing several single step procedures that install
several bundles. If the procedures are on the same saSmfExecLevel the campaign
will sometimes fail because of conflicting admin owner on IMM object.

trace message:
SmfImmCreateOperation::execute:saImmOmAdminOwnerSet failed SA_AIS_ERR_EXIST

diff --git a/src/smf/smfd/SmfImmOperation.cc b/src/smf/smfd/SmfImmOperation.cc
--- a/src/smf/smfd/SmfImmOperation.cc
+++ b/src/smf/smfd/SmfImmOperation.cc
@@ -34,6 +34,7 @@
 #include "imm/saf/saImm.h"
 #include "base/saf_error.h"
 #include "base/osaf_extended_name.h"
+#include "base/osaf_time.h"
 #include "smf/smfd/smfd_long_dn.h"
 
 /* ========================================================================
@@ -440,7 +441,26 @@ SmfImmCreateOperation::execute(SmfRollba
                const SaNameT *objectNames[2];
                objectNames[0] = &objectName;
                objectNames[1] = NULL;
-               result = immutil_saImmOmAdminOwnerSet(m_immOwnerHandle, 
objectNames, SA_IMM_ONE);
+
+                // We are taking admin owner on the parent DN of this object.
+                // This can be conflicting with other threads which also want
+                // to create objects. Specifically SmfUpgradeStep takes admin
+                // owner when creating node groups. Retry if object has admin
+                // owner already.
+                int timeout_try_cnt = 6;
+                while (timeout_try_cnt > 0) {
+                        TRACE("%s: calling adminOwnerSet", __FUNCTION__);
+                        result = immutil_saImmOmAdminOwnerSet(m_immOwnerHandle,
+                                                              objectNames,
+                                                              SA_IMM_ONE);
+                        if (result != SA_AIS_ERR_EXIST)
+                                break;
+
+                        timeout_try_cnt--;
+                        TRACE("%s: adminOwnerSet returned SA_AIS_ERR_EXIST, " +
+                              "sleep 1 second and retry", __FUNCTION__);
+                        osaf_nanosleep(&kOneSecond);
+                }
                if (result != SA_AIS_OK) {
                        
TRACE("SmfImmCreateOperation::execute:saImmOmAdminOwnerSet failed %s\n", 
saf_error(result));
                         TRACE_LEAVE();
diff --git a/src/smf/smfd/SmfUpgradeStep.cc b/src/smf/smfd/SmfUpgradeStep.cc
--- a/src/smf/smfd/SmfUpgradeStep.cc
+++ b/src/smf/smfd/SmfUpgradeStep.cc
@@ -3172,8 +3172,27 @@ bool SmfAdminOperation::becomeAdminOwner
        SaNameT nodeGroupParentDn;
        saAisNameLend(m_nodeGroupParentDn.c_str(), &nodeGroupParentDn);
        const SaNameT *objectNames[2] = {&nodeGroupParentDn, NULL};
-       SaAisErrorT ais_rc = immutil_saImmOmAdminOwnerSet(m_ownerHandle,
-                                               objectNames, SA_IMM_SUBTREE);
+
+        // We are taking admin owner on the parent DN of this object. This can
+        // be conflicting with other threads which also want to create objects.
+        // Specifically SmfImmOperation takes admin owner when creating IMM
+        // objects. Retry if object has admin owner already.
+        int timeout_try_cnt = 6;
+        SaAisErrorT ais_rc = SA_AIS_OK;
+        while (timeout_try_cnt > 0) {
+                TRACE("%s: calling adminOwnerSet", __FUNCTION__);
+                ais_rc = immutil_saImmOmAdminOwnerSet(m_ownerHandle,
+                                                      objectNames,
+                                                      SA_IMM_SUBTREE);
+                if (ais_rc != SA_AIS_ERR_EXIST)
+                        break;
+
+                timeout_try_cnt--;
+                TRACE("%s: adminOwnerSet returned SA_AIS_ERR_EXIST, " +
+                      "sleep 1 second and retry", __FUNCTION__);
+                osaf_nanosleep(&kOneSecond);
+        }
+
        bool rc = true;
        if (ais_rc != SA_AIS_OK) {
                LOG_NO("%s: saImmOmAdminOwnerSet owner name '%s' Fail '%s'",

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