Hi Hung,
update the comment, while pushing.
Thanks,
Neel.
On 2017/01/04 01:38 PM, Hung Nguyen wrote:
> Hi Neel,
>
> Reviewed and tested the patch.
> Ack with a minor comment:
>
> This testcase failed when pbe is enabled.
> root@SC-1:~# immoitest 4 6
>
> Suite 4: Configuration Objects Implementer
> error: in src/imm/apitest/implementer/test_SaImmOiCcb.c at 160:
> SA_AIS_ERR_FAILED_OPERATION (21), expected SA_AIS_OK (1) - exiting
>
>
>
> In immnd_evt_proc_ccb_compl_rsp(), it should be
> 'evt->info.ccbUpcallRsp.ccbId' instead of 'evt->info.ccbId'
>
> if(cb->mPbeDisableCcbId == evt->info.ccbId){
> TRACE(" Disable of PBE is sent to PBE for ACK, in ccb:%u",
> evt->info.ccbId);
> cb->mPbeDisableCritical = true;
> }
>
> BR,
> Hung Nguyen - DEK Technologies
>
> --------------------------------------------------------------------------------
> From: Neelakanta [email protected]
> Sent: Friday, December 30, 2016 2:02PM
> To: Hung Nguyen, Zoran Milinkovic
> [email protected],[email protected]
> Cc: Opensaf-devel
> [email protected]
> Subject: [PATCH 1 of 1] imm: return TRY_AGAIN when RepositoryInit mode is
> chaged to file, during the CCB PBE di^Cble processing [#2229] V2
>
>
> osaf/services/saf/immsv/immnd/ImmModel.cc | 29
> ++++++++++++++++++++++++-----
> osaf/services/saf/immsv/immnd/ImmModel.hh | 6 ++++--
> osaf/services/saf/immsv/immnd/immnd_cb.h | 3 +++
> osaf/services/saf/immsv/immnd/immnd_evt.c | 23 +++++++++++++++++++++++
> 4 files changed, 54 insertions(+), 7 deletions(-)
>
>
> TRY_AGAIN will be returned to the ccbApply when the saImmRepositoryInit is
> changed from
> SA_IMM_KEEP_REPOSITORY to SA_IMM_INIT_FROM_FILE. The duration of the
> TRY_AGAIN is from
> the time ccb upcall is sent to PBE to receiving ACK from the PBE for the
> repository change CCB
>
> 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
> @@ -962,14 +962,19 @@ immModel_ccbObjectModify(IMMND_CB *cb,
> {
> std::string objectName;
> bool pbeFile = (cb->mPbeFile != NULL);
> + bool changeRim = false;
> SaAisErrorT err = ImmModel::instance(&cb->immModel)->
> ccbObjectModify(req, implConn, implNodeId, continuationId,
> - pbeConn, pbeNodeId, objectName, hasLongDns, pbeFile);
> + pbeConn, pbeNodeId, objectName, hasLongDns, pbeFile, &changeRim);
>
> if(err == SA_AIS_OK) {
> osaf_extended_name_alloc(objectName.c_str(), objName);
> }
>
> + if (err == SA_AIS_OK && changeRim){
> + cb->mPbeDisableCcbId = req->ccbId;
> + TRACE("The mPbeDisableCcbId is set to ccbid:%u", cb->mPbeDisableCcbId);
> + }
> return err;
> }
>
> @@ -1361,6 +1366,12 @@ immModel_ccbAbort(IMMND_CB *cb,
> unsigned int ix=0;
>
> bool aborted = ImmModel::instance(&cb->immModel)->ccbAbort(ccbId, cv,
> cl, nodeId, pbeNodeId);
> +
> + if ( aborted && (cb->mPbeDisableCcbId == ccbId)){
> + TRACE("PbeDisableCcbId %u has been aborted", ccbId);
> + cb->mPbeDisableCcbId = 0;
> + cb->mPbeDisableCritical = false;
> + }
>
> *arrSize = (SaUint32T) cv.size();
> if(*arrSize) {
> @@ -1530,7 +1541,7 @@ immModel_ccbWaitForCompletedAck(IMMND_CB
> SaUint32T* pbeCtn)
> {
> return ImmModel::instance(&cb->immModel)->
> - ccbWaitForCompletedAck(ccbId, err, pbeConn, pbeNodeId, pbeId,
> pbeCtn);
> + ccbWaitForCompletedAck(ccbId, err, pbeConn, pbeNodeId, pbeId,
> pbeCtn, cb->mPbeDisableCritical);
> }
>
> bool
> @@ -8860,7 +8871,8 @@ ImmModel::ccbObjectModify(const ImmsvOmC
> unsigned int* pbeNodeIdPtr,
> std::string& objectName,
> bool* hasLongDns,
> - bool pbeFile)
> + bool pbeFile,
> + bool * changeRim)
> {
> TRACE_ENTER();
> osafassert(hasLongDns);
> @@ -9342,6 +9354,7 @@ ImmModel::ccbObjectModify(const ImmsvOmC
> }
>
> if (modifiedRim) {
> + SaImmRepositoryInitModeT oldRim =
> getRepositoryInitMode();
> SaImmRepositoryInitModeT newRim =
> (SaImmRepositoryInitModeT) attrValue->getValue_int();
> if((newRim != SA_IMM_INIT_FROM_FILE) && (newRim !=
> SA_IMM_KEEP_REPOSITORY)) {
> TRACE_7("ERR_BAD_OPERATION: attr '%s' in IMM object
> %s can not have value %u",
> @@ -9352,6 +9365,11 @@ ImmModel::ccbObjectModify(const ImmsvOmC
> err = SA_AIS_ERR_BAD_OPERATION;
> break;
> }
> +
> + if((oldRim == SA_IMM_KEEP_REPOSITORY) && (newRim ==
> SA_IMM_INIT_FROM_FILE)){
> + LOG_NO("Request for rim change is arrived in ccb%u",
> ccbId);
> + * changeRim = true;
> + }
> }
>
>
> @@ -10680,7 +10698,8 @@ ImmModel::ccbWaitForDeleteImplAck(SaUint
> bool
> ImmModel::ccbWaitForCompletedAck(SaUint32T ccbId, SaAisErrorT* err,
> SaUint32T* pbeConnPtr, unsigned int*
> pbeNodeIdPtr,
> - SaUint32T* pbeIdPtr, SaUint32T* pbeCtnPtr)
> + SaUint32T* pbeIdPtr, SaUint32T* pbeCtnPtr,
> + bool mPbeDisableCritical)
> {
> TRACE_ENTER();
> if(pbeNodeIdPtr) {
> @@ -10768,7 +10787,7 @@ ImmModel::ccbWaitForCompletedAck(SaUint3
> if(((*err) == SA_AIS_OK) && pbeNodeIdPtr) {
> /* There should be a PBE */
> ImplementerInfo* pbeImpl = (ImplementerInfo *) getPbeOi(pbeConnPtr,
> pbeNodeIdPtr);
> - if(pbeImpl) {
> + if(pbeImpl && !mPbeDisableCritical) {
> /* There is in fact a PBE (up) */
> osafassert(ccb->mState == IMM_CCB_PREPARE);
> LOG_IN("GOING FROM IMM_CCB_PREPARE to IMM_CCB_CRITICAL Ccb:%u",
> ccbId);
> 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
> @@ -254,7 +254,8 @@ public:
> unsigned int* pbeNodeId,
> std::string& objectName,
> bool* hasLongDns,
> - bool pbeFile);
> + bool pbeFile,
> + bool* changeRim);
>
> SaAisErrorT ccbObjectDelete(
> const ImmsvOmCcbObjectDelete* req,
> @@ -303,7 +304,8 @@ public:
> SaUint32T* pbeConn,
> unsigned int* pbeNodeId,
> SaUint32T* pbeId,
> - SaUint32T* pbeCtn);
> + SaUint32T* pbeCtn,
> + bool mPbeDisableCritical);
>
> void ccbObjDelContinuation(
> immsv_oi_ccb_upcall_rsp* rsp,
> diff --git a/osaf/services/saf/immsv/immnd/immnd_cb.h
> b/osaf/services/saf/immsv/immnd/immnd_cb.h
> --- a/osaf/services/saf/immsv/immnd/immnd_cb.h
> +++ b/osaf/services/saf/immsv/immnd/immnd_cb.h
> @@ -129,6 +129,9 @@ typedef struct immnd_cb_tag {
> uint8_t mBlockPbeEnable; //Current PBE has not completed shutdown yet.
> uint8_t mPbeKills; //If != 0 then immnd has tried to kill Pbe.
> uint8_t m2Pbe; //If!=0 => 2PBE, 2 => fetch PBE file info.
> + SaUint32T mPbeDisableCcbId; // CcbId, operation of the Disable PBE.
> + bool mPbeDisableCritical; //If true then PBE disable is sent to PBE for
> ACK.
> +
> bool mIsOtherScUp; //If set & this is an SC then other SC is up(2pbe).
> //False=> *allow* 1safe 2pbe. May err conservatively (true)
> bool mForceClean; //true => Force cleanTheHouse to run once *now*.
> 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
> @@ -3323,6 +3323,11 @@ static SaAisErrorT immnd_fevs_local_chec
> }
> /* intentional fallthrough. */
> case IMMND_EVT_A2ND_CCB_APPLY:
> + if(cb->mPbeDisableCritical){
> + LOG_WA("ERR_TRY_AGAIN: Disable of PBE has been
> initiated, waiting for the reply from the PBE");
> + error = SA_AIS_ERR_TRY_AGAIN;
> + break;
> + }
> if(immModel_pbeNotWritable(cb) || (cb->fevs_replies_pending >=
> IMMSV_DEFAULT_FEVS_MAX_PENDING)
> || !immnd_is_immd_up(cb)) {
> /* NO_RESOURCES is here imm internal proxy for
> TRY_AGAIN.
> @@ -4012,6 +4017,10 @@ static void immnd_evt_proc_ccb_compl_rsp
> evt->info.ccbUpcallRsp.ccbId);
> }
> }
> + if(cb->mPbeDisableCcbId == evt->info.ccbId){
> + TRACE(" Disable of PBE is sent to PBE for ACK,
> in ccb:%u", evt->info.ccbId);
> + cb->mPbeDisableCritical = true;
> + }
> skip_send:
> reqConn = 0; /* Ensure we dont reply to OM client yet.
> */
> }
> @@ -4063,6 +4072,9 @@ static void immnd_evt_proc_ccb_compl_rsp
> SaUint32T arrSize = 0;
>
> if(immModel_ccbCommit(cb, evt->info.ccbUpcallRsp.ccbId,
> &arrSize, &implConnArr)) {
> + osafassert(cb->mPbeDisableCcbId ==
> evt->info.ccbUpcallRsp.ccbId);
> + cb->mPbeDisableCcbId = 0;
> + cb->mPbeDisableCritical = false;
> SaImmRepositoryInitModeT oldRim = cb->mRim;
> cb->mRim = immModel_getRepositoryInitMode(cb);
> if(oldRim != cb->mRim) {
> @@ -7792,6 +7804,13 @@ static void immnd_evt_proc_ccb_apply(IMM
> abort();
> }
> #endif
> + if(cb->mPbeDisableCritical && !validateOnly){
> + LOG_WA("Disable of PBE has been initiated, waiting for the
> reply from the PBE");
> + err = SA_AIS_ERR_TRY_AGAIN;
> + goto immediate_reply;
> + }
> +
> +
> if(cb->mPbeFile && (cb->mRim == SA_IMM_KEEP_REPOSITORY)) {
> if(immModel_pbeNotWritable(cb)) {
> /* NO_RESOURCES is here imm internal proxy for
> TRY_AGAIN.
> @@ -7912,6 +7931,10 @@ static void immnd_evt_proc_ccb_apply(IMM
> evt->info.ccbId);
> }
> }
> + if(cb->mPbeDisableCcbId == evt->info.ccbId){
> + TRACE(" Disable of PBE is sent to PBE
> for ACK, in ccb:%u", evt->info.ccbId);
> + cb->mPbeDisableCritical = true;
> + }
> }
> } else {
> TRACE_2("NO IMPLEMENTERS AT ALL AND NO PBE. for ccb:%u
> err:%u sz:%u", evt->info.ccbId, err, arrSize);
>
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel