osaf/services/saf/amf/amfd/imm.cc | 45 +++++++++++++++++++++++++++---- osaf/services/saf/amf/amfd/include/imm.h | 16 +++++++++++ 2 files changed, 54 insertions(+), 7 deletions(-)
Currently, admin operation responses from amfd are not synchronised with IMM changes that may be performed as part of the admin operation. That is, an admin operation may return before the corresponding IMM changes have been performed. IMM changes by amfd are typically placed into a FIFO queue to be done at a later time. This patch puts admin operation responses into the same queue. Therefore guaranteeing that when an admin operation returns, the corresponding IMM changes have already been done. diff --git a/osaf/services/saf/amf/amfd/imm.cc b/osaf/services/saf/amf/amfd/imm.cc --- a/osaf/services/saf/amf/amfd/imm.cc +++ b/osaf/services/saf/amf/amfd/imm.cc @@ -228,6 +228,40 @@ ImmObjDelete::~ImmObjDelete() } // +AvdJobDequeueResultT ImmAdminResponse::exec(const SaImmOiHandleT handle) { + SaAisErrorT rc; + AvdJobDequeueResultT res; + + TRACE_ENTER2("Admin resp inv:%llu res:%u", this->invocation_, this->result_); + + rc = saImmOiAdminOperationResult(handle, this->invocation_, this->result_); + + switch (rc) { + case SA_AIS_OK: + delete Fifo::dequeue(); + res = JOB_EXECUTED; + break; + case SA_AIS_ERR_TRY_AGAIN: + TRACE("TRY-AGAIN"); + res = JOB_ETRYAGAIN; + break; + case SA_AIS_ERR_BAD_HANDLE: + // there is no need to reattempt reply, + // fall through to default to remove from queue + TRACE("BADHANDLE"); + avd_imm_reinit_bg(); + default: + delete Fifo::dequeue(); + LOG_ER("Admin op failed for invocation: %llu, result %u", + this->invocation_, this->result_); + res = JOB_ERR; + break; + } + + TRACE_LEAVE2("%u", res); + return res; +} + Job* Fifo::peek() { Job* tmp; @@ -1717,15 +1751,12 @@ void avd_saImmOiAdminOperationResult(SaI SaInvocationT invocation, SaAisErrorT result) { - SaAisErrorT error; + TRACE_ENTER2("inv:%llu, res:%u", invocation, result); - TRACE_ENTER2("inv:%llu, res:%u", invocation, result); - saflog(LOG_NOTICE, amfSvcUsrName, "Admin op done for invocation: %llu, result %u", - invocation, result); + ImmAdminResponse *job = new ImmAdminResponse(invocation, result); + Fifo::queue(job); - error = immutil_saImmOiAdminOperationResult(immOiHandle, invocation, result); - if (error != SA_AIS_OK) - LOG_NO("saImmOiAdminOperationResult for %llu failed %u", invocation, error); + TRACE_LEAVE(); } /** diff --git a/osaf/services/saf/amf/amfd/include/imm.h b/osaf/services/saf/amf/amfd/include/imm.h --- a/osaf/services/saf/amf/amfd/include/imm.h +++ b/osaf/services/saf/amf/amfd/include/imm.h @@ -91,6 +91,22 @@ public: ~ImmObjDelete(); }; +class ImmAdminResponse : public Job { + public: + ImmAdminResponse(const SaInvocationT invocation, + const SaAisErrorT result) { + this->invocation_ = invocation; + this->result_ = result; + } + AvdJobDequeueResultT exec(SaImmOiHandleT immOiHandle); + + ~ImmAdminResponse() {} + private: + ImmAdminResponse(); + SaInvocationT invocation_; + SaAisErrorT result_; +}; + // class Fifo { public: ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/NeoTech _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel