Or wait, maybe I get it: Does "an augmented ccb" refer to a CCB handle
returned by saImmOiAugmentCcbInitialize()? So it will not fail for a CCB
handle returned by saImmOmCcbInitialize(), even if some OI has called
saImmOiAugmentCcbInitialize()? This would make sense, but wasn't
perfectly clear to me from reading the API description. :-)
regards,
Anders Widell
2014-04-11 09:51, Anders Widell skrev:
> A question: why is saImmOmCcbAbort() not allowed on an augmented ccb?
> The OM probably doesn't know if the CCB has been augmented or not, so it
> would have to check for this error code and then fall back to calling
> saImmOmCcbFinalize() + saImmOmCcbInitialize() if this happens.
>
> regards,
> Anders Widell
>
> 2014-04-04 14:53, Anders Bjornerstedt skrev:
>> osaf/libs/agents/saf/imma/imma_cb.h | 1 +
>> osaf/libs/agents/saf/imma/imma_def.h | 2 +-
>> osaf/libs/agents/saf/imma/imma_oi_api.c | 9 +-
>> osaf/libs/agents/saf/imma/imma_om_api.c | 82
>> +++++++++++++++++-
>> osaf/libs/saf/include/saImmOm_A_2_13.h | 2 +
>> osaf/libs/saf/include/saImmOm_A_2_14.h | 46 ++++++++++
>> tests/immsv/common/immtest.c | 4 +-
>> tests/immsv/management/test_saImmOmCcbApply.c | 95
>> ++++++++++++++++++++++
>> tests/immsv/management/test_saImmOmCcbInitialize.c | 4 +
>> 9 files changed, 231 insertions(+), 14 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
>> @@ -60,6 +60,7 @@ typedef struct imma_client_node {
>> bool isImmA2b; /* Version A.02.11 */
>> bool isImmA2bCbk; /* Version A.02.11 callback*/
>> bool isImmA2d; /* Version A.02.13 */
>> + bool isImmA2e; /* Version A.02.14 */
>> bool isApplier; /* True => This is an Applier-OI */
>> bool isAug; /* True => handle internal to OI augmented CCB */
>> bool isBusy; /* True => handle is locked by a thread until a
>> function execution is done */
>> diff --git a/osaf/libs/agents/saf/imma/imma_def.h
>> b/osaf/libs/agents/saf/imma/imma_def.h
>> --- a/osaf/libs/agents/saf/imma/imma_def.h
>> +++ b/osaf/libs/agents/saf/imma/imma_def.h
>> @@ -22,7 +22,7 @@
>> /* Macros for Validating Version */
>> #define IMMA_RELEASE_CODE 'A'
>> #define IMMA_MAJOR_VERSION 0x02
>> -#define IMMA_MINOR_VERSION 0x0d
>> +#define IMMA_MINOR_VERSION 0x0e
>>
>> #define IMMSV_WAIT_TIME 1000 /* Default MDS wait time in 10ms units =>10
>> sec*/
>>
>> 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
>> @@ -121,9 +121,12 @@ SaAisErrorT saImmOiInitialize_2(SaImmOiH
>> TRACE_2("OI client version A.2.%u",
>> requested_version.minorVersion);
>> if(requested_version.minorVersion >= 0x0b) {
>> cl_node->isImmA2b = 0x1;
>> - }
>> - if(requested_version.minorVersion >= 0x0d) {
>> - cl_node->isImmA2d = 0x1;
>> + if(requested_version.minorVersion >= 0x0d) {
>> + cl_node->isImmA2d = true;
>> + if(requested_version.minorVersion >= 0x0e) {
>> + cl_node->isImmA2e = true;
>> + }
>> + }
>> }
>> }
>>
>> 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
>> @@ -53,7 +53,7 @@ static const char *sysaAdmName = SA_IMM_
>> static const char *sysaImplName = SA_IMM_ATTR_IMPLEMENTER_NAME;
>>
>> static int imma_om_resurrect(IMMA_CB *cb, IMMA_CLIENT_NODE *cl_node, bool
>> *locked);
>> -
>> +static SaAisErrorT imma_finalizeCcb(SaImmCcbHandleT ccbHandle, bool
>> keepCcbHandleOpen);
>>
>>
>> /****************************************************************************
>> Name : SaImmOmInitialize
>> @@ -124,6 +124,9 @@ SaAisErrorT saImmOmInitialize_o2(SaImmHa
>>
>> if(requested_version.minorVersion >= 0x0d) {
>> cl_node->isImmA2d = true;
>> + if(requested_version.minorVersion >= 0x0e) {
>> + cl_node->isImmA2e = true;
>> + }
>> }
>>
>> /* Store the callback functions, if set */
>> @@ -170,9 +173,12 @@ SaAisErrorT saImmOmInitialize(SaImmHandl
>> TRACE("OM client version A.2.%u",
>> requested_version.minorVersion);
>> if(requested_version.minorVersion >= 0x0b) {
>> cl_node->isImmA2b = true;
>> - }
>> - if(requested_version.minorVersion >= 0x0d) {
>> - cl_node->isImmA2d = true;
>> + if(requested_version.minorVersion >= 0x0d) {
>> + cl_node->isImmA2d = true;
>> + if(requested_version.minorVersion >= 0x0e) {
>> + cl_node->isImmA2e = true;
>> + }
>> + }
>> }
>> }
>>
>> @@ -3259,6 +3265,40 @@ SaAisErrorT saImmOmCcbApply(SaImmCcbHand
>> }
>>
>>
>> /****************************************************************************
>> + Name : saImmOmCcbAbort
>> +
>> + Description : Aborts a CCB(id) without finalizing the ccb-handle.
>> + Discards any ccb operations currently associated with
>> the ccb-handle.
>> + If SA_AIS_OK is returned then ccb-handle can continue to
>> be used and
>> + is in the same empty state as if it had just been
>> initialized.
>> +
>> + Previously it was only possible to explicitly abort an
>> active ccb
>> + by invoking saImOmCcbFinalize() which also closes the
>> ccb-handle.
>> +
>> + This a blocking syncronous call.
>> +
>> +
>> + Arguments : ccbHandle - Ccb Handle
>> +
>> + Return Values : SA_AIS_OK; - Means the ccb contents has been discarded.
>> + and involved Ois receive abort callback.
>> + Ccb handle is still valid.
>> +
>> + SA_AIS_ERR_VERSION - Not allowed for IMM API version
>> below A.2.14.
>> + SA_AIS_ERR_BAD_OPERATION - saImmOmCcbAbort not allowed
>> on augmented ccb.
>> +
>> + Remaining returncodes identical to saImmOmFinalize.
>> +
>> +
>> +******************************************************************************/
>> +SaAisErrorT saImmOmCcbAbort(SaImmCcbHandleT ccbHandle)
>> +{
>> + return imma_finalizeCcb(ccbHandle, true);
>> +}
>> +
>> +
>> +
>> +/****************************************************************************
>> Name : saImmOmAdminOperationInvoke_2/_o2
>>
>> Description : Invoke an Administrative Operation on an object in the
>> IMM.
>> @@ -7615,7 +7655,7 @@ SaAisErrorT saImmOmAdminOwnerFinalize(Sa
>> return rc;
>> }
>>
>> -SaAisErrorT saImmOmCcbFinalize(SaImmCcbHandleT ccbHandle)
>> +static SaAisErrorT imma_finalizeCcb(SaImmCcbHandleT ccbHandle, bool
>> keepCcbHandleOpen)
>> {
>> SaAisErrorT rc = SA_AIS_OK;
>> IMMA_CB *cb = &imma_cb;
>> @@ -7661,6 +7701,12 @@ SaAisErrorT saImmOmCcbFinalize(SaImmCcbH
>> }
>>
>> if (ccb_node->mAugCcb) {
>> + if(keepCcbHandleOpen) {
>> + LOG_IN("ERR_BAD_OPERATION: saImmOmCcbAbort() not
>> allowed on augmented ccbs");
>> + rc = SA_AIS_ERR_BAD_OPERATION;
>> + goto done;
>> + }
>> +
>> if(!(ccb_node->mApplied || ccb_node->mAborted)) {
>> if(ccb_node->mAugIsTainted) {
>> ccb_node->mAborted = true;
>> @@ -7711,6 +7757,12 @@ SaAisErrorT saImmOmCcbFinalize(SaImmCcbH
>> goto done;
>> }
>>
>> + if(keepCcbHandleOpen && !(cl_node->isImmA2e)) {
>> + LOG_IN("ERR_VERSION: saImmOmCcbAbort() only supported
>> in version A.02.14 or higher");
>> + rc = SA_AIS_ERR_VERSION;
>> + goto done;
>> + }
>> +
>> timeout = cl_node->syncr_timeout;
>>
>> /* Populate the CcbFinalize event */
>> @@ -7759,13 +7811,20 @@ SaAisErrorT saImmOmCcbFinalize(SaImmCcbH
>>
>> imma_ccb_node_get(&cb->ccb_tree, &ccbHandle, &ccb_node);
>> if(ccb_node) {
>> - if(rc == SA_AIS_OK) {/* i.e. not TRY_AGAIN or TIMEOUT */
>> - imma_ccb_node_delete(cb, ccb_node);
>> - ccb_node = NULL;
>> + if(rc == SA_AIS_OK) {/* Not TRY_AGAIN or TIMEOUT */
>> + if(!keepCcbHandleOpen) {
>> + imma_ccb_node_delete(cb, ccb_node);
>> + ccb_node = NULL;
>> + }
>> } else {
>> /* TRY_AGAIN or TIMEOUT => allow user to try finalize
>> again. */
>> ccb_node->mExclusive = false;
>> }
>> + if(keepCcbHandleOpen) { /* saImmOmCcbAbort */
>> + osafassert(ccb_node);
>> + ccb_node->mApplied = true;
>> + ccb_node->mExclusive = false;
>> + }
>> }
>>
>> done:
>> @@ -7779,6 +7838,13 @@ SaAisErrorT saImmOmCcbFinalize(SaImmCcbH
>> }
>>
>>
>> +SaAisErrorT saImmOmCcbFinalize(SaImmCcbHandleT ccbHandle)
>> +{
>> + return imma_finalizeCcb(ccbHandle, false);
>> +}
>> +
>> +
>> +
>> /*
>> Internal helper function that determines if there are
>> AdminOwner handles associated with a newly resurrected client.
>> diff --git a/osaf/libs/saf/include/saImmOm_A_2_13.h
>> b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> --- a/osaf/libs/saf/include/saImmOm_A_2_13.h
>> +++ b/osaf/libs/saf/include/saImmOm_A_2_13.h
>> @@ -71,4 +71,6 @@ extern "C" {
>> }
>> #endif
>>
>> +#include <saImmOm_A_2_14.h>
>> +
>> #endif /* _SA_IMM_OM_A_2_13_H */
>> diff --git a/osaf/libs/saf/include/saImmOm_A_2_14.h
>> b/osaf/libs/saf/include/saImmOm_A_2_14.h
>> new file mode 100644
>> --- /dev/null
>> +++ b/osaf/libs/saf/include/saImmOm_A_2_14.h
>> @@ -0,0 +1,46 @@
>> +/* -*- OpenSAF -*-
>> + *
>> + * (C) Copyright 2014 The OpenSAF Foundation
>> + *
>> + * This program is distributed in the hope that it will be useful, but
>> + * WITHOUT ANY WARRANTY; without even the implied warranty of
>> MERCHANTABILITY
>> + * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
>> + * under the GNU Lesser General Public License Version 2.1, February 1999.
>> + * The complete license can be accessed from the following location:
>> + * http://opensource.org/licenses/lgpl-license.php
>> + * See the Copying file included with the OpenSAF distribution for full
>> + * licensing terms.
>> + *
>> + * Author(s): Ericsson AB
>> + */
>> +
>> +/*
>> + * DESCRIPTION:
>> + * This file provides the suggested additions to the C language binding
>> for
>> + * the Service Availability(TM) Forum Information Model Management
>> Service (IMM).
>> + * It contains only the prototypes and type definitions that are part of
>> this
>> + * proposed addition.
>> + * These additions are currently NON STANDARD. But the intention is to
>> get these
>> + * additions approved formally by SAF in the future.
>> + *
>> + * For detailed explanation of the new API, see
>> osaf/services/saf/immsv/README.
>> + */
>> +
>> +
>> +#ifndef _SA_IMM_OM_A_2_14_H
>> +#define _SA_IMM_OM_A_2_14_H
>> +
>> +#ifdef __cplusplus
>> +extern "C" {
>> +#endif
>> +
>> +/* 4.8.x saImmOmCcb */
>> +
>> + extern SaAisErrorT
>> + saImmOmCcbAbort(SaImmCcbHandleT ccbHandle);
>> +
>> +#ifdef __cplusplus
>> +}
>> +#endif
>> +
>> +#endif /* _SA_IMM_OM_A_2_14_H */
>> diff --git a/tests/immsv/common/immtest.c b/tests/immsv/common/immtest.c
>> --- a/tests/immsv/common/immtest.c
>> +++ b/tests/immsv/common/immtest.c
>> @@ -21,8 +21,8 @@
>> #include <pthread.h>
>> #include "immtest.h"
>>
>> -const SaVersionT constImmVersion = {'A', 0x02, 0x0d};
>> -SaVersionT immVersion = {'A', 0x02, 0x0d};
>> +const SaVersionT constImmVersion = {'A', 0x02, 0x0e};
>> +SaVersionT immVersion = {'A', 0x02, 0x0e};
>> SaAisErrorT rc;
>> SaImmHandleT immOmHandle;
>> SaImmHandleT immOiHandle;
>> diff --git a/tests/immsv/management/test_saImmOmCcbApply.c
>> b/tests/immsv/management/test_saImmOmCcbApply.c
>> --- a/tests/immsv/management/test_saImmOmCcbApply.c
>> +++ b/tests/immsv/management/test_saImmOmCcbApply.c
>> @@ -94,3 +94,98 @@ done:
>> safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
>> }
>>
>> +void saImmOmCcbAbort_01(void)
>> +{
>> + TRACE_ENTER();
>> + const SaImmAdminOwnerNameT adminOwnerName = (SaImmAdminOwnerNameT)
>> __FUNCTION__;
>> + SaImmAdminOwnerHandleT ownerHandle;
>> + SaImmCcbHandleT ccbHandle;
>> + SaNameT rdn = {strlen("Obj1"), "Obj1"};
>> + SaNameT* nameValues[] = {&rdn};
>> + SaImmAttrValuesT_2 v2 = {"rdn", SA_IMM_ATTR_SANAMET, 1,
>> (void**)nameValues};
>> + SaUint32T int1Value1 = 7;
>> + SaUint32T* int1Values[] = {&int1Value1};
>> + SaImmAttrValuesT_2 v1 = {"attr1", SA_IMM_ATTR_SAUINT32T, 1,
>> (void**)int1Values};
>> + const SaImmAttrValuesT_2 * attrValues[] = {&v1, &v2, NULL};
>> + const SaNameT *objectNames[] = {&rootObj, NULL};
>> +
>> + safassert(saImmOmInitialize(&immOmHandle, &immOmCallbacks,
>> &immVersion), SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerInitialize(immOmHandle, adminOwnerName,
>> + SA_TRUE, &ownerHandle), SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerSet(ownerHandle, objectNames, SA_IMM_ONE),
>> SA_AIS_OK);
>> + safassert(saImmOmCcbInitialize(ownerHandle, 0, &ccbHandle), SA_AIS_OK);
>> + safassert(saImmOmCcbAbort(ccbHandle), SA_AIS_OK); /* Abort on pristine
>> ccb handle should be ok. */
>> + safassert(saImmOmCcbObjectCreate_2(ccbHandle, configClassName,
>> + &rootObj, attrValues), SA_AIS_OK);
>> +
>> + /* abort the ccb */
>> + if ((rc = saImmOmCcbAbort(ccbHandle)) != SA_AIS_OK)
>> + goto done;
>> +
>> + safassert(saImmOmCcbAbort(ccbHandle), SA_AIS_OK); /* Redundant abort
>> should be ok. */
>> +
>> + safassert(saImmOmCcbFinalize(ccbHandle), SA_AIS_OK);
>> +
>> +done:
>> + test_validate(rc, SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerFinalize(ownerHandle), SA_AIS_OK);
>> + safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
>> + TRACE_LEAVE();
>> +}
>> +
>> +void saImmOmCcbAbort_02(void)
>> +{
>> + TRACE_ENTER();
>> + const SaImmAdminOwnerNameT adminOwnerName = (SaImmAdminOwnerNameT)
>> __FUNCTION__;
>> + SaImmAdminOwnerHandleT ownerHandle;
>> + SaImmCcbHandleT ccbHandle;
>> + SaNameT rdn = {strlen("Obj1"), "Obj1"};
>> + SaNameT* nameValues[] = {&rdn};
>> + SaImmAttrValuesT_2 v2 = {"rdn", SA_IMM_ATTR_SANAMET, 1,
>> (void**)nameValues};
>> + SaUint32T int1Value1 = 7;
>> + SaUint32T* int1Values[] = {&int1Value1};
>> + SaImmAttrValuesT_2 v1 = {"attr1", SA_IMM_ATTR_SAUINT32T, 1,
>> (void**)int1Values};
>> + const SaImmAttrValuesT_2 * attrValues[] = {&v1, &v2, NULL};
>> + const SaNameT *objectNames[] = {&rootObj, NULL};
>> + const SaNameT objectName =
>> + {strlen("Obj1,rdn=root"), "Obj1,rdn=root"};
>> +
>> + safassert(saImmOmInitialize(&immOmHandle, &immOmCallbacks,
>> &immVersion), SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerInitialize(immOmHandle, adminOwnerName,
>> + SA_TRUE, &ownerHandle), SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerSet(ownerHandle, objectNames, SA_IMM_ONE),
>> SA_AIS_OK);
>> + safassert(saImmOmCcbInitialize(ownerHandle, 0, &ccbHandle), SA_AIS_OK);
>> + safassert(saImmOmCcbObjectCreate_2(ccbHandle, configClassName,
>> + &rootObj, attrValues), SA_AIS_OK);
>> +
>> + /* abort the ccb with the object-create. */
>> + if ((rc = saImmOmCcbAbort(ccbHandle)) != SA_AIS_OK)
>> + goto done;
>> +
>> + /* continue with ccb handle after abort. New attempt to create same
>> object
>> + should work. */
>> + if ((rc = saImmOmCcbObjectCreate_2(ccbHandle, configClassName, &rootObj,
>> + attrValues) != SA_AIS_OK)) {
>> + goto done;
>> + }
>> +
>> + /* apply should work. */
>> + if((rc = saImmOmCcbApply(ccbHandle)) != SA_AIS_OK)
>> + goto done;
>> +
>> + /* Set up delete and abort it. */
>> + safassert(saImmOmCcbObjectDelete(ccbHandle, &objectName), SA_AIS_OK);
>> + safassert(saImmOmCcbAbort(ccbHandle), SA_AIS_OK);
>> +
>> + /* Finaly use ccb-handle to delete object. */
>> + safassert(saImmOmCcbObjectDelete(ccbHandle, &objectName), SA_AIS_OK);
>> + safassert(saImmOmCcbApply(ccbHandle), SA_AIS_OK);
>> + safassert(saImmOmCcbFinalize(ccbHandle), SA_AIS_OK);
>> +
>> +done:
>> + test_validate(rc, SA_AIS_OK);
>> + safassert(saImmOmAdminOwnerFinalize(ownerHandle), SA_AIS_OK);
>> + safassert(saImmOmFinalize(immOmHandle), SA_AIS_OK);
>> + TRACE_LEAVE();
>> +}
>> +
>> diff --git a/tests/immsv/management/test_saImmOmCcbInitialize.c
>> b/tests/immsv/management/test_saImmOmCcbInitialize.c
>> --- a/tests/immsv/management/test_saImmOmCcbInitialize.c
>> +++ b/tests/immsv/management/test_saImmOmCcbInitialize.c
>> @@ -164,6 +164,8 @@ extern void saImmOmCcbApply_01(void);
>> extern void saImmOmCcbApply_02(void);
>> extern void saImmOmCcbFinalize_01(void);
>> extern void saImmOmCcbFinalize_02(void);
>> +extern void saImmOmCcbAbort_01(void);
>> +extern void saImmOmCcbAbort_02(void);
>>
>> __attribute__ ((constructor)) static void
>> saImmOmInitialize_constructor(void)
>> {
>> @@ -235,5 +237,7 @@ extern void saImmOmCcbFinalize_02(void);
>>
>> test_case_add(6, saImmOmCcbObjectModify_2_08,
>> "saImmOmCcbObjectModify_2 SA_IMM_ATTR_DELETE multi/single - SA_AIS_OK");
>> test_case_add(6, saImmOmCcbObjectModify_2_07,
>> "saImmOmCcbObjectModify_2 SA_IMM_ATTR_DELETE multi/multi - SA_AIS_OK");
>> + test_case_add(6, saImmOmCcbAbort_01, "saImmOmCcbAbort - SA_AIS_OK");
>> + test_case_add(6, saImmOmCcbAbort_02, "saImmOmCcbAbort - SA_AIS_OK on
>> continued ccb handle usage.");
>> }
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Opensaf-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>>
>>
>
> ------------------------------------------------------------------------------
> Put Bad Developers to Shame
> Dominate Development with Jenkins Continuous Integration
> Continuously Automate Build, Test & Deployment
> Start a new project now. Try Jenkins in the cloud.
> http://p.sf.net/sfu/13600_Cloudbees
> _______________________________________________
> Opensaf-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>
>
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel