Hi zoran,

while pushing, i will incorporate your comments.

/Neel.
On Friday 02 May 2014 05:09 PM, Zoran Milinkovic wrote:
> Hi Neelakanta,
>
> I have 2 comments on next block:
>      867         if(!isSchemaChangeEnabled && ownerHandle1) {
>      868                 error = 
> immutil_saImmOmAdminOwnerFinalize(ownerHandle1);
>      869                 if (SA_AIS_OK != error) {
>      870                         fprintf(stderr, "error - 
> saImmOmAdminOwnerFinalize FAILED: %s\n", saf_error(error));
>      871                         exit(EXIT_FAILURE);
>      872                 }
>      873         }
>
> 1. It should be moved under "done:" label, so that ownerHandle1 is released 
> if an error occurs in the code above the block.
> 2. In line 871, "exit(EXIT_FAILURE);" should be replaced with "rc = 
> EXIT_FAILURE;"
>
> Reviewed and tested.
> Ack from me when two commented issues are fixed.
> No need for sending a new code for the review.
>
> Best regards,
> Zoran
>
> -----Original Message-----
> From: reddy.neelaka...@oracle.com [mailto:reddy.neelaka...@oracle.com]
> Sent: den 1 maj 2014 11:32
> To: Anders Björnerstedt; Zoran Milinkovic
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] Imm:Make immcfg aware of safImmService admin owner 
> for opensafImm=opensafImm, safApp=safImmService [#840]
>
>   osaf/tools/safimm/immcfg/imm_cfg.c |  44 
> +++++++++++++++++++++++++++----------
>   1 files changed, 32 insertions(+), 12 deletions(-)
>
>
> Enable or Disable notififications using immcfg does not work on a system 
> running 2PBE.
> In the 2PBE the IMM internal object 
> opensafImm=opensafImm,safApp=safImmService has
> admin owner safImmService. To modify the IMM object the adminoner has to be
> set to safImmService.
>
> diff --git a/osaf/tools/safimm/immcfg/imm_cfg.c 
> b/osaf/tools/safimm/immcfg/imm_cfg.c
> --- a/osaf/tools/safimm/immcfg/imm_cfg.c
> +++ b/osaf/tools/safimm/immcfg/imm_cfg.c
> @@ -42,6 +42,7 @@
>   #include <saImmOm.h>
>   #include <immutil.h>
>   #include <saf_error.h>
> +#include <immsv_api.h>
>   
>   
>   static SaVersionT immVersion = { 'A', 2, 13 };
> @@ -385,7 +386,7 @@ static SaImmAttrValuesT_2 *new_attr_valu
>    * @return int
>    */
>   int object_create(const SaNameT **objectNames, const SaImmClassNameT 
> className,
> -     SaImmAdminOwnerHandleT ownerHandle, char **optargs, int optargs_len)
> +      char **optargs, int optargs_len)
>   {
>       SaAisErrorT error;
>       int i;
> @@ -540,7 +541,7 @@ done:
>    *
>    * @return int
>    */
> -int object_modify(const SaNameT **objectNames, SaImmAdminOwnerHandleT 
> ownerHandle, char **optargs, int optargs_len)
> +int object_modify(const SaNameT **objectNames, char **optargs, int 
> optargs_len)
>   {
>       SaAisErrorT error;
>       int i;
> @@ -626,7 +627,7 @@ int object_modify(const SaNameT **object
>    *
>    * @return int
>    */
> -int object_delete(const SaNameT **objectNames, SaImmAdminOwnerHandleT 
> ownerHandle)
> +int object_delete(const SaNameT **objectNames)
>   {
>       SaAisErrorT error;
>       int rc = EXIT_FAILURE;
> @@ -740,8 +741,8 @@ static int admin_owner_clear(const SaNam
>       return 0;
>   }
>   
> -static int class_change(SaImmHandleT immHandle, const SaImmAdminOwnerNameT 
> adminOwnerName,
> -             const SaImmClassNameT className, const char **attributeNames, 
> attr_notify_t attrNotify)
> +static int class_change(SaImmHandleT immHandle, const SaImmClassNameT 
> className,
> +     const char **attributeNames, attr_notify_t attrNotify)
>   {
>       SaAisErrorT error;
>       SaImmAccessorHandleT accessorHandle;
> @@ -755,6 +756,7 @@ static int class_change(SaImmHandleT imm
>                                                                               
> 2 - PBE disabled                        */
>       SaImmClassCategoryT classCategory;
>       SaImmAttrDefinitionT_2 **attrDefinitions = NULL;
> +     SaImmAdminOwnerHandleT ownerHandle1 = 0;
>       int rc = 0;
>   
>       int attrNum = 0;
> @@ -809,6 +811,14 @@ static int class_change(SaImmHandleT imm
>   
>               attrNum++;
>       }
> +     if(!isSchemaChangeEnabled) {
> +             error = immutil_saImmOmAdminOwnerInitialize(immHandle, 
> OPENSAF_IMM_SERVICE_NAME, SA_TRUE, &ownerHandle1);
> +             if (error != SA_AIS_OK) {
> +                     fprintf(stderr, "error - saImmOmAdminOwnerInitialize 
> FAILED: %s\n", saf_error(error));
> +                     rc = EXIT_FAILURE;
> +                     goto done;
> +             }
> +     }
>   
>       /* if schema change is disable, then turn it on until the class change 
> is done */
>       if(!isSchemaChangeEnabled) {
> @@ -817,13 +827,13 @@ static int class_change(SaImmHandleT imm
>               SaImmAdminOperationParamsT_2 param = { "opensafImmNostdFlags", 
> SA_IMM_ATTR_SAUINT32T, (SaImmAttrValueT)&nostdFlag };
>               const SaImmAdminOperationParamsT_2 *params[2] = { &param, NULL 
> };
>   
> -             if((error = immutil_saImmOmAdminOwnerSet(ownerHandle, 
> objectNameList, SA_IMM_ONE)) != SA_AIS_OK) {
> +             if((error = immutil_saImmOmAdminOwnerSet(ownerHandle1, 
> objectNameList, SA_IMM_ONE)) != SA_AIS_OK) {
>                       fprintf(stderr, "Cannot set admin owner on 
> 'opensafImm=opensafImm,safApp=safImmService'\n");
>                       rc = EXIT_FAILURE;
>                       goto done;
>               }
>   
> -             if((error = immutil_saImmOmAdminOperationInvoke_2(ownerHandle, 
> &opensafImmObjectName, 1, 1, params, &err, SA_TIME_ONE_SECOND * 60)) != 
> SA_AIS_OK) {
> +             if((error = immutil_saImmOmAdminOperationInvoke_2(ownerHandle1, 
> &opensafImmObjectName, 1, 1, params, &err, SA_TIME_ONE_SECOND * 60)) != 
> SA_AIS_OK) {
>                       fprintf(stderr, "Failed to enable schema changes. 
> Error: %d\n", error);
>                       rc = EXIT_FAILURE;
>                       goto done;
> @@ -848,11 +858,21 @@ static int class_change(SaImmHandleT imm
>               SaImmAdminOperationParamsT_2 param = { "opensafImmNostdFlags", 
> SA_IMM_ATTR_SAUINT32T, (SaImmAttrValueT)&nostdFlag };
>               const SaImmAdminOperationParamsT_2 *params[2] = { &param, NULL 
> };
>   
> -             if((error = immutil_saImmOmAdminOperationInvoke_2(ownerHandle, 
> &opensafImmObjectName, 0, 2, params, &err, SA_TIME_ONE_SECOND * 60)) != 
> SA_AIS_OK) {
> +             if((error = immutil_saImmOmAdminOperationInvoke_2(ownerHandle1, 
> &opensafImmObjectName, 0, 2, params, &err, SA_TIME_ONE_SECOND * 60)) != 
> SA_AIS_OK) {
>                       fprintf(stderr, "Failed to disable schema changes. 
> Error: %d\n", error);
>                       rc = EXIT_FAILURE;
>               }
>       }
> +     
> +     if(!isSchemaChangeEnabled && ownerHandle1) {
> +             error = immutil_saImmOmAdminOwnerFinalize(ownerHandle1);
> +             if (SA_AIS_OK != error) {
> +                     fprintf(stderr, "error - saImmOmAdminOwnerFinalize 
> FAILED: %s\n", saf_error(error));
> +                     exit(EXIT_FAILURE);
> +             }
> +     }
> +     
> +
>   
>   done:
>       if(attrDefinitions)
> @@ -1408,13 +1428,13 @@ static int imm_operation(int argc, char
>   
>       switch (op) {
>       case CREATE_OBJECT:
> -             rc = object_create((const SaNameT **)objectNames, className, 
> ownerHandle, optargs, optargs_len);
> +             rc = object_create((const SaNameT **)objectNames, className, 
> optargs, optargs_len);
>               break;
>       case DELETE_OBJECT:
> -             rc = object_delete((const SaNameT **)objectNames, ownerHandle);
> +             rc = object_delete((const SaNameT **)objectNames);
>               break;
>       case MODIFY_OBJECT:
> -             rc = object_modify((const SaNameT **)objectNames, ownerHandle, 
> optargs, optargs_len);
> +             rc = object_modify((const SaNameT **)objectNames, optargs, 
> optargs_len);
>               break;
>       case DELETE_CLASS:
>               rc = class_delete(classNames, immHandle);
> @@ -1423,7 +1443,7 @@ static int imm_operation(int argc, char
>               rc = admin_owner_clear((const SaNameT **)objectNames, 
> immHandle);
>               break;
>       case CHANGE_CLASS :
> -             rc = class_change(immHandle, adminOwnerName, className, (const 
> char **)attributeNames, attrNotify);
> +             rc = class_change(immHandle, className, (const char 
> **)attributeNames, attrNotify);
>               break;
>       case TRANSACTION_MODE :
>               rc = start_cmd();


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.  Get 
unparalleled scalability from the best Selenium testing platform available.
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to