Hi Neel, Good work. Ack from me on this patch with just the following comment.
If you have time ....... We use four spaces (not tab) as indentation in ImmModel.cc There are even some accidental indentation changes, where there is no change except a change of indentation. Such as line 10973 in the patched ImmModel.cc I know this is cosmetic, but it clutters the patch a bit unnecessarily. In any case, if you dont have time to revert indentation in ImmModel.cc then I will do it in the next patch I do to ImmModel.cc. /AndersBj reddy.neelaka...@oracle.com wrote: > osaf/libs/common/immsv/include/immutil.h | 4 + > osaf/services/saf/immsv/immnd/ImmModel.cc | 281 > ++++++++++++++++++++++- > osaf/services/saf/immsv/immnd/ImmModel.hh | 8 +- > osaf/services/saf/immsv/immnd/immnd_evt.c | 57 ++++- > osaf/services/saf/immsv/immnd/immnd_init.h | 7 +- > osaf/services/saf/immsv/immpbed/immpbe_daemon.cc | 57 ++++ > osaf/tools/safimm/immadm/imm_admin.c | 13 +- > osaf/tools/safimm/src/immutil.c | 17 + > samples/immsv/immutils/immutil.c | 17 + > samples/immsv/immutils/immutil.h | 4 + > 10 files changed, 447 insertions(+), 18 deletions(-) > > > The enhancement dumps the IMMsv resource utilization data using IMM Admin > Operation. > The IMM AdminOperation must be directed to immsv object > opensafImm=opensafImm,safApp=safImmService. PBE is implementer > for opensafImm=opensafImm,safApp=safImmService object. The display admin > operation request > reaches PBE and PBE replys with extended adminoperation resut having > adminownername and > resource name as parameters.The enhancement Displays without 0PBE also. > New immutil API immutil_saImmOiAdminOperationResult_o2 is added. > > Presently two types of operationNames for dumping resource utilization is > supported: > > display -- returns the terse output for the requested resource. The number > of requested resource will be returned. The supported resource are > implementers, adminowners, ccbhandles and searchhandels. > > Eg: > > immadm -O display -p resource:SA_STRING_T:implementers > opensafImm=opensafImm,safApp=safImmService > > The output is the number of implementers present: Name > Type Value(s) > ======================================================================== > count SA_INT64_T 9 (0x9) > > displayverbose -- returns the verbose output for the requested resource. The > verbose output is supported for the resources implementers and adminowners. > If the number of resource is greater than 127 then the verbose output is > displayed to syslog. > > Eg: immadm -O displayverbose -p resource:SA_STRING_T:implementers > opensafImm=opensafImm,safApp=safImmService [using admin-owner: > 'safImmService'] Object: opensafImm=opensafImm,safApp=safImmService Name > Type Value(s) > ======================================================================== > safLogService SA_INT64_T 131343 > (0x2010f) safClmService SA_INT64_T > 131343 (0x2010f) safAmfService > SA_INT64_T 131343 (0x2010f) MsgQueueService131343 > SA_INT64_T 131343 (0x2010f) safMsgGrpService > SA_INT64_T 131343 (0x2010f) safCheckPointService > SA_INT64_T 131343 (0x2010f) safEvtService > SA_INT64_T 131343 (0x2010f) safLckService > SA_INT64_T 131343 (0x2010f) safSmfService > SA_INT64_T 131343 (0x2010f) > > If the operationName display-help is used, the return parameters will have > presently supported resources for dumping resource utilization data. > > Eg: immadm -O display-help opensafImm=opensafImm,safApp=safImmService > [using admin-owner: 'safImmService'] Object: > opensafImm=opensafImm,safApp=safImmService Name > Type Value(s) > ======================================================================== > supportedResources SA_STRING_T implementers > supportedResources SA_STRING_T adminowners > supportedResources SA_STRING_T ccbhandles > supportedResources SA_STRING_T > searchhandels > > error-string is returned. if any of the dispaly operations fails. > > immadm is modified for displaying the returned parameters when dumping of > resource utilization is supported . > > diff --git a/osaf/libs/common/immsv/include/immutil.h > b/osaf/libs/common/immsv/include/immutil.h > --- a/osaf/libs/common/immsv/include/immutil.h > +++ b/osaf/libs/common/immsv/include/immutil.h > @@ -434,6 +434,10 @@ extern SaAisErrorT immutil_getAttr(const > > extern SaAisErrorT immutil_saImmOiAdminOperationResult(SaImmOiHandleT > immOiHandle, > SaInvocationT > invocation, SaAisErrorT result); > + > + extern SaAisErrorT > immutil_saImmOiAdminOperationResult_o2(SaImmOiHandleT immOiHandle, > + SaInvocationT > invocation, SaAisErrorT result, > + const > SaImmAdminOperationParamsT_2 **returnParams); > > extern SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle, > const SaImmCallbacksT > *immCallbacks, const SaVersionT *version); > 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 > @@ -1173,11 +1173,12 @@ immModel_adminOperationInvoke(IMMND_CB * > SaInvocationT inv, > SaUint32T* implConn, > SaClmNodeIdT* implNodeId, > - SaBoolT pbeExpected) > + SaBoolT pbeExpected, > + bool* displayRes) > { > return ImmModel::instance(&cb->immModel)-> > adminOperationInvoke(req, reqConn, reply_dest, inv, > - implConn, implNodeId, pbeExpected); > + implConn, implNodeId, pbeExpected, displayRes); > } > > SaUint32T /* Returns admo-id for object if object exists and active admo > exists, otherwise zero. */ > @@ -1615,6 +1616,7 @@ void immModel_pbeUpdateEpochContinuation > invocation, nodeId); > } > > + > int immModel_pbePrtObjDeletesContinuation(IMMND_CB *cb, > SaUint32T invocation, SaAisErrorT err, > SaClmNodeIdT nodeId, SaUint32T *reqConn, > @@ -1929,6 +1931,44 @@ immModel_fetchRtUpdate(IMMND_CB *cb, > } > > > +SaAisErrorT > +immModel_resourceDisplay(IMMND_CB *cb, > + const struct ImmsvAdminOperationParam *reqparams, > + struct ImmsvAdminOperationParam **rparams) > +{ > + > + const struct ImmsvAdminOperationParam *params = reqparams; > + SaStringT opName = NULL; > + SaUint64T searchcount=0; > + > + while (params) { > + if ((strcmp(params->paramName.buf, SA_IMM_PARAM_ADMOP_NAME))==0){ > + opName=params->paramBuffer.val.x.buf; > + break; > + } > + params=params->next; > + } > + > + if ((strcmp(opName,"display")==0)){ > + IMMND_OM_SEARCH_NODE *searchOp; > + IMMND_IMM_CLIENT_NODE *cl_node = > + (IMMND_IMM_CLIENT_NODE > *)ncs_patricia_tree_getnext(&cb->client_info_db, NULL); > + while(cl_node) { > + searchOp = cl_node->searchOpList; > + while(searchOp) { > + searchcount++; > + searchOp = searchOp->next; > + } > + cl_node = (IMMND_IMM_CLIENT_NODE *)ncs_patricia_tree_getnext( > + &cb->client_info_db, cl_node->patnode.key_info); > + } > + > + } > + > + return ImmModel::instance(&cb->immModel)-> > + resourceDisplay(reqparams, rparams, searchcount); > +} > + > /*====================================================================*/ > > ImmModel::ImmModel() : > @@ -10361,7 +10401,7 @@ SaAisErrorT ImmModel::adminOperationInvo > SaInvocationT& saInv, > SaUint32T* implConn, > unsigned int* implNodeId, > - bool pbeExpected) > + bool pbeExpected, bool* > displayRes) > { > TRACE_ENTER(); > SaAisErrorT err = SA_AIS_OK; > @@ -10466,6 +10506,14 @@ SaAisErrorT ImmModel::adminOperationInvo > fake_obj: > // Check for call on object implementer > if(object->mImplementer && object->mImplementer->mNodeId) { > + > + if(req->operationId == SA_IMM_PARAM_ADMOP_ID_ESC && objectName == > immObjectDn && > + displayRes && !protocol45Allowed()) { > + err = SA_AIS_ERR_INVALID_PARAM; > + LOG_NO("ERR_INVALID_PARAM: Display Admin-op rejected. Protocol4.5 > not allowed"); > + goto done; > + } > + > *implConn = object->mImplementer->mConn; > *implNodeId = object->mImplementer->mNodeId; > > @@ -10526,6 +10574,27 @@ SaAisErrorT ImmModel::adminOperationInvo > /* Check for special imm OI support */ > if(!pbeExpected && objectName == immObjectDn) { > err = updateImmObject2(req); > + if(req->operationId == SA_IMM_PARAM_ADMOP_ID_ESC && displayRes > && > + req->params && protocol45Allowed()) { > + IMMSV_ADMIN_OPERATION_PARAM* params = req->params; > + err = SA_AIS_ERR_REPAIR_PENDING; > + > + while(params) { > + > if((strcmp(params->paramName.buf,SA_IMM_PARAM_ADMOP_NAME)==0) && > + (params->paramType==SA_IMM_ATTR_SASTRINGT)) { > + > if(strncmp(params->paramBuffer.val.x.buf,"display",7)==0) { > + *displayRes=true; > + } else { > + LOG_WA("Invalid OperationName %s for dumping IMM > resource" > + "is not set properly", > params->paramBuffer.val.x.buf); > + err = SA_AIS_ERR_INVALID_PARAM; > + } > + break; > + } > + params = params->next; > + } > + } > + > TRACE_7("Admin op on special object %s whith no implementer > ret:%u", > objectName.c_str(), err); > } else if(objectName == immManagementDn) { > @@ -10901,7 +10970,7 @@ ImmModel::updateImmObject2(const ImmsvOm > LOG_NO("%s changed to: 0x%x", immAttrNostFlags.c_str(), noStdFlags); > } else { > LOG_NO("Invalid operation ID %llu, for operation on %s", (SaUint64T) > req->operationId, > - immObjectDn.c_str()); > + > immObjectDn.c_str()); > err = SA_AIS_ERR_INVALID_PARAM; > } > > @@ -10911,6 +10980,210 @@ ImmModel::updateImmObject2(const ImmsvOm > } > > SaAisErrorT > +ImmModel::resourceDisplay(const struct ImmsvAdminOperationParam *reqparams, > + struct ImmsvAdminOperationParam **rparams, > SaUint64T searchcount) > +{ > + SaAisErrorT err = SA_AIS_OK; > + const struct ImmsvAdminOperationParam *params = reqparams; > + SaStringT opName = NULL, resourceName = NULL, errStr = NULL; > + struct ImmsvAdminOperationParam * resparams = NULL; > + > + TRACE_ENTER(); > + > + while (params) { > + if ((strcmp(params->paramName.buf, > SA_IMM_PARAM_ADMOP_NAME))==0){ > + opName=params->paramBuffer.val.x.buf; > + break; > + } > + params=params->next; > + } > + > + > + if (opName){ > + params = reqparams; > + while(params){ > + if((strcmp(params->paramName.buf, "resource"))==0){ > + resourceName=params->paramBuffer.val.x.buf; > + TRACE_5("The resource is %s", resourceName); > + break; > + } > + params=params->next; > + } > + if(!resourceName){ > + if(strcmp(opName,"display-help")==0){ > + TRACE_5("supported IMM resources to be displyed > by using admin operation"); > + } else { > + LOG_WA("The resource type is not present in the > requested parameters for displaying IMM resources"); > + err = SA_AIS_ERR_INVALID_PARAM; > + int len= strlen("resource type is not present > in the requested parameters")+1; > + errStr = (SaStringT)malloc (len); > + strcpy(errStr, "resource type is not present in > the requested parameters"); > + goto done; > + } > + } > + } > + > + if ((strcmp(opName,"display")==0)) { > + resparams = (struct ImmsvAdminOperationParam *)calloc (1, > sizeof(struct ImmsvAdminOperationParam)); > + resparams->paramType = SA_IMM_ATTR_SAINT64T; > + resparams->next = NULL; > + resparams->paramName.size=strlen("count")+1; > + resparams->paramName.buf=(char *) malloc > (resparams->paramName.size); > + strcpy(resparams->paramName.buf,"count"); > + if((strcmp(resourceName,"implementers")==0)){ > + > resparams->paramBuffer.val.saint64=sImplementerVector.size(); > + }else if ((strcmp(resourceName,"adminowners")==0)){ > + > resparams->paramBuffer.val.saint64=sOwnerVector.size(); > + }else if ((strcmp(resourceName,"ccbs")==0)){ > + > resparams->paramBuffer.val.saint64=sCcbVector.size(); > + }else if ((strcmp(resourceName,"searches")==0)){ > + > resparams->paramBuffer.val.saint64=searchcount; > + }else { > + LOG_WA("Display of IMM reources for resourceName %s > is unsupported", resourceName); > + err = SA_AIS_ERR_INVALID_PARAM; > + int cnt = strlen("Display of IMM reources for > resourceName is unsupported")+1; > + errStr = (SaStringT)malloc (cnt); > + strcpy(errStr, "Display of IMM reources for > resourceName is unsupported"); > + free(resparams); > + resparams = NULL; > + goto done; > + } > + > + } else if(strcmp(opName,"displayverbose")==0){ > + > + struct ImmsvAdminOperationParam * result=NULL; > + if((strcmp(resourceName,"implementers")==0)){ > + if(sImplementerVector.size() > 0){ > + if(sImplementerVector.size() < 128){ > + > + ImplementerVector::iterator i; > + for(i = sImplementerVector.begin(); i > != sImplementerVector.end(); ++i) { > + ImplementerInfo* info = (*i); > + struct ImmsvAdminOperationParam > * res = > + (struct > ImmsvAdminOperationParam *)calloc (1, > sizeof(struct > ImmsvAdminOperationParam)); > + res->paramType = > SA_IMM_ATTR_SAINT64T; > + res->next = NULL; > + > res->paramName.size=info->mImplementerName.length()+1; > + res->paramName.buf=(char *) > malloc (res->paramName.size); > + > strcpy(res->paramName.buf,info->mImplementerName.c_str()); > + > res->paramBuffer.val.saint64=info->mNodeId; > + if(result){ > + result->next = res; > + result=res; > + }else { > + result = res; > + resparams=res; > + } > + } > + > + } else { > + LOG_NO("The Number of implementers are > greater than 128, displaying the implementers informati > on to syslog"); > + ImplementerVector::iterator i; > + for(i = sImplementerVector.begin(); > i != sImplementerVector.end(); ++i) { > + ImplementerInfo* info = (*i); > + LOG_IN("Implementer name %s and > location of the implementer is %u", > + > info->mImplementerName.c_str(), info->mNodeId); > + } > + } > + } > + } else if((strcmp(resourceName,"adminowners")==0)){ > + if(sOwnerVector.size() > 0){ > + if(sOwnerVector.size() < 128){ > + AdminOwnerVector::iterator i; > + for(i = sOwnerVector.begin(); i != > sOwnerVector.end(); ++i) { > + AdminOwnerInfo* adminOwner = > (*i); > + struct > ImmsvAdminOperationParam * res = > + (struct > ImmsvAdminOperationParam *) > + calloc (1, > sizeof(struct ImmsvAdminOperationParam)); > + res->paramType = > SA_IMM_ATTR_SAINT64T; > + res->next = NULL; > + > res->paramName.size=adminOwner->mAdminOwnerName.length()+1; > + res->paramName.buf=(char *) > malloc (res->paramName.size); > + > strcpy(res->paramName.buf,adminOwner->mAdminOwnerName.c_str()); > + > res->paramBuffer.val.saint64=adminOwner->mNodeId; > + if(result){ > + result->next = res; > + result=res; > + }else { > + result = res; > + resparams=res; > + } > + } > + } > + LOG_NO("The Number of AdminOwners > are greater than 128, displaying the adminowner information > to syslog"); > + AdminOwnerVector::iterator i; > + for(i = sOwnerVector.begin(); i != > sOwnerVector.end(); ++i) { > + AdminOwnerInfo* adminOwner = > (*i); > + LOG_IN("Implementer name %s > and location of the implementer is %u", > + > adminOwner->mAdminOwnerName.c_str(), adminOwner->mNodeId); > + } > + } > + } else { > + LOG_WA("Verbose display of reourcename %s is > unsupported", resourceName); > + err = SA_AIS_ERR_INVALID_PARAM; > + int cnt = strlen("verbose display of requested > resourceName is unsupported")+1; > + errStr = (SaStringT)malloc (cnt); > + strcpy(errStr, "Verbose display of requested > resourceName is unsupported"); > + goto done; > + } > + } else if((strcmp(opName,"display-help")==0)) { > + const char *resources[] = {"implementers", "adminowners", > "ccbs", "searches", NULL}; > + int i=0; > + > + struct ImmsvAdminOperationParam * result=NULL; > + while(resources[i]){ > + struct ImmsvAdminOperationParam * res = (struct > ImmsvAdminOperationParam *) > + calloc (1, > sizeof(struct ImmsvAdminOperationParam)); > + res->paramType = SA_IMM_ATTR_SASTRINGT; > + res->next = NULL; > + res->paramName.size=strlen("supportedResources")+1; > + res->paramName.buf=(char *) malloc > (res->paramName.size); > + strcpy(res->paramName.buf,"supportedResources"); > + res->paramBuffer.val.x.size= strlen(resources[i])+1; > + res->paramBuffer.val.x.buf = (char *) malloc > (res->paramBuffer.val.x.size); > + strcpy(res->paramBuffer.val.x.buf,resources[i]); > + > + if(result){ > + result->next = res; > + result=res; > + } > + else { > + result = res; > + resparams=res; > + } > + i++; > + } > + }else{ > + LOG_WA("OperationName %s is not supported", opName); > + err = SA_AIS_ERR_INVALID_PARAM; > + int cnt = strlen("OperationName is not supported")+1; > + errStr = (SaStringT)malloc (cnt); > + strcpy(errStr, "OperationName is not supported"); > + } > + > + > + done: > + if(!resparams && errStr){ > + struct ImmsvAdminOperationParam * errparam = (struct > ImmsvAdminOperationParam *) > + calloc (1, sizeof(struct > ImmsvAdminOperationParam)); > + errparam->paramType = SA_IMM_ATTR_SASTRINGT; > + errparam->next = NULL; > + errparam->paramName.size=strlen(SA_IMM_PARAM_ADMOP_ERROR)+1; > + errparam->paramName.buf=(char *) malloc > (errparam->paramName.size); > + strcpy(errparam->paramName.buf,SA_IMM_PARAM_ADMOP_ERROR); > + errparam->paramBuffer.val.x.size= strlen(errStr)+1; > + errparam->paramBuffer.val.x.buf = errStr; > + resparams=errparam; > + } > + > + *rparams = resparams; > + > + TRACE_LEAVE(); > + return err; > +} > + > + > +SaAisErrorT > ImmModel::admoImmMngtObject(const ImmsvOmAdminOperationInvoke* req) > { > SaAisErrorT err = SA_AIS_ERR_INTERRUPT; > 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 > @@ -351,7 +351,8 @@ public: > SaInvocationT& inv, > SaUint32T* implConn, > unsigned int* implNodeId, > - bool pbeExpected); > + bool pbeExpected, > + bool* displayRes); > > // Objects > > @@ -454,6 +455,11 @@ public: > ImplementerInfo* info, > bool& subTreeHasPersistent, > bool& subTreeHasSpecialAppl); > + > + SaAisErrorT resourceDisplay( > + const struct ImmsvAdminOperationParam > *reqparams, > + struct ImmsvAdminOperationParam > **rparams, > + SaUint64T searchcount); > > SaAisErrorT objectSync(const ImmsvOmObjectSync* req); > bool fetchRtUpdate(ImmsvOmObjectSync* syncReq, > 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 > @@ -4521,12 +4521,42 @@ static uint32_t immnd_evt_proc_admop_rsp > return rc; /*Note: Error is ignored! should cause > bad-handle..if local */ > } > > + /*displayRes is used when the adminoperation with operation > name display is called. > + displayRes will be true, when admin-operation has > OperationName as display > + and directed towards > opensafImm=opensafImm,safApp=safImmService object. > + Implementer for opensafImm=opensafImm,safApp=safImmService is > PBE. > + */ > + bool displayRes=false; > + IMMSV_ADMIN_OPERATION_PARAM *rparams= NULL; > + struct ImmsvAdminOperationParam *params = > evt->info.admOpRsp.parms; > + SaAisErrorT err = evt->info.admOpRsp.error; > + SaAisErrorT result = evt->info.admOpRsp.result; > + > + while(params) { > + > if((strcmp(params->paramName.buf,SA_IMM_PARAM_ADMOP_NAME)==0) && > + > (params->paramType==SA_IMM_ATTR_SASTRINGT)) { > + > if(strncmp(params->paramBuffer.val.x.buf,"display",7)==0) { > + displayRes=true; > + } else { > + LOG_WA("Invalid OperationName %s for > dumping IMM resource" > + "is not set properly", > params->paramBuffer.val.x.buf); > + err = SA_AIS_ERR_INVALID_PARAM; > + } > + break; > + } > + params = params->next; > + } > + > + if(displayRes){ > + result = immModel_resourceDisplay(cb, > evt->info.admOpRsp.parms, &rparams); > + } > + > send_evt.type = IMMSV_EVT_TYPE_IMMA; > send_evt.info.imma.type = > (evt->info.admOpRsp.parms)?IMMA_EVT_ND2A_ADMOP_RSP_2:IMMA_EVT_ND2A_ADMOP_RSP; > send_evt.info.imma.info.admOpRsp.invocation = > evt->info.admOpRsp.invocation; > - send_evt.info.imma.info.admOpRsp.result = > evt->info.admOpRsp.result; > - send_evt.info.imma.info.admOpRsp.error = > evt->info.admOpRsp.error; > - send_evt.info.imma.info.admOpRsp.parms = > evt->info.admOpRsp.parms; > + send_evt.info.imma.info.admOpRsp.result = result; > + send_evt.info.imma.info.admOpRsp.error = err; > + send_evt.info.imma.info.admOpRsp.parms = > (displayRes)?rparams:evt->info.admOpRsp.parms; > > if (async) { > TRACE_2("NORMAL ASYNCRONOUS reply %llu %u %u to OM", > @@ -4649,6 +4679,11 @@ static void immnd_evt_proc_admop(IMMND_C > SaUint32T implConn = 0; > NCS_NODE_ID implNodeId = 0; > SaBoolT async = SA_FALSE; > + /*displayRes is used for admin-operation which has OperationName as > display > + and directed towards opensafImm=opensafImm,safApp=safImmService > object. > + SA_AIS_ERR_REPAIR_PENDING will be returned if there is no PBE and > OperationName is display. > + */ > + bool displayRes=false; > SaBoolT pbeExpected = cb->mPbeFile && (cb->mRim == > SA_IMM_KEEP_REPOSITORY); > > async = (evt->type == IMMND_EVT_A2ND_IMM_ADMOP_ASYNC); > @@ -4668,8 +4703,8 @@ static void immnd_evt_proc_admop(IMMND_C > > error = immModel_adminOperationInvoke(cb, &(evt->info.admOpReq), > originatedAtThisNd ? conn : 0, > - (SaUint64T)reply_dest, saInv, > &implConn, > - &implNodeId, pbeExpected); > + (SaUint64T)reply_dest, saInv, > &implConn, > + &implNodeId, pbeExpected, > &displayRes); > > /*Check if we have an implementer, if so forward the message. > If there is no implementer then implNodeId is zero. > @@ -4808,12 +4843,20 @@ static void immnd_evt_proc_admop(IMMND_C > > if(error == SA_AIS_ERR_REPAIR_PENDING) { > uint32_t rc = NCSCC_RC_SUCCESS; > + SaAisErrorT result = SA_AIS_OK; > + IMMSV_ADMIN_OPERATION_PARAM *rparams= NULL; > osafassert(!pbeExpected); > TRACE("Ok reply for internally handled adminOp when PBE > not configured"); > - send_evt.info.imma.type = IMMA_EVT_ND2A_ADMOP_RSP; > + > + if(displayRes){ > + result = immModel_resourceDisplay(cb, > evt->info.admOpReq.params, &rparams); > + } > + > + send_evt.info.imma.type = > rparams?IMMA_EVT_ND2A_ADMOP_RSP_2:IMMA_EVT_ND2A_ADMOP_RSP; > send_evt.info.imma.info.admOpRsp.invocation = saInv; > - send_evt.info.imma.info.admOpRsp.result = SA_AIS_OK; > + send_evt.info.imma.info.admOpRsp.result = result; > send_evt.info.imma.info.admOpRsp.error = SA_AIS_OK; > + send_evt.info.imma.info.admOpRsp.parms = rparams; > if (async) { > TRACE_2("ASYNCRONOUS special reply %llu %u %u > to OM", > > send_evt.info.imma.info.admOpRsp.invocation, > 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 > @@ -98,7 +98,7 @@ extern "C" { > SaUint32T reqConn, > SaUint64T reply_dest, > SaInvocationT inv, SaUint32T > *implConn, > - SaClmNodeIdT *implNodeId, SaBoolT > pbeExpected); > + SaClmNodeIdT *implNodeId, SaBoolT > pbeExpected, bool* displayRes); > > SaAisErrorT immModel_classCreate(IMMND_CB *cb, > const struct ImmsvOmClassDescr *req, > @@ -348,7 +348,6 @@ extern "C" { > void immModel_pbeUpdateEpochContinuation(IMMND_CB *cb, > SaUint32T invocation, SaClmNodeIdT nodeId); > > - > void immModel_ccbObjModifyContinuation(IMMND_CB *cb, > SaUint32T ccbId, > SaUint32T invocation, > SaAisErrorT error, SaUint32T *reqConn); > @@ -413,6 +412,10 @@ extern "C" { > SaAisErrorT immModel_implIsFree(IMMND_CB *cb, > const SaImmOiImplementerNameT implName); > > + SaAisErrorT immModel_resourceDisplay(IMMND_CB *cb, > + const struct ImmsvAdminOperationParam *reqparams, > + struct ImmsvAdminOperationParam **rparams); > + > #ifdef __cplusplus > } > #endif > 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 > @@ -1072,6 +1072,63 @@ static void saImmOiAdminOperationCallbac > } else if(opId == OPENSAF_IMM_BAD_OP_BOUNCE) { > LOG_WA("ERR_BAD_OPERATION: bounced in PBE"); > rc = immutil_saImmOiAdminOperationResult(immOiHandle, > invocation, SA_AIS_ERR_BAD_OPERATION); > + } else if (opId == SA_IMM_PARAM_ADMOP_ID_ESC) { > + int i=0, param_len=0; > + SaStringT opName = NULL, res= NULL; > + SaImmAdminOperationParamsT_2 * resparams ; > + SaImmAdminOperationParamsT_2 ** rparams; > + rparams = (SaImmAdminOperationParamsT_2 **) realloc(NULL, > sizeof(SaImmAdminOperationParamsT_2 *)); > + rparams[0]= NULL; > + while (params[i]) { > + if ((strcmp(params[i]->paramName, > SA_IMM_PARAM_ADMOP_NAME))==0){ > + param_len++; > + rparams = (SaImmAdminOperationParamsT_2 **) > realloc (rparams, > + (param_len+1) * > sizeof(SaImmAdminOperationParamsT_2 *)); > + resparams = (SaImmAdminOperationParamsT_2 *) > malloc(sizeof(SaImmAdminOperationParamsT_2)); > + opName=(*(SaStringT *)params[i]->paramBuffer); > + resparams->paramName = > strdup(SA_IMM_PARAM_ADMOP_NAME); > + resparams->paramType = SA_IMM_ATTR_SASTRINGT; > + resparams->paramBuffer = > malloc(sizeof(SaStringT)); > + *((SaStringT *)(resparams->paramBuffer)) = > strdup(opName); > + rparams[param_len -1]=resparams; > + rparams[param_len]=NULL; > + break; > + } > + i++; > + } > + i=0; > + while (params[i]) { > + if ((strcmp(params[i]->paramName, "resource"))==0){ > + param_len++; > + rparams = (SaImmAdminOperationParamsT_2 **) > realloc (rparams, > + (param_len+1) * > sizeof(SaImmAdminOperationParamsT_2 *)); > + resparams = (SaImmAdminOperationParamsT_2 *) > malloc(sizeof(SaImmAdminOperationParamsT_2)); > + res=(*(SaStringT *)params[i]->paramBuffer); > + resparams->paramName = strdup("resource"); > + resparams->paramType = SA_IMM_ATTR_SASTRINGT; > + resparams->paramBuffer = > malloc(sizeof(SaStringT)); > + *((SaStringT *)(resparams->paramBuffer)) = > strdup(res); > + rparams[param_len -1]=resparams; > + rparams[param_len]=NULL; > + break; > + } > + i++; > + } > + > + if (opName) { > + if ((strcmp(opName,"display")==0) || > (strcmp(opName,"displayverbose")==0)|| > + (strcmp(opName,"display-help")==0)) { > + > + rc = > immutil_saImmOiAdminOperationResult_o2(immOiHandle, invocation, > + SA_AIS_OK, (const > SaImmAdminOperationParamsT_2 **) rparams); > + } else { > + LOG_WA("Invalid operation Name %s for operation > ID %llu", opName, (SaUint64T) opId); > + rc = > immutil_saImmOiAdminOperationResult(immOiHandle, invocation, > SA_AIS_ERR_INVALID_PARAM); > + } > + } else { > + LOG_WA("Operation Name is not provided for > operation ID %llu", (SaUint64T) opId); > + rc = > immutil_saImmOiAdminOperationResult(immOiHandle, invocation, > SA_AIS_ERR_INVALID_PARAM); > + } > } else { > LOG_WA("Invalid operation ID %llu", (SaUint64T) opId); > rc = immutil_saImmOiAdminOperationResult(immOiHandle, > invocation, SA_AIS_ERR_INVALID_PARAM); > diff --git a/osaf/tools/safimm/immadm/imm_admin.c > b/osaf/tools/safimm/immadm/imm_admin.c > --- a/osaf/tools/safimm/immadm/imm_admin.c > +++ b/osaf/tools/safimm/immadm/imm_admin.c > @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) > {"admin-owner", required_argument, 0, 'a'}, > {"help", no_argument, 0, 'h'}, > {"timeout", required_argument, 0, 't'}, > - {"verbose", required_argument, 0, 'v'}, > + {"verbose", no_argument, 0, 'v'}, > {0, 0, 0, 0} > }; > SaAisErrorT error; > @@ -269,6 +269,7 @@ int main(int argc, char *argv[]) > > params = realloc(NULL, sizeof(SaImmAdminOperationParamsT_2 *)); > params[0] = NULL; > + SaStringT opName = NULL; > > while (1) { > c = getopt_long(argc, argv, "dp:o:O:a:t:hv", long_options, > NULL); > @@ -306,6 +307,7 @@ int main(int argc, char *argv[]) > param->paramType = SA_IMM_ATTR_SASTRINGT; > param->paramBuffer = malloc(sizeof(SaStringT)); > *((SaStringT *)(param->paramBuffer)) = strdup(optarg); > + opName = strdup(optarg); > break; > case 'p': > params_len++; > @@ -347,7 +349,7 @@ int main(int argc, char *argv[]) > } > > if (operationId == -1) { > - fprintf(stderr, "error - must specify admin operation ID\n"); > + fprintf(stderr, "error - must specify admin operation ID > %llx\n", operationId); > exit(EXIT_FAILURE); > } > > @@ -415,7 +417,7 @@ retry: > exit(EXIT_FAILURE); > } > > - if (operationReturnValue != SA_AIS_OK) { > + if (operationReturnValue != SA_AIS_OK ) { > unsigned int ix = 0; > > if ((operationReturnValue == SA_AIS_ERR_TRY_AGAIN) && > !disable_tryagain) { > @@ -442,11 +444,13 @@ retry: > > print_params(argv[optind], out_params); > } > + > > exit(EXIT_FAILURE); > } > > - if (verbose && out_params && out_params[0]) { > + > + if (((opName && (strncmp(opName,"display",7)==0))||verbose) > &&out_params && out_params[0]) { > if(!isFirst) > printf("\n"); > else > @@ -455,6 +459,7 @@ retry: > print_params(argv[optind], out_params); > } > > + > error = saImmOmAdminOperationMemoryFree(ownerHandle, > out_params); > if (error != SA_AIS_OK) { > fprintf(stderr, "error - > saImmOmAdminOperationMemoryFree FAILED: %s\n", saf_error(error)); > diff --git a/osaf/tools/safimm/src/immutil.c b/osaf/tools/safimm/src/immutil.c > --- a/osaf/tools/safimm/src/immutil.c > +++ b/osaf/tools/safimm/src/immutil.c > @@ -1133,6 +1133,23 @@ SaAisErrorT immutil_saImmOiAdminOperatio > return rc; > } > > +SaAisErrorT immutil_saImmOiAdminOperationResult_o2(SaImmOiHandleT > immOiHandle, > + SaInvocationT invocation, > SaAisErrorT result, > + const > SaImmAdminOperationParamsT_2 **returnParams) > +{ > + SaAisErrorT rc = saImmOiAdminOperationResult_o2(immOiHandle, > invocation, result, returnParams); > + unsigned int nTries = 1; > + while (rc == SA_AIS_ERR_TRY_AGAIN && nTries < > immutilWrapperProfile.nTries) { > + usleep(immutilWrapperProfile.retryInterval * 1000); > + rc = saImmOiAdminOperationResult_o2(immOiHandle, invocation, > result, returnParams); > + nTries++; > + } > + if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal) > + immutilError("saImmOiAdminOperationResult FAILED, rc = %d", > (int)rc); > + return rc; > +} > + > + > SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle, const > SaImmCallbacksT *immCallbacks, const SaVersionT *version) > { > /* Version parameter is in/out i.e. must be mutable and should not be > diff --git a/samples/immsv/immutils/immutil.c > b/samples/immsv/immutils/immutil.c > --- a/samples/immsv/immutils/immutil.c > +++ b/samples/immsv/immutils/immutil.c > @@ -1113,6 +1113,23 @@ SaAisErrorT immutil_saImmOiAdminOperatio > return rc; > } > > + > +SaAisErrorT immutil_saImmOiAdminOperationResult_o2(SaImmOiHandleT > immOiHandle, > + SaInvocationT invocation, > SaAisErrorT result, > + const > SaImmAdminOperationParamsT_2 **returnParams) > +{ > + SaAisErrorT rc = saImmOiAdminOperationResult_o2(immOiHandle, > invocation, result, returnParams); > + unsigned int nTries = 1; > + while (rc == SA_AIS_ERR_TRY_AGAIN && nTries < > immutilWrapperProfile.nTries) { > + usleep(immutilWrapperProfile.retryInterval * 1000); > + rc = saImmOiAdminOperationResult_o2(immOiHandle, invocation, > result, returnParams); > + nTries++; > + } > + if (rc != SA_AIS_OK && immutilWrapperProfile.errorsAreFatal) > + immutilError("saImmOiAdminOperationResult FAILED, rc = %d", > (int)rc); > + return rc; > +} > + > SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle, const > SaImmCallbacksT *immCallbacks, const SaVersionT *version) > { > /* Version parameter is in/out i.e. must be mutable and should not be > diff --git a/samples/immsv/immutils/immutil.h > b/samples/immsv/immutils/immutil.h > --- a/samples/immsv/immutils/immutil.h > +++ b/samples/immsv/immutils/immutil.h > @@ -435,6 +435,10 @@ extern SaAisErrorT immutil_getAttr(const > extern SaAisErrorT immutil_saImmOiAdminOperationResult(SaImmOiHandleT > immOiHandle, > SaInvocationT > invocation, SaAisErrorT result); > > + extern SaAisErrorT > immutil_saImmOiAdminOperationResult_o2(SaImmOiHandleT immOiHandle, > + SaInvocationT > invocation, SaAisErrorT result, > + const > SaImmAdminOperationParamsT_2 **returnParams); > + > extern SaAisErrorT immutil_saImmOmInitialize(SaImmHandleT *immHandle, > const SaImmCallbacksT > *immCallbacks, const SaVersionT *version); > > ------------------------------------------------------------------------------ _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel