Re: [devel] [PATCH 2 of 3] IMM: Support for saImmOmCcbValidate API [#798]

2014-04-09 Thread Anders Björnerstedt
Thanks Zoran,

Will fix this before pushing.
Waiting also for comments and/or ack from Neelakanta.


/AndersBj
 

-Original Message-
From: Zoran Milinkovic 
Sent: den 8 april 2014 16:56
To: Anders Björnerstedt; reddy.neelaka...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 2 of 3] IMM: Support for saImmOmCcbValidate API [#798]

When IMM handle is initialized with lower version than A.2.14, after ccbApply, 
ccbAbort should return ERR_VERSION, but SA_AIS_OK is returned.
When CCB is not applied, ccbAbort works fine and returns ERR_VERSION.
The rest of the code is reviewed and tested, and it's ok.

NACK until the version is fixed.

Best regards,
Zoran

-Original Message-
From: Anders Björnerstedt 
Sent: den 4 april 2014 14:53
To: reddy.neelaka...@oracle.com; Zoran Milinkovic
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 2 of 3] IMM: Support for saImmOmCcbValidate API [#798]

 osaf/libs/agents/saf/imma/imma_cb.h|1 +
 osaf/libs/agents/saf/imma/imma_oi_api.c|2 +-
 osaf/libs/agents/saf/imma/imma_om_api.c|  166 -
 osaf/libs/common/immsv/immsv_evt.c |4 +
 osaf/libs/common/immsv/include/immsv_evt.h |1 +
 osaf/libs/saf/include/saImmOm_A_2_14.h |3 +
 osaf/services/saf/immsv/immnd/ImmModel.cc  |  167 ++--
 osaf/services/saf/immsv/immnd/ImmModel.hh  |3 +-
 osaf/services/saf/immsv/immnd/immnd_evt.c  |   73 -
 osaf/services/saf/immsv/immnd/immnd_init.h |4 +-
 tests/immsv/implementer/test_SaImmOiCcb.c  |  120 -
 tests/immsv/implementer/test_saImmOiAugmentCcbInitialize.c |   38 ++-
 tests/immsv/management/test_saImmOmCcbApply.c  |   89 ++
 tests/immsv/management/test_saImmOmCcbInitialize.c |4 +
 tests/unit_test_fw/src/utest.c |2 +-
 15 files changed, 607 insertions(+), 70 deletions(-)


See ticket or osaf/services/saf/immsv/README for details.

diff --git a/osaf/libs/agents/saf/imma/imma_cb.h 
b/osaf/libs/agents/saf/imma/imma_cb.h
--- a/osaf/libs/agents/saf/imma/imma_cb.h
+++ b/osaf/libs/agents/saf/imma/imma_cb.h
@@ -98,6 +98,7 @@ typedef struct imma_ccb_node {
  timeout = Ccb-outcome to be 
recovered. */
bool mApplied; /* Current mCcbId appliedterminated */
bool mAborted; /* Current mCcbId aborted */
+   bool mValidated;   /* Current mCcbId validated */
bool mAugCcb;  /* Current and only mCcbId is an augment. */
bool mAugIsTainted;/* AugCcb has tainted root CCB = apply aug or abort 
root*/
 } IMMA_CCB_NODE;
diff --git a/osaf/libs/agents/saf/imma/imma_oi_api.c 
b/osaf/libs/agents/saf/imma/imma_oi_api.c
--- a/osaf/libs/agents/saf/imma/imma_oi_api.c
+++ b/osaf/libs/agents/saf/imma/imma_oi_api.c
@@ -3417,7 +3417,7 @@ SaAisErrorT saImmOiAugmentCcbInitialize(
IMMA_CALLBACK_INFO * cbi=NULL;
SaImmHandleT privateOmHandle = 0LL;
SaImmAdminOwnerHandleT privateAoHandle = 0LL;
-   SaVersionT version = {'A', 2, 11};
+   SaVersionT version = {'A', 2, 14};
SaUint32T adminOwnerId = 0;
SaUint32T ccbId = 0;
 
diff --git a/osaf/libs/agents/saf/imma/imma_om_api.c 
b/osaf/libs/agents/saf/imma/imma_om_api.c
--- a/osaf/libs/agents/saf/imma/imma_om_api.c
+++ b/osaf/libs/agents/saf/imma/imma_om_api.c
@@ -54,6 +54,7 @@ static const char *sysaImplName = SA_IMM
 
 static int imma_om_resurrect(IMMA_CB *cb, IMMA_CLIENT_NODE *cl_node, bool 
*locked);
 static SaAisErrorT imma_finalizeCcb(SaImmCcbHandleT ccbHandle, bool 
keepCcbHandleOpen);
+static SaAisErrorT imma_applyCcb(SaImmCcbHandleT ccbHandle, bool onlyValidate);
 
 /
   Name  :  SaImmOmInitialize
@@ -2873,6 +2874,11 @@ SaAisErrorT saImmOmCcbObjectDelete(SaImm
 **/
 SaAisErrorT saImmOmCcbApply(SaImmCcbHandleT ccbHandle)
 {
+   return imma_applyCcb(ccbHandle, false);
+}
+
+SaAisErrorT imma_applyCcb(SaImmCcbHandleT ccbHandle, bool onlyValidate)
+{
SaAisErrorT rc = SA_AIS_OK;
IMMA_CB *cb = imma_cb;
IMMSV_EVT evt;
@@ -2924,7 +2930,9 @@ SaAisErrorT saImmOmCcbApply(SaImmCcbHand
   ccb-id has been EXPLICITLY applied by the user. 
   This can only be done by a successful explicit 
   saImmOmCcbApply. A ccb-handle with an aborted ccb-id
-  can not be used any more. Only finalize is allowed on handle.
+  can only be used again after an explcit saImmOmCcbAbort() 
has been
+  invoked on the handle. Otherwise only finalize is allowed on
+   the handle.
 
   Setting mApplied to true opens for 

Re: [devel] [PATCH 2 of 3] IMM: Support for saImmOmCcbValidate API [#798]

2014-04-08 Thread Zoran Milinkovic
When IMM handle is initialized with lower version than A.2.14, after ccbApply, 
ccbAbort should return ERR_VERSION, but SA_AIS_OK is returned.
When CCB is not applied, ccbAbort works fine and returns ERR_VERSION.
The rest of the code is reviewed and tested, and it's ok.

NACK until the version is fixed.

Best regards,
Zoran

-Original Message-
From: Anders Björnerstedt 
Sent: den 4 april 2014 14:53
To: reddy.neelaka...@oracle.com; Zoran Milinkovic
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 2 of 3] IMM: Support for saImmOmCcbValidate API [#798]

 osaf/libs/agents/saf/imma/imma_cb.h|1 +
 osaf/libs/agents/saf/imma/imma_oi_api.c|2 +-
 osaf/libs/agents/saf/imma/imma_om_api.c|  166 -
 osaf/libs/common/immsv/immsv_evt.c |4 +
 osaf/libs/common/immsv/include/immsv_evt.h |1 +
 osaf/libs/saf/include/saImmOm_A_2_14.h |3 +
 osaf/services/saf/immsv/immnd/ImmModel.cc  |  167 ++--
 osaf/services/saf/immsv/immnd/ImmModel.hh  |3 +-
 osaf/services/saf/immsv/immnd/immnd_evt.c  |   73 -
 osaf/services/saf/immsv/immnd/immnd_init.h |4 +-
 tests/immsv/implementer/test_SaImmOiCcb.c  |  120 -
 tests/immsv/implementer/test_saImmOiAugmentCcbInitialize.c |   38 ++-
 tests/immsv/management/test_saImmOmCcbApply.c  |   89 ++
 tests/immsv/management/test_saImmOmCcbInitialize.c |4 +
 tests/unit_test_fw/src/utest.c |2 +-
 15 files changed, 607 insertions(+), 70 deletions(-)


See ticket or osaf/services/saf/immsv/README for details.

diff --git a/osaf/libs/agents/saf/imma/imma_cb.h 
b/osaf/libs/agents/saf/imma/imma_cb.h
--- a/osaf/libs/agents/saf/imma/imma_cb.h
+++ b/osaf/libs/agents/saf/imma/imma_cb.h
@@ -98,6 +98,7 @@ typedef struct imma_ccb_node {
  timeout = Ccb-outcome to be 
recovered. */
bool mApplied; /* Current mCcbId appliedterminated */
bool mAborted; /* Current mCcbId aborted */
+   bool mValidated;   /* Current mCcbId validated */
bool mAugCcb;  /* Current and only mCcbId is an augment. */
bool mAugIsTainted;/* AugCcb has tainted root CCB = apply aug or abort 
root*/
 } IMMA_CCB_NODE;
diff --git a/osaf/libs/agents/saf/imma/imma_oi_api.c 
b/osaf/libs/agents/saf/imma/imma_oi_api.c
--- a/osaf/libs/agents/saf/imma/imma_oi_api.c
+++ b/osaf/libs/agents/saf/imma/imma_oi_api.c
@@ -3417,7 +3417,7 @@ SaAisErrorT saImmOiAugmentCcbInitialize(
IMMA_CALLBACK_INFO * cbi=NULL;
SaImmHandleT privateOmHandle = 0LL;
SaImmAdminOwnerHandleT privateAoHandle = 0LL;
-   SaVersionT version = {'A', 2, 11};
+   SaVersionT version = {'A', 2, 14};
SaUint32T adminOwnerId = 0;
SaUint32T ccbId = 0;
 
diff --git a/osaf/libs/agents/saf/imma/imma_om_api.c 
b/osaf/libs/agents/saf/imma/imma_om_api.c
--- a/osaf/libs/agents/saf/imma/imma_om_api.c
+++ b/osaf/libs/agents/saf/imma/imma_om_api.c
@@ -54,6 +54,7 @@ static const char *sysaImplName = SA_IMM
 
 static int imma_om_resurrect(IMMA_CB *cb, IMMA_CLIENT_NODE *cl_node, bool 
*locked);
 static SaAisErrorT imma_finalizeCcb(SaImmCcbHandleT ccbHandle, bool 
keepCcbHandleOpen);
+static SaAisErrorT imma_applyCcb(SaImmCcbHandleT ccbHandle, bool onlyValidate);
 
 /
   Name  :  SaImmOmInitialize
@@ -2873,6 +2874,11 @@ SaAisErrorT saImmOmCcbObjectDelete(SaImm
 **/
 SaAisErrorT saImmOmCcbApply(SaImmCcbHandleT ccbHandle)
 {
+   return imma_applyCcb(ccbHandle, false);
+}
+
+SaAisErrorT imma_applyCcb(SaImmCcbHandleT ccbHandle, bool onlyValidate)
+{
SaAisErrorT rc = SA_AIS_OK;
IMMA_CB *cb = imma_cb;
IMMSV_EVT evt;
@@ -2924,7 +2930,9 @@ SaAisErrorT saImmOmCcbApply(SaImmCcbHand
   ccb-id has been EXPLICITLY applied by the user. 
   This can only be done by a successful explicit 
   saImmOmCcbApply. A ccb-handle with an aborted ccb-id
-  can not be used any more. Only finalize is allowed on handle.
+  can only be used again after an explcit saImmOmCcbAbort() 
has been
+  invoked on the handle. Otherwise only finalize is allowed on
+   the handle.
 
   Setting mApplied to true opens for the IMPLICIT 
   start of a new ccb-id with the current and same 
SaImmCcbHandleT value.
@@ -2949,6 +2957,11 @@ SaAisErrorT saImmOmCcbApply(SaImmCcbHand
goto done;
}
 
+   if (ccb_node-mValidated  onlyValidate) {
+   rc = SA_AIS_OK; /* Validation is idempotent on clientr side */
+   goto done;
+