osaf/services/saf/immsv/immnd/ImmModel.cc        |   43 ++++-
 osaf/services/saf/immsv/immnd/ImmModel.hh        |    3 +-
 osaf/services/saf/immsv/immnd/immnd_evt.c        |   57 +++++-
 osaf/services/saf/immsv/immnd/immnd_init.h       |    2 +-
 osaf/services/saf/immsv/immpbed/immpbe_daemon.cc |  196 +++++++++++-----------
 5 files changed, 191 insertions(+), 110 deletions(-)


This is a testpatch containing a test version of the 2PBE handling of
updates of persistent runtime attributes (PRTAs). PRTAs can exist in
either PRTOs or config objects.
This patch will not be pushed. The intent with this patch is to allow
testing and obtaining feedback on the 2PBE handling of PRTA updates
This test-patch goes on top of the "2PBE PRTO-delete" testpatch.

diff --git a/osaf/services/saf/immsv/immnd/ImmModel.cc 
b/osaf/services/saf/immsv/immnd/ImmModel.cc
--- a/osaf/services/saf/immsv/immnd/ImmModel.cc
+++ b/osaf/services/saf/immsv/immnd/ImmModel.cc
@@ -1704,7 +1704,8 @@ immModel_rtObjectUpdate(IMMND_CB *cb,
     SaUint32T *continuationId,
     SaUint32T *pbeConn,
     SaClmNodeIdT *pbeNodeId,
-    SaUint32T *spApplConn)
+    SaUint32T *spApplConn,
+    SaUint32T *pbe2BConn)
 {
     SaAisErrorT err = SA_AIS_OK;
     TRACE_ENTER();
@@ -1712,7 +1713,7 @@ immModel_rtObjectUpdate(IMMND_CB *cb,
     TRACE_5("on enter isPl:%u", isPl);
     err =  ImmModel::instance(&cb->immModel)->
         rtObjectUpdate(req, implConn, (unsigned int) implNodeId, &isPl,
-            continuationId, pbeConn, pbeNodeId, spApplConn);
+            continuationId, pbeConn, pbeNodeId, spApplConn, pbe2BConn);
     TRACE_5("on leave isPl:%u", isPl);
     *isPureLocal = isPl;
     TRACE_LEAVE();
@@ -8850,6 +8851,9 @@ SaAisErrorT ImmModel::adminOperationInvo
                 err = (iem != sImplDetachTime.end())?
                     SA_AIS_ERR_TRY_AGAIN:SA_AIS_ERR_NOT_EXIST;
 
+                if(reqConn) {
+                    fetchAdmReqContinuation(saInv, &reqConn);/* Remove any 
request cont. */
+                }
                 *implConn = 0;
             } else {
                 if(object->mImplementer->mAdminOpBusy) {
@@ -8882,7 +8886,7 @@ SaAisErrorT ImmModel::adminOperationInvo
                (iem = sImplDetachTime.find(object->mImplementer)) != 
sImplDetachTime.end()) {
                    err = SA_AIS_ERR_TRY_AGAIN;
             } else {
-                TRACE_7("ERR_NOT_EXIST: object '%s' does not have an 
implementer", 
+                TRACE_7("ERR_NOT_EXIST: object '%s' does not have an 
implementer",
                     objectName.c_str());
                 err = SA_AIS_ERR_NOT_EXIST;
             }
@@ -12034,7 +12038,7 @@ void ImmModel::pbePrtObjCreateContinuati
         if(error == SA_AIS_OK) {
             TRACE("pbePrtObjCreateContinuation: All PBEs have responded with 
OK");
         }
-        /* If any of hte PBEs reply with error, then the PRTO create is 
aborted.
+        /* If any of the PBEs reply with error, then the PRTO create is 
aborted.
            and this contiuation removed. 
         */
     }
@@ -12166,7 +12170,7 @@ void ImmModel::pbePrtObjDeletesContinuat
             if(error == SA_AIS_OK) {
                 TRACE("pbePrtObjDeletesContinuation: All PBEs have responded 
with OK");
             }
-            /* If any of hte PBEs reply with error, then the PRTO delete is 
aborted.
+            /* If any of the PBEs reply with error, then the PRTO delete is 
aborted.
                and this contiuation removed. 
             */
         }
@@ -12285,8 +12289,22 @@ void ImmModel::pbePrtAttrUpdateContinuat
 
     ObjectMutation* oMut = i2->second;
     std::string objName(i2->first);
-
     osafassert(oMut->mOpType == IMM_MODIFY);
+
+    if(oMut->m2PbeCount) {
+        oMut->m2PbeCount--;
+        if(oMut->m2PbeCount && error == SA_AIS_OK) {
+            TRACE("pbePrtObjUpdateContinuation Wait for reply from other PBE");
+            return;
+        }
+        if(error == SA_AIS_OK) {
+            TRACE("pbePrtObjUpdateContinuation: All PBEs have responded with 
OK");
+        }
+        /* If any of the PBEs reply with error, then the PRTO create is 
aborted.
+           and this contiuation removed. 
+        */
+    }
+
     ObjectInfo *afim =  oMut->mAfterImage;
     osafassert(afim);
 
@@ -12547,7 +12565,9 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
     SaUint32T* continuationIdPtr,
     SaUint32T* pbeConnPtr,
     unsigned int* pbeNodeIdPtr,
-    SaUint32T *spApplConnPtr)
+    SaUint32T *spApplConnPtr,
+    SaUint32T* pbe2BConnPtr)
+
 {
     TRACE_ENTER2("cont:%p connp:%p nodep:%p", continuationIdPtr, pbeConnPtr, 
pbeNodeIdPtr);
     SaAisErrorT err = SA_AIS_OK;
@@ -12669,12 +12689,14 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
     for(int doIt=0; (doIt < 2) && (err == SA_AIS_OK); ++doIt) {
         TRACE_5("update rt attributes doit: %u", doIt);
         void* pbe = NULL;
+       void* pbe2B = NULL;
         ImmAttrValueMap::iterator oavi;
         if(doIt && pbeNodeIdPtr && isPersistent && !wasLocal)
         {
             ObjectInfo* afim = 0;
             ImmAttrValueMap::iterator oavi;
             ObjectMutation* oMut = 0;
+            unsigned int slaveNodeId=0;
 
             TRACE("PRT ATTRs UPDATE case, defer updates of cached attrs, until 
ACK from PBE");
             /* 
@@ -12698,6 +12720,12 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
                    TRY_AGAIN.
                 */
             }
+
+            pbe2B = getPbeBSlave(pbe2BConnPtr, &slaveNodeId);
+
+            /* If 2PBE then not both PBEs on same processor. */
+            osafassert(!((*pbeConnPtr) && (*pbe2BConnPtr)));
+
             *continuationIdPtr = ++sLastContinuationId;
             if(sLastContinuationId >= 0xfffffffe)
             {sLastContinuationId = 1;}
@@ -12753,6 +12781,7 @@ ImmModel::rtObjectUpdate(const ImmsvOmCc
             oMut = new ObjectMutation(IMM_MODIFY);
             oMut->mAfterImage = afim;
             oMut->mContinuationId = (*continuationIdPtr);
+            oMut->m2PbeCount = pbe2B?2:1;
             sPbeRtMutations[objectName] = oMut;
 
             object = afim; /* Rest of the code below updates the afim and not 
diff --git a/osaf/services/saf/immsv/immnd/ImmModel.hh 
b/osaf/services/saf/immsv/immnd/ImmModel.hh
--- a/osaf/services/saf/immsv/immnd/ImmModel.hh
+++ b/osaf/services/saf/immsv/immnd/ImmModel.hh
@@ -411,7 +411,8 @@ public:
                                        SaUint32T* continuationId,
                                        SaUint32T* pbeConn,
                                        unsigned int* pbeNodeId,
-                                       SaUint32T* specialApplCon);
+                                       SaUint32T* specialApplCon,
+                                      SaUint32T* pbe2BConn);
 
     void                deferRtUpdate(ImmsvOmCcbObjectModify* req, SaUint64T 
msgNo);
     
diff --git a/osaf/services/saf/immsv/immnd/immnd_evt.c 
b/osaf/services/saf/immsv/immnd/immnd_evt.c
--- a/osaf/services/saf/immsv/immnd/immnd_evt.c
+++ b/osaf/services/saf/immsv/immnd/immnd_evt.c
@@ -2516,6 +2516,7 @@ static uint32_t immnd_evt_proc_rt_update
        SaUint32T clientId;
        SaUint32T clientNode;
        SaUint32T dummyPbeConn = 0;
+       SaUint32T dummyPbe2BConn = 0;
        NCS_NODE_ID *dummyPbeNodeIdPtr = NULL;
        SaUint32T dummyContinuationId = 0;
        SaUint32T spApplConn = 0;  /* Special applier locally connected. */
@@ -2566,9 +2567,9 @@ static uint32_t immnd_evt_proc_rt_update
        clientNode = m_IMMSV_UNPACK_HANDLE_LOW(client_hdl);
 
        err = immModel_rtObjectUpdate(cb, &(evt->info.objModify), clientId, 
clientNode, &isPureLocal,
-               &dummyContinuationId, &dummyPbeConn, dummyPbeNodeIdPtr, 
&spApplConn);
-
-       osafassert(!dummyContinuationId && !dummyPbeConn && !spApplConn);/* 
Only relevant for cached (fevs first) */
+               &dummyContinuationId, &dummyPbeConn, dummyPbeNodeIdPtr, 
&spApplConn, &dummyPbe2BConn);
+
+       osafassert(!dummyContinuationId && !dummyPbeConn && !spApplConn && 
!dummyPbe2BConn);/* Only relevant for cached (fevs first) */
 
        if (!isPureLocal && (err == SA_AIS_OK)) {
                TRACE_2("immnd_evt_proc_rt_update was not pure local, i.e. 
cached RT attrs");
@@ -5187,7 +5188,7 @@ static void immnd_evt_proc_object_sync(I
                                LOG_IN("Applying deferred RTA update for object 
%s",
                                        objModify.objectName.buf);
                                err = immModel_rtObjectUpdate(cb, &objModify, 
0, 0, &isLocal,
-                                       NULL, NULL, NULL, NULL);
+                                       NULL, NULL, NULL, NULL, NULL);
                                //free(objModify.objectName.buf);
                                immsv_free_attrmods(objModify.attrMods);
                                memset(&objModify, '\0', 
sizeof(IMMSV_OM_CCB_OBJECT_MODIFY));
@@ -5904,6 +5905,7 @@ static void immnd_evt_proc_rt_object_mod
        SaUint32T nodeId = m_IMMSV_UNPACK_HANDLE_LOW(clnt_hdl);
        SaBoolT delayedReply = SA_FALSE;
        SaUint32T pbeConn = 0;
+       SaUint32T pbe2BConn = 0;
        NCS_NODE_ID pbeNodeId = 0;
        NCS_NODE_ID *pbeNodeIdPtr = NULL;
        SaUint32T continuationId = 0;
@@ -5939,7 +5941,7 @@ static void immnd_evt_proc_rt_object_mod
 
        if (originatedAtThisNd) {
                err = immModel_rtObjectUpdate(cb, &(evt->info.objModify), 
reqConn, nodeId, &isLocal,
-                       &continuationId, &pbeConn, pbeNodeIdPtr, &spApplConn);
+                       &continuationId, &pbeConn, pbeNodeIdPtr, &spApplConn, 
&pbe2BConn);
                if(err != SA_AIS_OK) {
                        LOG_WA("Got error on non local rt object update err: 
%u", err);
                        if(cb->mIsCoord && immModel_immNotWritable(cb) && 
@@ -5969,7 +5971,7 @@ static void immnd_evt_proc_rt_object_mod
                }
        } else {
                err = immModel_rtObjectUpdate(cb, &(evt->info.objModify), 0, 
nodeId, &isLocal,
-                       &continuationId, &pbeConn, pbeNodeIdPtr, &spApplConn);
+                       &continuationId, &pbeConn, pbeNodeIdPtr, &spApplConn, 
&pbe2BConn);
                if(err == SA_AIS_ERR_REPAIR_PENDING) {
                        /* This is the special case of an rtObjectUpdate 
arriving over fevs
                           at a node that is being synced. If the object has 
been synced when
@@ -6000,6 +6002,7 @@ static void immnd_evt_proc_rt_object_mod
                delayedReply = SA_TRUE; 
                if(pbeConn) {
                        /*The persistent back-end is executing at THIS node. */
+                       osafassert(!pbe2BConn);
                        osafassert(cb->mIsCoord);
                        osafassert(pbeNodeId);
                        osafassert(pbeNodeId == cb->node_id);
@@ -6041,6 +6044,48 @@ static void immnd_evt_proc_rt_object_mod
                        }
                        implHandle = 0LL;
                        pbe_cl_node = NULL;
+               } else if(pbe2BConn) {
+                       TRACE("PBE SLAVE is executing at THIS node");
+                       osafassert(!(cb->mIsCoord));
+                       osafassert(pbeNodeId != cb->node_id);
+                       implHandle = m_IMMSV_PACK_HANDLE(pbe2BConn, 
cb->node_id);
+
+                       /*Fetch client node for PBE */
+                       immnd_client_node_get(cb, implHandle, &pbe_cl_node);
+                       osafassert(pbe_cl_node);
+                       if (pbe_cl_node->mIsStale) {
+                               LOG_WA("SLAVE PBE is down => persistify of 
rtAttr is aborted!");
+                               /* ****
+                                  TODO: send a fevs faked reply from PBE 
indicating
+                                  failure to update. This will rollback the 
rtObjCreate.
+                                  Currently it should get cleaned up by 
cleanTheBasement,
+                                  but that will typically lead to ERR_TIMEOUT 
for the 
+                                  OI client.
+                               */
+                       } else {
+                               memset(&send_evt, '\0', sizeof(IMMSV_EVT));
+                               send_evt.type = IMMSV_EVT_TYPE_IMMA;
+                               send_evt.info.imma.type = 
IMMA_EVT_ND2A_OI_OBJ_MODIFY_UC;
+                               send_evt.info.imma.info.objModify = 
evt->info.objModify;
+                               send_evt.info.imma.info.objModify.adminOwnerId 
= 
+                                       continuationId;
+                               /*We re-use the adminOwner member of the 
ccbmodify message
+                                 to hold the continuation id. */
+                               send_evt.info.imma.info.objModify.immHandle = 
implHandle;
+                               osafassert(evt->info.objModify.ccbId == 0);
+
+                               TRACE_2("MAKING PBE-IMPLEMENTER PERSISTENT 
RT-OBJ MODIFY upcall");
+                               if (immnd_mds_msg_send(cb, 
NCSMDS_SVC_ID_IMMA_OI,
+                                           pbe_cl_node->agent_mds_dest, 
&send_evt) != 
+                                       NCSCC_RC_SUCCESS) 
+                               {
+                                       LOG_WA("Upcall over MDS for persistent 
rt attr update "
+                                               "to PBE failed!");
+                                       /* See comment **** above. */
+                               }
+                       }
+                       implHandle = 0LL;
+                       pbe_cl_node = NULL;
                }
 
                if(spApplConn) {
diff --git a/osaf/services/saf/immsv/immnd/immnd_init.h 
b/osaf/services/saf/immsv/immnd/immnd_init.h
--- a/osaf/services/saf/immsv/immnd/immnd_init.h
+++ b/osaf/services/saf/immsv/immnd/immnd_init.h
@@ -373,7 +373,7 @@ extern "C" {
                    const struct ImmsvOmCcbObjectModify *req,
                    SaUint32T implConn, SaClmNodeIdT implNodeId, 
                    unsigned int *isPureLocal, SaUint32T *continuationId, 
SaUint32T *pbeConn,
-                   SaClmNodeIdT *pbeNodeId, SaUint32T *spAplConn);
+                   SaClmNodeIdT *pbeNodeId, SaUint32T *spAplConn, SaUint32T 
*pbe2BConn);
 
        SaAisErrorT immModel_ccbResult(IMMND_CB *cb, SaUint32T ccbId);
 
diff --git a/osaf/services/saf/immsv/immpbed/immpbe_daemon.cc 
b/osaf/services/saf/immsv/immpbed/immpbe_daemon.cc
--- a/osaf/services/saf/immsv/immpbed/immpbe_daemon.cc
+++ b/osaf/services/saf/immsv/immpbed/immpbe_daemon.cc
@@ -679,9 +679,9 @@ static SaAisErrorT saImmOiCcbObjectModif
                const SaImmAttrModificationT_2 *attMod = NULL;
                int ix=0;
                std::string objName;
-               operation = ccbutil_getNextCcbOp(0, NULL);
+               operation = ccbutil_getNextCcbOp(ccbId, NULL);
                if(operation == NULL) {
-                       LOG_ER("ccbutil_getNextCcbOp(0, NULL) returned NULL");
+                       LOG_ER("ccbutil_getNextCcbOp(%llu, NULL) returned 
NULL", ccbId);
                        rc = SA_AIS_ERR_BAD_OPERATION;
                        goto done;
                }
@@ -1363,17 +1363,6 @@ SaAisErrorT pbe_daemon_imm_init(SaImmHan
                return rc;
        }
 
-       rc = saImmOiInitialize_2(&pbeOiRtHandle, &rtCallbacks, &immVersion);
-       while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms)) {
-               usleep(sleep_delay_ms * 1000);
-               msecs_waited += sleep_delay_ms;
-               rc = saImmOiInitialize_2(&pbeOiRtHandle, &rtCallbacks, 
&immVersion);
-       }
-       if (rc != SA_AIS_OK) {
-               LOG_ER("saImmOiInitialize_2 failed for RtHandle: %u", rc);
-               return rc;
-       }
-
        if(sPbe2B) {
                /* Second PBE (applier) */
                pbeImplName.append((char *) OPENSAF_IMM_2PBE_APPL_NAME);
@@ -1397,79 +1386,101 @@ SaAisErrorT pbe_daemon_imm_init(SaImmHan
                return rc;
        }
 
-       rc = saImmOiImplementerSet(pbeOiRtHandle, (char *) 
pbeRtImplName.c_str());
-       msecs_waited = 0;
-       while ((rc == SA_AIS_ERR_TRY_AGAIN || rc == SA_AIS_ERR_EXIST) && 
-               (msecs_waited < max_waiting_time_ms)) {
-               usleep(sleep_delay_ms * 1000);
-               msecs_waited += sleep_delay_ms;
-               rc = saImmOiImplementerSet(pbeOiRtHandle,  (char *) 
pbeRtImplName.c_str());
-       }
-       if (rc != SA_AIS_OK) {
-               LOG_ER("saImmOiImplementerSet for %s failed %u", 
pbeRtImplName.c_str(), rc);
-               return rc;
+       if(sPbe2) {
+               rc = saImmOiInitialize_2(&pbeOiRtHandle, &rtCallbacks, 
&immVersion);
+               while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms)) {
+                       usleep(sleep_delay_ms * 1000);
+                       msecs_waited += sleep_delay_ms;
+                       rc = saImmOiInitialize_2(&pbeOiRtHandle, &rtCallbacks, 
&immVersion);
+               }
+               if (rc != SA_AIS_OK) {
+                       LOG_ER("saImmOiInitialize_2 failed for RtHandle: %u", 
rc);
+                       return rc;
+               }
+
+               rc = saImmOiImplementerSet(pbeOiRtHandle, (char *) 
pbeRtImplName.c_str());
+               msecs_waited = 0;
+               while ((rc == SA_AIS_ERR_TRY_AGAIN || rc == SA_AIS_ERR_EXIST) 
&& 
+                       (msecs_waited < max_waiting_time_ms)) {
+                       usleep(sleep_delay_ms * 1000);
+                       msecs_waited += sleep_delay_ms;
+                       rc = saImmOiImplementerSet(pbeOiRtHandle,  (char *) 
pbeRtImplName.c_str());
+               }
+               if (rc != SA_AIS_OK) {
+                       LOG_ER("saImmOiImplementerSet for %s failed %u", 
pbeRtImplName.c_str(), rc);
+                       return rc;
+               }
+
+               rc = saImmOiSelectionObjectGet(pbeOiRtHandle, 
&immOiRtSelectionObject);
+               /* SelectionObjectGet is library local, no need for retry loop 
*/
+               if (rc != SA_AIS_OK) {
+                       LOG_ER("saImmOiSelectionObjectGet failed for RT %u", 
rc);
+                       return rc;
+               }
+
+               msecs_waited = 0;
+               do {
+                       rc = saImmOiRtObjectCreate_2(pbeOiRtHandle,
+                               (SaImmClassNameT) 
OPENSAF_IMM_PBE_RT_CLASS_NAME, &myParent, attrValues);
+                       LOG_NO("RTO create returned %u", rc);
+                       if(rc == SA_AIS_ERR_EXIST) {rc = SA_AIS_OK;}
+
+                       /* Set admin owner on the RTO just created. */
+                       if(rc == SA_AIS_OK) {
+                               rc = saImmOmAdminOwnerSet(sOwnerHandle, 
admOwnNames, SA_IMM_ONE);
+                               LOG_NO("AdminOwnerSet returned %u", rc); 
+                       }
+                       if(rc == SA_AIS_ERR_TRY_AGAIN) {
+                               usleep(sleep_delay_ms * 1000);
+                               msecs_waited += sleep_delay_ms;
+                       }
+               } while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms*12)); /* 60 secs */
+
+               if(sPbe2B) {
+                       /* Set slave PBE as class applier for ALL config 
classes. */
+                       for(ci=sClassIdMap->begin(); 
ci!=sClassIdMap->end();++ci) {
+                               if((ci)->second->mClassId > sClassCount) {
+                                       sClassCount = (ci)->second->mClassId;
+                               }
+
+                               /* classCategory should really also be in 
sClassIdMap */
+                               rc = saImmOmClassDescriptionGet_2(immHandle,
+                                       (char*)(ci)->first.c_str(),
+                                       &classCategory,
+                                       &attrDefinitions);
+                               /* PBE should never get TRY_AGAIN from 
saImmOmClassDescriptionGet. */
+                               if (rc != SA_AIS_OK)    {
+                                       LOG_ER("Failed to get the description 
for the %s class error:%u",
+                                               (char*)(ci)->first.c_str(), rc);
+                                       return rc;
+                               }
+
+                               rc = 
saImmOmClassDescriptionMemoryFree_2(immHandle, attrDefinitions);
+                               osafassert(rc == SA_AIS_OK);
+
+                               if(classCategory == SA_IMM_CLASS_RUNTIME) 
{continue;} /* with next class */
+
+                               osafassert(classCategory == 
SA_IMM_CLASS_CONFIG);
+
+                               rc = saImmOiClassImplementerSet(pbeOiHandle, 
(char *) (ci)->first.c_str());
+                               msecs_waited = 0;
+                               while ((rc == SA_AIS_ERR_TRY_AGAIN) && 
(msecs_waited < max_waiting_time_ms)) {
+                                       usleep(sleep_delay_ms * 1000);
+                                       msecs_waited += sleep_delay_ms; 
+                                       rc = 
saImmOiClassImplementerSet(pbeOiHandle, (char *) (ci)->first.c_str());
+                               }
+
+                               if (rc != SA_AIS_OK) {
+                                       LOG_ER("saImmOiClassImplementerSet for 
%s failed %u", 
+                                               (char *) (ci)->first.c_str(), 
rc);
+                                       return rc;
+                               }
+                               LOG_NO("saImmOiClassImplementerSet for %s 
succeeded", (char *) (ci)->first.c_str());
+                       }
+               }
        }
 
-       msecs_waited = 0;
-       do {
-               rc = saImmOiRtObjectCreate_2(pbeOiRtHandle,
-                       (SaImmClassNameT) OPENSAF_IMM_PBE_RT_CLASS_NAME, 
&myParent, attrValues);
-               LOG_NO("RTO create returned %u", rc);
-               if(rc == SA_AIS_ERR_EXIST) {rc = SA_AIS_OK;}
-
-               /* Set admin owner on the RTO just created. */
-               if(rc == SA_AIS_OK) {
-                       rc = saImmOmAdminOwnerSet(sOwnerHandle, admOwnNames, 
SA_IMM_ONE);
-                       LOG_NO("AdminOwnerSet returned %u", rc); 
-               }
-               if(rc == SA_AIS_ERR_TRY_AGAIN) {
-                       usleep(sleep_delay_ms * 1000);
-                       msecs_waited += sleep_delay_ms;
-               }
-       } while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms*12)); /* 60 secs */
-
-       if(sPbe2B) {
-               /* Set slave PBE as class applier for ALL config classes. */
-               for(ci=sClassIdMap->begin(); ci!=sClassIdMap->end();++ci) {
-                       if((ci)->second->mClassId > sClassCount) {
-                               sClassCount = (ci)->second->mClassId;
-                       }
-
-                       /* classCategory should really also be in sClassIdMap */
-                       rc = saImmOmClassDescriptionGet_2(immHandle,
-                               (char*)(ci)->first.c_str(),
-                               &classCategory,
-                               &attrDefinitions);
-                       /* PBE should never get TRY_AGAIN from 
saImmOmClassDescriptionGet. */
-                       if (rc != SA_AIS_OK)    {
-                               LOG_ER("Failed to get the description for the 
%s class error:%u",
-                                       (char*)(ci)->first.c_str(), rc);
-                               return rc;
-                       }
-
-                       rc = saImmOmClassDescriptionMemoryFree_2(immHandle, 
attrDefinitions);
-                       osafassert(rc == SA_AIS_OK);
-
-                       if(classCategory == SA_IMM_CLASS_RUNTIME) {continue;} 
/* with next class */
-
-                       osafassert(classCategory == SA_IMM_CLASS_CONFIG);
-
-                       rc = saImmOiClassImplementerSet(pbeOiHandle, (char *) 
(ci)->first.c_str());
-                       msecs_waited = 0;
-                       while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms)) {
-                               usleep(sleep_delay_ms * 1000);
-                               msecs_waited += sleep_delay_ms; 
-                               rc = saImmOiClassImplementerSet(pbeOiHandle, 
(char *) (ci)->first.c_str());
-                       }
-
-                       if (rc != SA_AIS_OK) {
-                               LOG_ER("saImmOiClassImplementerSet for %s 
failed %u", 
-                                       (char *) (ci)->first.c_str(), rc);
-                               return rc;
-                       }
-                       LOG_NO("saImmOiClassImplementerSet for %s succeeded", 
(char *) (ci)->first.c_str());
-               }
-       } else { /* Not pbe2B i.e. pbe2A or not 2PBE at all. */
+       if(!sPbe2B) {   /* Not pbe2B i.e. pbe2A or not 2PBE at all. */
                rc = saImmOiClassImplementerSet(pbeOiHandle, (char *) 
OPENSAF_IMM_CLASS_NAME);
                msecs_waited = 0;
                while ((rc == SA_AIS_ERR_TRY_AGAIN) && (msecs_waited < 
max_waiting_time_ms)) {
@@ -1491,13 +1502,6 @@ SaAisErrorT pbe_daemon_imm_init(SaImmHan
                return rc;
        }
 
-       rc = saImmOiSelectionObjectGet(pbeOiRtHandle, &immOiRtSelectionObject);
-       /* SelectionObjectGet is library local, no need for retry loop */
-       if (rc != SA_AIS_OK) {
-               LOG_ER("saImmOiSelectionObjectGet failed for RT %u", rc);
-               return rc;
-       }
-
        rc = saImmOmSelectionObjectGet(immHandle, &immOmSelectionObject);
        /* SelectionObjectGet is library local, no need for retry loop */
        if (rc != SA_AIS_OK) {
@@ -1650,11 +1654,13 @@ void pbeDaemon(SaImmHandleT immHandle, v
        fds[FD_IMM_PBE_TERM].fd = term_sel_obj.rmv_obj;
        fds[FD_IMM_PBE_TERM].events = POLLIN;
 
-       /* Set up file descriptors for pbeRtObjThread */
-       rtfds[FD_IMM_PBE_RT_OI].fd = immOiRtSelectionObject;
-       rtfds[FD_IMM_PBE_RT_OI].events = POLLIN;        
+       if(sPbe2) {
+               /* Set up file descriptors for pbeRtObjThread */
+               rtfds[FD_IMM_PBE_RT_OI].fd = immOiRtSelectionObject;
+               rtfds[FD_IMM_PBE_RT_OI].events = POLLIN;        
 
-       pbeRtObjThreadStart();
+               pbeRtObjThreadStart();
+       }
 
        /* This main thread Can be stopped by pbeRtObjThread by it zeroing 
           immOiSelectionObject. That does not affect the fds array since it 

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to