Re: [devel] [PATCH 1 of 2] log: fix to remove a redundant double quotation [#1463]

2017-03-08 Thread Vu Minh Nguyen
Ack

Regards, Vu

> -Original Message-
> From: Canh Van Truong [mailto:canh.v.tru...@dektech.com.au]
> Sent: Wednesday, March 8, 2017 2:13 PM
> To: lennart.l...@ericsson.com; mahesh.va...@oracle.com;
> vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 2] log: fix to remove a redundant double quotation
> [#1463]
> 
>  src/log/logd/lgs_fmt.cc |  3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> 
> When sending a log record which is longer than limited quota,
> there will be a double quotation mark although there is not double
quotation
> in
> token format.
> 
> The patch remove it.
> 
> diff --git a/src/log/logd/lgs_fmt.cc b/src/log/logd/lgs_fmt.cc
> --- a/src/log/logd/lgs_fmt.cc
> +++ b/src/log/logd/lgs_fmt.cc
> @@ -1362,7 +1362,6 @@ int lgs_format_log_record(SaLogRecordT *
>  dest[fixedLogRecordSize - 1] = '\n';
>  i = fixedLogRecordSize;
>} else if ((fixedLogRecordSize > 0) && (i >= fixedLogRecordSize)) {
> -dest[fixedLogRecordSize - 2] = (SaInt8T)'\"';
>  dest[fixedLogRecordSize - 1] = '\n';
>  i = fixedLogRecordSize;
>}
> @@ -1375,11 +1374,9 @@ int lgs_format_log_record(SaLogRecordT *
>/* There can be situations when the filesize is as small as the
maxrecsize.
> * For eg:- By default for the application streams max file size is
1024
> */
> -  dest[logFileSize - 2] = (SaInt8T)'\"';
>dest[logFileSize - 1] = '\n';
>i = logFileSize;
>  } else {
> -  dest[dest_size - 2] = (SaInt8T)'\"';
>dest[dest_size - 1] = '\n';
>i = dest_size;
>  }


--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] AMFND: Ensure su operational message synchronizes with component failover sequence [#2233]

2017-03-08 Thread minh chau
Hi Praveen,

As you choose V2, please push it and update the PR where this change is 
related to.

Thanks,
Minh

On 08/03/17 18:07, praveen malviya wrote:
>
> On 08-Mar-17 9:11 AM, minh chau wrote:
>> Hi Praveen,
>>
>> I don't think we need both patches, one of those is enough to fix the
>> problem of comp f/o in case unassigned component. When we have both
>> patches, V2 patch will make reinstantiation of failed-unassigned comp
>> after assignment's removal, so V1 is not needed anymore because su
>> operational message (enabled) will always be sent after switchover.
>> I am not 100% sure how is the impact of moving reinstantiation of
>> component after SI assignment's removal, but basically this change of
>> behavior is exposed to applications
> [Praveen] I have checked the comment in the ticket #2233 now which 
> contains the problem description in SC absence case. I think V2 patch 
> will not allow two su_oper message as recovery can be done only after 
> first controller comes up. So I prefer V2 as a solution. With v2 comp 
> instantiation is being done after completion of recovery for both 
> assigned and unassigned components.
>
> However, when comp-failover recovery is implemented in spec compliant 
> way for N-Way and N-Way active model, then surely we need to 
> instantiate component as early as possible.
>
>> One potential impact I can think of, in either headless or normal
>> cluster, is that failed component will have less time for its
>> instantiation before receiving csi assignment (since reinstantiation of
>> failed component has been started regardless SI switchover), so it could
>> be a timing issue for application due to application's specific
>> dependencies in instantiation phase.
> [Praveen] This I did not get fully. But if instantiationlevel is 
> configured for components in su, then instantiation of failed 
> component of any level will not lead to instantiation of components of 
> other levels:
>
> from spec :"The instantiation level is, above all, a means to limit 
> the load on the system during the instantiation process."
>
>>
>> Thanks,
>> Minh
>>
>> On 07/03/17 16:34, praveen malviya wrote:
>>> Hi Minh,
>>>
>>> Is there any harm if both the patches are merged? One patch adds
>>> strict checks for message ordering in case of comp-failover recovery
>>> of assigned or non-assigned component. Another patch ensures that if
>>> an assigned or non-assigned comp faults with comp-faiover recovery
>>> then first AMF will switchover whole SU (current implementation
>>> irrespective of red models) and after completion of switchover
>>> re-instantiation of failed comp will be attempted.
>>> Also, I think, from headless perspective, the strict check of patch V1
>>> is important when comp-failover occurs in the absence of SCs.
>>> So I have a minor query here: Is there any impact of late
>>> instantiation of comp when comp-failover occurs in SCs Absence?
>>>
>>>
>>> Also I think now an enhancement ticket should be raised for
>>> implementation of comp-failover recovery as per spec for N-Way and
>>> N-Way active model.
>>>
>>>
>>> Thanks,
>>> Praveen
>>>
>>>
>>>
>>> On 07-Mar-17 4:10 AM, minh chau wrote:
 Hi Praveen,

 Please see comments with [Minh5]

 Thanks,
 Minh

 On 06/03/17 17:52, praveen malviya wrote:
> Hi Minh,
>
> Please see inline with [Praveen].
>
> Thanks,
> Praveen
>
> On 03-Mar-17 5:39 PM, minh chau wrote:
>> Hi Praveen,
>>
>> I have two comments with [Minh4].
>>
>> Thanks
>> Minh
>>
>> On 02/03/17 20:49, praveen malviya wrote:
>>> Hi Minh,
>>> Please see response with [Praveen].
>>>
>>> Thanks,
>>> Praveen
>>>
>>>
>>>
>>> On 02-Mar-17 1:43 PM, minh chau wrote:
 Hi,

 Thanks Gary.
 @Nagu, Praveen: Have you had time to check the example in my
 previous
 email?
 The ticket #2179 is about to document that full escalation is
 supported
 for SC absence feature, it is waiting for fix of #2233.
 I think there's not big change in code for #2233, it's a matter of
 decision to make for re-instantiation of failed component.

 Thanks,
 Minh

 On 01/03/17 15:42, Gary Lee wrote:
> Hi
>
> It seems the component should be re-instantiated if it has no 
> CSI.
> Whether or not there is an SI assigned should be irrelevant?
>
> Thanks
> Gary
>
> -Original Message-
> From: minh chau 
> Date: Thursday, 23 February 2017 at 3:16 pm
> To: Nagendra Kumar , Praveen Malviya
> 
> Cc: , gary 
> ,
> ,
> 

Re: [devel] [PATCH 1 of 1] imm: Fix all Cppcheck 1.77 issues [#2333]

2017-03-08 Thread Neelakanta Reddy
Hi Mahesh,

Reviewed and tested the patch.
Ack.

/Neel.

On 2017/03/03 11:12 AM, mahesh.va...@oracle.com wrote:
>   src/imm/agent/imma_db.cc |   8 +---
>   src/imm/agent/imma_mds.cc|   6 +--
>   src/imm/agent/imma_oi_api.cc |   3 +-
>   src/imm/agent/imma_om_api.cc |  19 +
>   src/imm/agent/imma_proc.cc   |  12 ++
>   src/imm/immd/immd_db.c   |   9 +---
>   src/imm/immd/immd_evt.c  |  29 ++-
>   src/imm/immd/immd_mbcsv.c|   9 +---
>   src/imm/immd/immd_mds.c  |  17 ++--
>   src/imm/immnd/ImmModel.cc|  80 
> ---
>   src/imm/immnd/immnd_clm.c|   4 +-
>   src/imm/immnd/immnd_db.c |   7 +--
>   src/imm/immnd/immnd_evt.c|  29 +--
>   src/imm/immnd/immnd_main.c   |   4 +-
>   src/imm/immnd/immnd_mds.c|  10 +---
>   src/imm/immnd/immnd_proc.c   |   7 +--
>   16 files changed, 98 insertions(+), 155 deletions(-)
>
>
> Except never used functions all other issues are fixed  of below,
> some UN-pushed enhancement may be using those functions.
>
> [staging/src/imm/immnd/ImmModel.cc:2985] -> 
> [staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 
> 'increment&' is redundant or there is possible null pointer 
> dereference: immObject.
> [staging/src/imm/immnd/ImmModel.cc:2986] -> 
> [staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 
> 'increment&' is redundant or there is possible null pointer 
> dereference: immObject.
> [staging/src/imm/immnd/ImmModel.cc:10798]: (style) C-style pointer casting
> [staging/src/imm/immnd/ImmModel.cc:11027]: (style) C-style pointer casting
> [staging/src/imm/immnd/ImmModel.cc:12510]: (style) C-style pointer casting
> [staging/src/imm/immnd/ImmModel.cc:13921]: (style) C-style pointer casting
> [staging/src/imm/immnd/ImmModel.cc:2980] -> 
> [staging/src/imm/immnd/ImmModel.cc:2984]: (style) Variable 'immObject' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:7141] -> 
> [staging/src/imm/immnd/ImmModel.cc:7154]: (style) Variable 'current' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:7445] -> 
> [staging/src/imm/immnd/ImmModel.cc:7455]: (style) Variable 'ccb' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:7448] -> 
> [staging/src/imm/immnd/ImmModel.cc:7460]: (style) Variable 'oMut' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:7541] -> 
> [staging/src/imm/immnd/ImmModel.cc:7550]: (style) Variable 'afim' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:7579] -> 
> [staging/src/imm/immnd/ImmModel.cc:7589]: (style) Variable 'afim' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:14144] -> 
> [staging/src/imm/immnd/ImmModel.cc:14148]: (style) Variable 'immObject' is 
> reassigned a value before the old one has been used.
> [staging/src/imm/immnd/ImmModel.cc:673]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:905]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:931]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:1041]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:1074]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:1882]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:2031]: (style) The scope of the variable 
> 'ix' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:5462]: (style) The scope of the variable 
> 'ai' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:16545]: (style) The scope of the variable 
> 'sendCompletedToSlave' can be reduced.
> [staging/src/imm/immnd/ImmModel.cc:19363]: (style) Unused variable: i3
> [staging/src/imm/immnd/ImmModel.cc:104]: (style) Struct 
> 'ImplementerCcbAssociation' has a constructor with 1 argument that is not 
> explicit.
> [staging/src/imm/immnd/ImmModel.cc:118]: (style) Struct 'ClassInfo' has a 
> constructor with 1 argument that is not explicit.
> [staging/src/imm/immnd/ImmModel.cc:269]: (style) Struct 'ObjectMutation' has 
> a constructor with 1 argument that is not explicit.
> [staging/src/imm/immnd/ImmModel.cc:576]: (style) Struct 'AttrFlagIncludes' 
> has a constructor with 1 argument that is not explicit.
> [staging/src/imm/immnd/ImmModel.cc:587]: (style) Struct 'IdIs' has a 
> constructor with 1 argument that is not explicit.
> [staging/src/imm/immnd/ImmModel.cc:598]: (style) Struct 'CcbIdIs' has a 
> constructor with 1 argument that is not explicit.
> [staging/src/imm/immnd/ImmModel.cc:4862]: (style) Struct 'AttrDescriptionGet' 
> has a constructor with 1 argument that is not explicit.
> 

Re: [devel] [PATCH 1 of 2] mds: handle memory leak [#1860]

2017-03-08 Thread Vo Minh Hoang
Dear Anders Widell,

 

Yes, as you mentioned, this patch offer a change for this behavior.

 

The reason is as bellowing:

*   Currently, when API succeeds, memory is free in user defined
callback, not really by MDS itself. Only in some cases API fails, MDS frees
memory, in some cases MDS does not. So source code is not strictly same as
PR document.
*   MDS do not have method to check user init memory by using the macro
m_MDS_ALLOC_DIRECT_BUFF(x) so this behavior is non-defensive coding.
*   Personally, I think that memory should be init/free in the same
level except specific reason, I cannot find reason in this case.

 

Thank you and best regards,

Hoang

 

From: Anders Widell [mailto:anders.wid...@ericsson.com] 
Sent: Wednesday, March 8, 2017 9:49 PM
To: Hoang Vo ; mahesh.va...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 2] mds: handle memory leak [#1860]

 

Hi!

I am trying to understand how these MDS APIs are intended to work. When I
read Section 3.2.9.1.7 in OpenSAF_MDSv_PR.odt in the opensaf-internal-docs
Mercurial repository, it looks like it is the responsibility of the MDS
library to free the provided buffer that was passed in to MDS_DIRECT_SEND,
no matter if the MDS API call succeeds or fails. Doesn't this patch change
this behaviour in MDS?

 

regards,

Anders Widell

 

On 03/06/2017 09:00 AM, Hoang Vo wrote:

 src/base/sysf_mem.c|   3 +++
 src/mds/mds_c_sndrcv.c |  34 +++---
 2 files changed, 18 insertions(+), 19 deletions(-)
 
 
Some error handling does not clean internal memory.
Error handling in dirrect send case clear user memory seem inconsistence,
mds should let creater manage its memory in error cases.
 
action: implement as proposed.
 
diff --git a/src/base/sysf_mem.c b/src/base/sysf_mem.c
--- a/src/base/sysf_mem.c
+++ b/src/base/sysf_mem.c
@@ -1,6 +1,7 @@
 /*  -*- OpenSAF  -*-
  *
  * (C) Copyright 2008 The OpenSAF Foundation
+ * Copyright Ericsson AB 2017 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
@@ -428,6 +429,8 @@ USRBUF *sysf_alloc_pkt(unsigned char poo
 if (pool_id >= UB_MAX_POOLS) {
 m_PMGR_UNLK(_ub_pool_mgr.lock);
 m_LEAP_DBG_SINK_VOID;
+m_NCS_MEM_FREE(ub, NCS_MEM_REGION_IO_DATA_HDR,
NCS_SERVICE_ID_OS_SVCS, 2);
+ub = (USRBUF *)0;
 return NULL;
 }
 ud = (USRDATA
*)gl_ub_pool_mgr.pools[pool_id].mem_alloc(sizeof(USRDATA), pool_id,
priority);
diff --git a/src/mds/mds_c_sndrcv.c b/src/mds/mds_c_sndrcv.c
--- a/src/mds/mds_c_sndrcv.c
+++ b/src/mds/mds_c_sndrcv.c
@@ -1,6 +1,7 @@
 /*  -*- OpenSAF  -*-
  *
  * (C) Copyright 2008 The OpenSAF Foundation
+ * Copyright Ericsson AB 2017 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY
@@ -420,10 +421,6 @@ static uint32_t mds_mcm_direct_send(NCSM
  memset(, 0, sizeof(req));
  if ((info->info.svc_direct_send.i_priority < MDS_SEND_PRIORITY_LOW) ||
  (info->info.svc_direct_send.i_priority > MDS_SEND_PRIORITY_VERY_HIGH))
{
-if (info->info.svc_direct_send.i_direct_buff != NULL) {
-
m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
-info->info.svc_direct_send.i_direct_buff = NULL;
-}
 m_MDS_LOG_ERR("MDS_SND_RCV: Priority defined is not in range\n");
 return NCSCC_RC_FAILURE;
  }
@@ -432,13 +429,11 @@ static uint32_t mds_mcm_direct_send(NCSM
 m_MDS_LOG_ERR("MDS_SND_RCV: Send Message Direct Buff is NULL\n");
 return NCSCC_RC_FAILURE;
  } else if (info->info.svc_direct_send.i_direct_buff_len >
MDS_DIRECT_BUF_MAXSIZE) {
-mds_free_direct_buff(info->info.svc_direct_send.i_direct_buff);
 m_MDS_LOG_ERR("MDS_SND_RCV: Send Message Direct Buff Len is greater
than SEND SIZE\n");
 return NCSCC_RC_FAILURE;
  }
 
  if ((info->info.svc_direct_send.i_to_svc == 0) || (info->i_svc_id == 0)) {
-m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
 m_MDS_LOG_ERR("MDS_SND_RCV: Source or Dest service provided is
Null, src svc_id = %s(%d), dest svc_id = %s(%d) \n",
   get_svc_names(info->i_svc_id), info->i_svc_id,
get_svc_names(info->info.svc_direct_send.i_to_svc),
info->info.svc_direct_send.i_to_svc);
 return NCSCC_RC_FAILURE;
@@ -633,11 +628,6 @@ static uint32_t mds_mcm_direct_send(NCSM
 status = NCSCC_RC_FAILURE;
 break;
  }
- if (status == MDS_INT_RC_DIRECT_SEND_FAIL) {
-/* Free the MDS Direct Buff */
-m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
-status = NCSCC_RC_FAILURE;
- }
  return status;
 }
 
@@ -2014,6 +2004,7 @@ static uint32_t mcm_process_await_active
 

Re: [devel] [PATCH 1 of 1] imm: fix log level for saClmDispatch [#2353]

2017-03-08 Thread Neelakanta Reddy
Hi Zoran,

Reviewed the patch.
Ack.

/Neel.

On 2017/03/07 09:34 PM, Zoran Milinkovic wrote:
>   src/imm/immnd/immnd_main.c |  3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
>
> If saClmDispatch fails with SA_AIS_ERR_BAD_HANDLE error, the message will be 
> logged with warning level and CLM handle will be reinitialized.
> All other saClmDispatch errors will be logged with error level.
>
> diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c
> --- a/src/imm/immnd/immnd_main.c
> +++ b/src/imm/immnd/immnd_main.c
> @@ -407,14 +407,15 @@ int main(int argc, char *argv[])
>   
>   if (fds[FD_CLM].revents & POLLIN) {
>   if ((error = saClmDispatch(immnd_cb->clm_hdl, 
> SA_DISPATCH_ALL)) != SA_AIS_OK) {
> - LOG_ER("saClmDispatch failed: %u", 
> error);
>   if(error == SA_AIS_ERR_BAD_HANDLE){
> + LOG_WA("saClmDispatch failed: 
> %u", error);
>   LOG_NO("Re-initializing with 
> CLMS");
>   
> saClmFinalize(immnd_cb->clm_hdl);
>   
> immnd_clm_node_cleanup(immnd_cb);
>   immnd_cb->clmSelectionObject = 
> -1;
>   immnd_init_with_clm();
>   } else {
> + LOG_ER("saClmDispatch failed: 
> %u", error);
>   break;
>   }
>   }


--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 1] log: fix compiling the log unit test failed [#2356]

2017-03-08 Thread Lennart Lund
Hi Vu

Ack
Can be built, test pass

Thanks
Lennart

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: den 8 mars 2017 14:15
> To: Lennart Lund ; mahesh.va...@oracle.com;
> Canh Van Truong 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] log: fix compiling the log unit test failed [#2356]
> 
>  src/log/tests/lgs_dest_test.cc |  4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> 
> Fix compiling the log unit test failed by correcting
> the dummy function to match with the prototype.
> 
> diff --git a/src/log/tests/lgs_dest_test.cc b/src/log/tests/lgs_dest_test.cc
> --- a/src/log/tests/lgs_dest_test.cc
> +++ b/src/log/tests/lgs_dest_test.cc
> @@ -33,8 +33,8 @@ int lgs_cfg_update(const lgs_config_chg_
>return 0;
>  }
> 
> -void lgs_cfgupd_mutival_replace(const std::string attribute_name,
> -const std::vector value_list,
> +void lgs_cfgupd_mutival_replace(const std::string& attribute_name,
> +const std::vector& value_list,
>  lgs_config_chg_t *config_data) {
>  }
> 

--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1 of 2] mds: handle memory leak [#1860]

2017-03-08 Thread Anders Widell
Hi!

I am trying to understand how these MDS APIs are intended to work. When 
I read Section 3.2.9.1.7 in OpenSAF_MDSv_PR.odt in the 
opensaf-internal-docs Mercurial repository, it looks like it is the 
responsibility of the MDS library to free the provided buffer that was 
passed in to MDS_DIRECT_SEND, no matter if the MDS API call succeeds or 
fails. Doesn't this patch change this behaviour in MDS?


regards,

Anders Widell


On 03/06/2017 09:00 AM, Hoang Vo wrote:
>   src/base/sysf_mem.c|   3 +++
>   src/mds/mds_c_sndrcv.c |  34 +++---
>   2 files changed, 18 insertions(+), 19 deletions(-)
>
>
> Some error handling does not clean internal memory.
> Error handling in dirrect send case clear user memory seem inconsistence,
> mds should let creater manage its memory in error cases.
>
> action: implement as proposed.
>
> diff --git a/src/base/sysf_mem.c b/src/base/sysf_mem.c
> --- a/src/base/sysf_mem.c
> +++ b/src/base/sysf_mem.c
> @@ -1,6 +1,7 @@
>   /*  -*- OpenSAF  -*-
>*
>* (C) Copyright 2008 The OpenSAF Foundation
> + * Copyright Ericsson AB 2017 - All Rights Reserved.
>*
>* This program is distributed in the hope that it will be useful, but
>* WITHOUT ANY WARRANTY; without even the implied warranty of 
> MERCHANTABILITY
> @@ -428,6 +429,8 @@ USRBUF *sysf_alloc_pkt(unsigned char poo
>   if (pool_id >= UB_MAX_POOLS) {
>   m_PMGR_UNLK(_ub_pool_mgr.lock);
>   m_LEAP_DBG_SINK_VOID;
> + m_NCS_MEM_FREE(ub, NCS_MEM_REGION_IO_DATA_HDR, 
> NCS_SERVICE_ID_OS_SVCS, 2);
> + ub = (USRBUF *)0;
>   return NULL;
>   }
>   ud = (USRDATA 
> *)gl_ub_pool_mgr.pools[pool_id].mem_alloc(sizeof(USRDATA), pool_id, priority);
> diff --git a/src/mds/mds_c_sndrcv.c b/src/mds/mds_c_sndrcv.c
> --- a/src/mds/mds_c_sndrcv.c
> +++ b/src/mds/mds_c_sndrcv.c
> @@ -1,6 +1,7 @@
>   /*  -*- OpenSAF  -*-
>*
>* (C) Copyright 2008 The OpenSAF Foundation
> + * Copyright Ericsson AB 2017 - All Rights Reserved.
>*
>* This program is distributed in the hope that it will be useful, but
>* WITHOUT ANY WARRANTY; without even the implied warranty of 
> MERCHANTABILITY
> @@ -420,10 +421,6 @@ static uint32_t mds_mcm_direct_send(NCSM
>   memset(, 0, sizeof(req));
>   if ((info->info.svc_direct_send.i_priority < MDS_SEND_PRIORITY_LOW) ||
>   (info->info.svc_direct_send.i_priority > 
> MDS_SEND_PRIORITY_VERY_HIGH)) {
> - if (info->info.svc_direct_send.i_direct_buff != NULL) {
> - 
> m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
> - info->info.svc_direct_send.i_direct_buff = NULL;
> - }
>   m_MDS_LOG_ERR("MDS_SND_RCV: Priority defined is not in 
> range\n");
>   return NCSCC_RC_FAILURE;
>   }
> @@ -432,13 +429,11 @@ static uint32_t mds_mcm_direct_send(NCSM
>   m_MDS_LOG_ERR("MDS_SND_RCV: Send Message Direct Buff is 
> NULL\n");
>   return NCSCC_RC_FAILURE;
>   } else if (info->info.svc_direct_send.i_direct_buff_len > 
> MDS_DIRECT_BUF_MAXSIZE) {
> - mds_free_direct_buff(info->info.svc_direct_send.i_direct_buff);
>   m_MDS_LOG_ERR("MDS_SND_RCV: Send Message Direct Buff Len is 
> greater than SEND SIZE\n");
>   return NCSCC_RC_FAILURE;
>   }
>   
>   if ((info->info.svc_direct_send.i_to_svc == 0) || (info->i_svc_id == 
> 0)) {
> - 
> m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
>   m_MDS_LOG_ERR("MDS_SND_RCV: Source or Dest service provided is 
> Null, src svc_id = %s(%d), dest svc_id = %s(%d) \n",
> get_svc_names(info->i_svc_id), info->i_svc_id, 
> get_svc_names(info->info.svc_direct_send.i_to_svc), 
> info->info.svc_direct_send.i_to_svc);
>   return NCSCC_RC_FAILURE;
> @@ -633,11 +628,6 @@ static uint32_t mds_mcm_direct_send(NCSM
>   status = NCSCC_RC_FAILURE;
>   break;
>   }
> - if (status == MDS_INT_RC_DIRECT_SEND_FAIL) {
> - /* Free the MDS Direct Buff */
> - 
> m_MDS_FREE_DIRECT_BUFF(info->info.svc_direct_send.i_direct_buff);
> - status = NCSCC_RC_FAILURE;
> - }
>   return status;
>   }
>   
> @@ -2014,6 +2004,7 @@ static uint32_t mcm_process_await_active
>  return Sucess; */
>   
>   MDTM_SEND_REQ req;
> + uint32_t rc = NCSCC_RC_SUCCESS;
>   
>   NCSMDS_CALLBACK_INFO cbinfo;
>   MDS_BCAST_BUFF_LIST *bcast_ptr = NULL;
> @@ -2022,9 +2013,6 @@ static uint32_t mcm_process_await_active
>   
>   if (svc_cb->i_fail_no_active_sends) {
>   m_MDS_LOG_ERR("MDS_SND_RCV: Returning in noactive state as the 
> option is not to buffer the msgs");
> - if (to_msg->msg_type == MSG_DIRECT_BUFF) {
> - 

Re: [devel] [PATCH 2 of 2] log: Add test case to verify that only line feed was replaced in case truncation [#1463]

2017-03-08 Thread Lennart Lund
Ack

Thanks
Lennart

> -Original Message-
> From: Canh Van Truong [mailto:canh.v.tru...@dektech.com.au]
> Sent: den 8 mars 2017 14:13
> To: Lennart Lund ; mahesh.va...@oracle.com;
> Vu Minh Nguyen 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 2 of 2] log: Add test case to verify that only line feed was
> replaced in case truncation [#1463]
> 
>  src/log/apitest/tet_LogOiOps.c |  99
> ++
>  1 files changed, 99 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/src/log/apitest/tet_LogOiOps.c b/src/log/apitest/tet_LogOiOps.c
> --- a/src/log/apitest/tet_LogOiOps.c
> +++ b/src/log/apitest/tet_LogOiOps.c
> @@ -4118,6 +4118,103 @@ done:
>  _logMaxLogrecsize, SA_IMM_ATTR_SAUINT32T);
>  }
> 
> +/*
> + * Write a maximum log record to app stream.
> + * Verify if Only line feed is replaced to the final character position in 
> case
> truncation
> + *
> + * Steps:
> + *
> + * 1. Backup then change the logMaxLogrecsize value to maximum one.
> + * 2. Create application stream.
> + * 3. Create a log record buffer with 65535 bytes (not count '\0').
> + * 4. Using saflogger tool, writing that buffer to the created app stream.
> + * 5. Get contents of log records in log file
> + * 6. Verify if Only line feed is replaced to the final character position 
> in case
> truncation
> + * 7. Delete created app class and restore logMaxLogrecsize value
> + */
> +
> +void verMaxLogRecord_03(void)
> +{
> + int rc;
> + char command[66000];
> + char logRecord[MAX_LOGRECSIZE + 1]; // More one for '\0'
> +
> + /* Get current value of the attribute */
> + get_attr_value(, "logMaxLogrecsize",
> +_logMaxLogrecsize);
> +
> + /* Change the attribute value to maximum one */
> + sprintf(command, "immcfg -a logMaxLogrecsize=%u"
> + " logConfig=1,safApp=safLogService 2> /dev/null",
> MAX_LOGRECSIZE);
> +
> + rc = systemCall(command);
> + if (rc) {
> + rc_validate(rc, 0);
> + return;
> + }
> +
> + /* Set saLogStreamFixedLogRecordSize = 0, fix log record =
> maxLogRecordSize */
> + sprintf(command, "immcfg -c SaLogStreamConfig
> safLgStrCfg=maxrecsize3,safApp=safLogService"
> + " -a saLogStreamFileName=verMaxLogrecsize3 -a
> saLogStreamPathName=vermaxsize"
> + " -a saLogStreamFixedLogRecordSize=0 -a
> saLogStreamLogFileFormat=@Cb");
> +
> + rc = systemCall(command);
> + if (rc) {
> + rc_validate(rc, 0);
> + goto done;
> + }
> +
> + /* Prepare log record data */
> + memset(logRecord, 'A', MAX_LOGRECSIZE);
> + logRecord[MAX_LOGRECSIZE] = '\0';
> +
> + sprintf(command, "saflogger -a
> safLgStrCfg=maxrecsize3,safApp=safLogService \"%s\"",
> + logRecord);
> + rc = system(command);
> + if (WEXITSTATUS(rc)) {
> + /* Fail to perform command. Report test failed. */
> + fprintf(stderr, "Failed to perform command = %s\n",
> command);
> + rc_validate(WEXITSTATUS(rc), 0);
> + goto free_class;
> + }
> + /* Write log record succesfully. Then, compare output with original
> log record. */
> + FILE *fp = NULL;
> + char out_log_record[MAX_LOGRECSIZE + 1];
> +
> + /* Get the contents of log record */
> + sprintf(command, "find %s/vermaxsize -type f -mmin -1 "
> + "| egrep \"%s_([0-9]{8}_[0-9]{6}\\.log$)\" "
> + "| xargs cat ",
> + log_root_path, "verMaxLogrecsize3");
> +
> + fp = popen(command, "r");
> + if (fp == NULL) {
> + /* Fail to read size of log file. Report test failed. */
> + fprintf(stderr, "Failed to run command = %s\n", command);
> + test_validate(1, 0);
> + goto free_class;
> + }
> + /* Get output of the command - actually the file size in chars */
> + while (fgets(out_log_record, sizeof(out_log_record), fp) != NULL) {};
> + pclose(fp);
> +
> + logRecord[MAX_LOGRECSIZE - 1] = '\n';
> + /* Compare the output in log file with original log record
> +  * that was replaced final character position by '\n' */
> + rc = strncmp(logRecord, out_log_record, MAX_LOGRECSIZE);
> + rc_validate(rc, 0);
> +
> +free_class:
> + /* Delete class created */
> + (void)strcpy(command, "immcfg -d
> safLgStrCfg=maxrecsize3,safApp=safLogService");
> + rc = systemCall(command);
> +
> +done:
> + /* Restore logMaxLogrecsize to previous value */
> + m_restoreData(configurationObject, "logMaxLogrecsize",
> +   _logMaxLogrecsize, SA_IMM_ATTR_SAUINT32T);
> +}
> +
>  /**
>   * Add test case for ticket #1399:
>   * logsv gets stuck in while loop when setting maxFilesRotated=0
> @@ -4862,5 +4959,7 @@ done:
>   test_case_add(6, verMiliToken, "Write 20 log records to
> System/Notification stream. MANUALLY verify millisecond 

Re: [devel] [PATCH 1 of 2] log: fix to remove a redundant double quotation [#1463]

2017-03-08 Thread Lennart Lund
Ack

Thanks
Lennart

> -Original Message-
> From: Canh Van Truong [mailto:canh.v.tru...@dektech.com.au]
> Sent: den 8 mars 2017 14:13
> To: Lennart Lund ; mahesh.va...@oracle.com;
> Vu Minh Nguyen 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 2] log: fix to remove a redundant double quotation
> [#1463]
> 
>  src/log/logd/lgs_fmt.cc |  3 ---
>  1 files changed, 0 insertions(+), 3 deletions(-)
> 
> 
> When sending a log record which is longer than limited quota,
> there will be a double quotation mark although there is not double quotation
> in
> token format.
> 
> The patch remove it.
> 
> diff --git a/src/log/logd/lgs_fmt.cc b/src/log/logd/lgs_fmt.cc
> --- a/src/log/logd/lgs_fmt.cc
> +++ b/src/log/logd/lgs_fmt.cc
> @@ -1362,7 +1362,6 @@ int lgs_format_log_record(SaLogRecordT *
>  dest[fixedLogRecordSize - 1] = '\n';
>  i = fixedLogRecordSize;
>} else if ((fixedLogRecordSize > 0) && (i >= fixedLogRecordSize)) {
> -dest[fixedLogRecordSize - 2] = (SaInt8T)'\"';
>  dest[fixedLogRecordSize - 1] = '\n';
>  i = fixedLogRecordSize;
>}
> @@ -1375,11 +1374,9 @@ int lgs_format_log_record(SaLogRecordT *
>/* There can be situations when the filesize is as small as the 
> maxrecsize.
> * For eg:- By default for the application streams max file size is 
> 1024
> */
> -  dest[logFileSize - 2] = (SaInt8T)'\"';
>dest[logFileSize - 1] = '\n';
>i = logFileSize;
>  } else {
> -  dest[dest_size - 2] = (SaInt8T)'\"';
>dest[dest_size - 1] = '\n';
>i = dest_size;
>  }

--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 0 of 2] Review Request for mdstest: handle memory leak [#1860]

2017-03-08 Thread Zoran Milinkovic
Hi Vo,

I don't see that #2174 has been pushed. Did you mean some other patch ?
Anyway, I tested again on the latest changeset on default branch and the memory 
leak is still there + one more.

All 3 memory leaks might be due to failed MDS tests.

You have ack to the current patch, and for these three memory leaks we can open 
a new ticket.

I run next command:
valgrind --leak-check=full mdstest

Result from today's MDS test on the default branch:
   Test Result:
  Total:  185
  Passed: 183
  Failed: 2

Reported memory leaks:
==21333== 752 bytes in 2 blocks are definitely lost in loss record 10 of 13
==21333==at 0x4C2AB80: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21333==by 0x4E7731D: mds_mcm_user_event_callback (mds_c_api.c:3301)
==21333==by 0x4E78BB1: mds_mcm_svc_up (mds_c_api.c:1615)
==21333==by 0x4E95C14: mdtm_process_discovery_events (mds_dt_tipc.c:1031)
==21333==by 0x4E95C14: mdtm_process_recv_events (mds_dt_tipc.c:699)
==21333==by 0x50C7183: start_thread (pthread_create.c:312)
==21333==by 0x53D737C: clone (clone.S:111)
==21333== 
==21333== 8,448 (376 direct, 8,072 indirect) bytes in 1 blocks are definitely 
lost in loss record 12 of 13
==21333==at 0x4C2AB80: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21333==by 0x4E7FCBE: mds_mcm_mailbox_post (mds_c_sndrcv.c:4866)
==21333==by 0x4E7FCBE: mds_mcm_process_recv_snd_msg_common 
(mds_c_sndrcv.c:4246)
==21333==by 0x4E82532: mcm_recv_red_bcast (mds_c_sndrcv.c:4467)
==21333==by 0x4E82532: mds_mcm_ll_data_rcv (mds_c_sndrcv.c:4148)
==21333==by 0x4E8A57E: mdtm_process_recv_message_common 
(mds_dt_common.c:504)
==21333==by 0x4E8AB5D: mdtm_process_recv_data (mds_dt_common.c:948)
==21333==by 0x4E951B5: mdtm_process_recv_events (mds_dt_tipc.c:819)
==21333==by 0x50C7183: start_thread (pthread_create.c:312)
==21333==by 0x53D737C: clone (clone.S:111)
==21333== 
==21333== LEAK SUMMARY:
==21333==definitely lost: 1,128 bytes in 3 blocks
==21333==indirectly lost: 8,072 bytes in 2 blocks
==21333==  possibly lost: 120 bytes in 4 blocks
==21333==still reachable: 263,815 bytes in 5 blocks
==21333== suppressed: 0 bytes in 0 blocks

Thanks,
Zoran

-Original Message-
From: Vo Minh Hoang [mailto:hoang.m...@dektech.com.au] 
Sent: den 8 mars 2017 05:49
To: Zoran Milinkovic ; mahesh.va...@oracle.com; 
Anders Widell 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [devel] [PATCH 0 of 2] Review Request for mdstest: handle memory 
leak [#1860]

Dear Zoran,

Thank you very much for your checking.

Would you please tell me which test case is failed in your environment because 
my current pc return OK for all and no mem leak. That might because of 
threading problem.

Further information, please note that this patch should apply after #2174 
(already been pushed).

Sincerely,
Hoang

-Original Message-
From: Zoran Milinkovic [mailto:zoran.milinko...@ericsson.com]
Sent: Tuesday, March 7, 2017 10:07 PM
To: Hoang Minh Vo ; mahesh.va...@oracle.com; Anders 
Widell 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [devel] [PATCH 0 of 2] Review Request for mdstest: handle memory 
leak [#1860]

Hi Hoang,

Reviewed and tested both patches.

There is still a memory leak when some tests fail.

==20325== 752 bytes in 2 blocks are definitely lost in loss record 9 of 10
==20325==at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==20325==by 0x4E7731D: mds_mcm_user_event_callback (mds_c_api.c:3301)
==20325==by 0x4E78BB1: mds_mcm_svc_up (mds_c_api.c:1615)
==20325==by 0x4E95C14: mdtm_process_discovery_events
(mds_dt_tipc.c:1031)
==20325==by 0x4E95C14: mdtm_process_recv_events (mds_dt_tipc.c:699)
==20325==by 0x50C7183: start_thread (pthread_create.c:312)
==20325==by 0x53D737C: clone (clone.S:111)
==20325==
==20325== LEAK SUMMARY:
==20325==definitely lost: 752 bytes in 2 blocks
==20325==indirectly lost: 0 bytes in 0 blocks
==20325==  possibly lost: 120 bytes in 4 blocks
==20325==still reachable: 263,815 bytes in 5 blocks
==20325== suppressed: 0 bytes in 0 blocks

Thanks,
Zoran


-Original Message-
From: Hoang Vo [mailto:hoang.m...@dektech.com.au]
Sent: den 6 mars 2017 09:00
To: mahesh.va...@oracle.com; Anders Widell 
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 0 of 2] Review Request for mdstest: handle memory leak 
[#1860]

Summary: mdstest: handle memory leak [#1860] Review request for Trac
Ticket(s): #1870 Peer Reviewer(s): mahesh.va...@oracle.com; 
zoran.milinko...@ericsson.com Pull request to: mahesh.va...@oracle.com Affected 
branch(es): default Development branch: default


Impacted area   Impact y/n

 Docs   

Re: [devel] [PATCH 1 of 1] imm: Fix all Cppcheck 1.77 issues [#2333]

2017-03-08 Thread Zoran Milinkovic
Hi Mahesh,

Reviewed and tested the patch.
The patch silently fix IMMA UP bug.

Ack from me.

Thanks,
Zoran

-Original Message-
From: mahesh.va...@oracle.com [mailto:mahesh.va...@oracle.com] 
Sent: den 3 mars 2017 06:42
To: Zoran Milinkovic ; Hung Duc Nguyen 
; reddy.neelaka...@oracle.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] imm: Fix all Cppcheck 1.77 issues [#2333]

 src/imm/agent/imma_db.cc |   8 +---
 src/imm/agent/imma_mds.cc|   6 +--
 src/imm/agent/imma_oi_api.cc |   3 +-
 src/imm/agent/imma_om_api.cc |  19 +
 src/imm/agent/imma_proc.cc   |  12 ++
 src/imm/immd/immd_db.c   |   9 +---
 src/imm/immd/immd_evt.c  |  29 ++-
 src/imm/immd/immd_mbcsv.c|   9 +---
 src/imm/immd/immd_mds.c  |  17 ++--
 src/imm/immnd/ImmModel.cc|  80 ---
 src/imm/immnd/immnd_clm.c|   4 +-
 src/imm/immnd/immnd_db.c |   7 +--
 src/imm/immnd/immnd_evt.c|  29 +--
 src/imm/immnd/immnd_main.c   |   4 +-
 src/imm/immnd/immnd_mds.c|  10 +---
 src/imm/immnd/immnd_proc.c   |   7 +--
 16 files changed, 98 insertions(+), 155 deletions(-)


Except never used functions all other issues are fixed  of below,
some UN-pushed enhancement may be using those functions.

[staging/src/imm/immnd/ImmModel.cc:2985] -> 
[staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 
'increment&' is redundant or there is possible null pointer 
dereference: immObject.
[staging/src/imm/immnd/ImmModel.cc:2986] -> 
[staging/src/imm/immnd/ImmModel.cc:3002]: (warning) Either the condition 
'increment&' is redundant or there is possible null pointer 
dereference: immObject.
[staging/src/imm/immnd/ImmModel.cc:10798]: (style) C-style pointer casting
[staging/src/imm/immnd/ImmModel.cc:11027]: (style) C-style pointer casting
[staging/src/imm/immnd/ImmModel.cc:12510]: (style) C-style pointer casting
[staging/src/imm/immnd/ImmModel.cc:13921]: (style) C-style pointer casting
[staging/src/imm/immnd/ImmModel.cc:2980] -> 
[staging/src/imm/immnd/ImmModel.cc:2984]: (style) Variable 'immObject' is 
reassigned a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:7141] -> 
[staging/src/imm/immnd/ImmModel.cc:7154]: (style) Variable 'current' is 
reassigned a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:7445] -> 
[staging/src/imm/immnd/ImmModel.cc:7455]: (style) Variable 'ccb' is reassigned 
a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:7448] -> 
[staging/src/imm/immnd/ImmModel.cc:7460]: (style) Variable 'oMut' is reassigned 
a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:7541] -> 
[staging/src/imm/immnd/ImmModel.cc:7550]: (style) Variable 'afim' is reassigned 
a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:7579] -> 
[staging/src/imm/immnd/ImmModel.cc:7589]: (style) Variable 'afim' is reassigned 
a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:14144] -> 
[staging/src/imm/immnd/ImmModel.cc:14148]: (style) Variable 'immObject' is 
reassigned a value before the old one has been used.
[staging/src/imm/immnd/ImmModel.cc:673]: (style) The scope of the variable 'ix' 
can be reduced.
[staging/src/imm/immnd/ImmModel.cc:905]: (style) The scope of the variable 'ix' 
can be reduced.
[staging/src/imm/immnd/ImmModel.cc:931]: (style) The scope of the variable 'ix' 
can be reduced.
[staging/src/imm/immnd/ImmModel.cc:1041]: (style) The scope of the variable 
'ix' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:1074]: (style) The scope of the variable 
'ix' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:1882]: (style) The scope of the variable 
'ix' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:2031]: (style) The scope of the variable 
'ix' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:5462]: (style) The scope of the variable 
'ai' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:16545]: (style) The scope of the variable 
'sendCompletedToSlave' can be reduced.
[staging/src/imm/immnd/ImmModel.cc:19363]: (style) Unused variable: i3
[staging/src/imm/immnd/ImmModel.cc:104]: (style) Struct 
'ImplementerCcbAssociation' has a constructor with 1 argument that is not 
explicit.
[staging/src/imm/immnd/ImmModel.cc:118]: (style) Struct 'ClassInfo' has a 
constructor with 1 argument that is not explicit.
[staging/src/imm/immnd/ImmModel.cc:269]: (style) Struct 'ObjectMutation' has a 
constructor with 1 argument that is not explicit.
[staging/src/imm/immnd/ImmModel.cc:576]: (style) Struct 'AttrFlagIncludes' has 
a constructor with 1 argument that is not explicit.
[staging/src/imm/immnd/ImmModel.cc:587]: (style) Struct 'IdIs' has a 
constructor with 1 argument that is not explicit.
[staging/src/imm/immnd/ImmModel.cc:598]: (style) Struct 'CcbIdIs' has a 
constructor with 1 argument that is not 

[devel] [PATCH 0 of 3] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341] V1

2017-03-08 Thread A V Mahesh
Summary:amf: Fix all Cppcheck 1.77 issues [#2341] V1 
Review request for Trac Ticket(s): #2341
Peer Reviewer(s): Amf Dev
Pull request to: <>
Affected branch(es): default, 5.2
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesn
 OpenSAF servicesy
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-

changeset b8e7593cf4eadaa6169fe635ac0df67560ea875a
Author: A V Mahesh 
Date:   Wed, 08 Mar 2017 17:52:21 +0530

amfd: Fix all Cppcheck 1.77 issues [#2341] V1

[staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 
'i' can
be reduced. [staging/src/amf/amfd/apptype.cc:137]: (style) Condition 
'rc!=0'
is always false [staging/src/amf/amfd/apptype.cc:69]: (style) The scope 
of
the variable 'sg_type' can be reduced. 
[staging/src/amf/amfd/chkop.cc:1297]
-> [staging/src/amf/amfd/chkop.cc:1302]: (style) Variable 'uba' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:374] ->
[staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:573] ->
[staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_edu.cc:51] ->
[staging/src/amf/amfd/ckpt_edu.cc:56]: (style) Variable 'rc' is 
reassigned a
value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2281] ->
[staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2314] ->
[staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_enc.cc:1982]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_enc.cc:2044]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_enc.cc:2111]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_enc.cc:2176]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix 
++/--
operators for non-primitive types. 
[staging/src/amf/amfd/ckpt_enc.cc:2252]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix 
++/--
operators for non-primitive types. [staging/src/amf/amfd/clm.cc:344]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:82]: (performance) Prefer prefix ++/--
operators for non-primitive types. [staging/src/amf/amfd/cluster.cc:95]:
(performance) Prefer prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:116]: (performance) Prefer prefix ++/--
operators for non-primitive types. [staging/src/amf/amfd/comp.cc:1270] 
->
[staging/src/amf/amfd/comp.cc:1285]: (style) Variable 'su_node_ptr' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/comp.cc:49]: (style) The scope of the variable 
'rc'
can be reduced. [staging/src/amf/amfd/comp.cc:947]: (performance) Prefer
prefix ++/-- operators for non-primitive types.
[staging/src/amf/amfd/compcstype.cc:92] ->
[staging/src/amf/amfd/compcstype.cc:99]: (style) Variable 'cst' is
reassigned a value before the old one has been used.
[staging/src/amf/amfd/compcstype.cc:46]: (style) The scope of the 
variable
'rc' can be reduced. [staging/src/amf/amfd/comptype.cc:417]: 

[devel] [PATCH 1 of 3] amfd: Fix all Cppcheck 1.77 issues [#2341] V1

2017-03-08 Thread A V Mahesh
 src/amf/amfd/app.cc|   3 +-
 src/amf/amfd/apptype.cc|   9 +
 src/amf/amfd/chkop.cc  |   3 +-
 src/amf/amfd/ckpt_dec.cc   |  15 +++
 src/amf/amfd/ckpt_edu.cc   |   3 +-
 src/amf/amfd/ckpt_enc.cc   |  60 ---
 src/amf/amfd/clm.cc|   5 +-
 src/amf/amfd/cluster.cc|  16 +++-
 src/amf/amfd/comp.cc   |  11 ++---
 src/amf/amfd/compcstype.cc |   7 +--
 src/amf/amfd/comptype.cc   |   3 +-
 src/amf/amfd/csi.cc|  23 ---
 src/amf/amfd/csiattr.cc|   9 +---
 src/amf/amfd/ctcstype.cc   |  10 +
 src/amf/amfd/dmsg.cc   |   4 +-
 src/amf/amfd/hlttype.cc|   3 +-
 src/amf/amfd/imm.cc|  49 ++---
 src/amf/amfd/main.cc   |  19 ++---
 src/amf/amfd/mds.cc|   4 +-
 src/amf/amfd/ndfsm.cc  |  35 +++---
 src/amf/amfd/ndproc.cc |  15 ++-
 src/amf/amfd/node.cc   |  24 ---
 src/amf/amfd/nodegroup.cc  |  10 ++---
 src/amf/amfd/role.cc   |  42 -
 src/amf/amfd/sg.cc |  23 ++-
 src/amf/amfd/sg_2n_fsm.cc  |  10 ++--
 src/amf/amfd/sg_nored_fsm.cc   |   3 +-
 src/amf/amfd/sg_npm_fsm.cc |  33 ++--
 src/amf/amfd/sg_nway_fsm.cc|  39 +++-
 src/amf/amfd/sg_nwayact_fsm.cc |   5 +-
 src/amf/amfd/sgproc.cc |  16 ++-
 src/amf/amfd/sgtype.cc |   3 +-
 src/amf/amfd/si.cc |  24 
 src/amf/amfd/si_dep.cc |  79 ++---
 src/amf/amfd/siass.cc  |  18 +++-
 src/amf/amfd/sirankedsu.cc |  17 +++-
 src/amf/amfd/su.cc |   8 +--
 src/amf/amfd/sutype.cc |   6 ---
 src/amf/amfd/util.cc   |  69 +--
 39 files changed, 260 insertions(+), 475 deletions(-)


[staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be 
reduced.
[staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false
[staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 
'sg_type' can be reduced.
[staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: 
(style) Variable 'uba' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:374] -> 
[staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:573] -> 
[staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_edu.cc:51] -> [staging/src/amf/amfd/ckpt_edu.cc:56]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2281] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2314] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:1982]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2044]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2111]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2176]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2252]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/clm.cc:344]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/cluster.cc:82]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:95]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:116]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/comp.cc:1270] -> 

[devel] [PATCH 2 of 3] amfnd: Fix all Cppcheck 1.77 issues [#2341]

2017-03-08 Thread nagendra . k
 src/amf/amfnd/amfnd.cc   |  15 +--
 src/amf/amfnd/cbq.cc |   9 +++--
 src/amf/amfnd/chc.cc |  29 +++--
 src/amf/amfnd/clc.cc |  35 +--
 src/amf/amfnd/comp.cc|   8 +++-
 src/amf/amfnd/compdb.cc  |  14 +++---
 src/amf/amfnd/cpm.cc |  13 +
 src/amf/amfnd/di.cc  |  35 +--
 src/amf/amfnd/err.cc |  35 ++-
 src/amf/amfnd/evt.cc |   3 +--
 src/amf/amfnd/hcdb.cc|   7 +--
 src/amf/amfnd/imm.cc |   5 ++---
 src/amf/amfnd/main.cc|   8 +++-
 src/amf/amfnd/mds.cc |  20 +++-
 src/amf/amfnd/pg.cc  |  33 +++--
 src/amf/amfnd/proxy.cc   |   6 ++
 src/amf/amfnd/proxydb.cc |  17 +
 src/amf/amfnd/sidb.cc|   3 +--
 src/amf/amfnd/su.cc  |   3 +--
 src/amf/amfnd/sudb.cc|   5 ++---
 src/amf/amfnd/susm.cc|  19 +--
 src/amf/amfnd/util.cc|   2 +-
 22 files changed, 136 insertions(+), 188 deletions(-)


[staging/src/amf/amfnd/amfnd.cc:58] -> [staging/src/amf/amfnd/amfnd.cc:63]: 
(style) Variable 'del_cbk' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/amfnd.cc:59] -> [staging/src/amf/amfnd/amfnd.cc:65]: 
(style) Variable 'o_comp' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/amfnd.cc:191] -> [staging/src/amf/amfnd/amfnd.cc:199]: 
(style) Variable 'o_comp' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/amfnd.cc:249] -> [staging/src/amf/amfnd/amfnd.cc:250]: 
(style) Variable 'res' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/cbq.cc:441] -> [staging/src/amf/amfnd/cbq.cc:442]: 
(style) Variable 'temp_csi' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/cbq.cc:734] -> [staging/src/amf/amfnd/cbq.cc:748]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/cbq.cc:1132] -> [staging/src/amf/amfnd/cbq.cc:1133]: 
(style) Variable 'temp_csi' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/chc.cc:842]: (style) The scope of the variable 'cbk_rec' 
can be reduced.
[staging/src/amf/amfnd/clc.cc:610] -> [staging/src/amf/amfnd/clc.cc:616]: 
(style) Variable 'clc_evt' is reassigned a value before the old one has been 
used.
[staging/src/amf/amfnd/clc.cc:1706] -> [staging/src/amf/amfnd/clc.cc:1710]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:1747] -> [staging/src/amf/amfnd/clc.cc:1751]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:1949] -> [staging/src/amf/amfnd/clc.cc:1953]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:2368] -> [staging/src/amf/amfnd/clc.cc:2374]: 
(style) Variable 'csi' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:3050] -> [staging/src/amf/amfnd/clc.cc:3051]: 
(style) Variable 'tmp' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:3170] -> [staging/src/amf/amfnd/clc.cc:3179]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/clc.cc:1354]: (style) The scope of the variable 
'curr_rec' can be reduced.
[staging/src/amf/amfnd/clc.cc:1382]: (style) The scope of the variable 
'curr_rec' can be reduced.
[staging/src/amf/amfnd/clc.cc:3040]: (style) The scope of the variable 'i' can 
be reduced.
[staging/src/amf/amfnd/comp.cc:2557] -> [staging/src/amf/amfnd/comp.cc:2561]: 
(warning) Either the condition 'if(csi&_AVND_COMP_IS_ALL_CSI(comp))' is 
redundant or there is possible null pointer dereference: csi.
[staging/src/amf/amfnd/comp.cc:2237] -> [staging/src/amf/amfnd/comp.cc:2250]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/comp.cc:2962] -> [staging/src/amf/amfnd/comp.cc:2972]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/compdb.cc:485]: (warning) Comparison of a boolean 
expression with an integer.
[staging/src/amf/amfnd/compdb.cc:486]: (warning) Comparison of a boolean 
expression with an integer.
[staging/src/amf/amfnd/compdb.cc:485]: (warning) Comparison of a boolean value 
using relational operator (<, >, <= or >=).
[staging/src/amf/amfnd/compdb.cc:732] -> [staging/src/amf/amfnd/compdb.cc:734]: 
(warning) Either the condition '!compt' is redundant or there is possible null 
pointer dereference: compt.
[staging/src/amf/amfnd/compdb.cc:718] -> [staging/src/amf/amfnd/compdb.cc:721]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfnd/compdb.cc:1378]: (style) The scope of the variable 
'env_counter' can 

[devel] [PATCH 1 of 3] amfd: Fix all Cppcheck 1.77 issues [#2341]

2017-03-08 Thread nagendra . k
 src/amf/amfd/app.cc|   3 +-
 src/amf/amfd/apptype.cc|   9 +
 src/amf/amfd/chkop.cc  |   3 +-
 src/amf/amfd/ckpt_dec.cc   |  15 +++
 src/amf/amfd/ckpt_edu.cc   |   3 +-
 src/amf/amfd/ckpt_enc.cc   |  60 ---
 src/amf/amfd/clm.cc|   5 +-
 src/amf/amfd/cluster.cc|  16 +++-
 src/amf/amfd/comp.cc   |  11 ++---
 src/amf/amfd/compcstype.cc |   7 +--
 src/amf/amfd/comptype.cc   |   3 +-
 src/amf/amfd/csi.cc|  23 ---
 src/amf/amfd/csiattr.cc|   9 +---
 src/amf/amfd/ctcstype.cc   |  10 +
 src/amf/amfd/dmsg.cc   |   4 +-
 src/amf/amfd/hlttype.cc|   3 +-
 src/amf/amfd/imm.cc|  49 ++---
 src/amf/amfd/main.cc   |  19 ++---
 src/amf/amfd/mds.cc|   4 +-
 src/amf/amfd/ndfsm.cc  |  35 +++---
 src/amf/amfd/ndproc.cc |  15 ++-
 src/amf/amfd/node.cc   |  24 ---
 src/amf/amfd/nodegroup.cc  |  10 ++---
 src/amf/amfd/role.cc   |  42 -
 src/amf/amfd/sg.cc |  23 ++-
 src/amf/amfd/sg_2n_fsm.cc  |  10 ++--
 src/amf/amfd/sg_nored_fsm.cc   |   3 +-
 src/amf/amfd/sg_npm_fsm.cc |  33 ++--
 src/amf/amfd/sg_nway_fsm.cc|  39 +++-
 src/amf/amfd/sg_nwayact_fsm.cc |   5 +-
 src/amf/amfd/sgproc.cc |  16 ++-
 src/amf/amfd/sgtype.cc |   3 +-
 src/amf/amfd/si.cc |  24 
 src/amf/amfd/si_dep.cc |  79 ++---
 src/amf/amfd/siass.cc  |  18 +++-
 src/amf/amfd/sirankedsu.cc |  17 +++-
 src/amf/amfd/su.cc |   8 +--
 src/amf/amfd/sutype.cc |   6 ---
 src/amf/amfd/util.cc   |  69 +--
 39 files changed, 260 insertions(+), 475 deletions(-)


[staging/src/amf/amfd/app.cc:285]: (style) The scope of the variable 'i' can be 
reduced.
[staging/src/amf/amfd/apptype.cc:137]: (style) Condition 'rc!=0' is always false
[staging/src/amf/amfd/apptype.cc:69]: (style) The scope of the variable 
'sg_type' can be reduced.
[staging/src/amf/amfd/chkop.cc:1297] -> [staging/src/amf/amfd/chkop.cc:1302]: 
(style) Variable 'uba' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:374] -> 
[staging/src/amf/amfd/ckpt_dec.cc:382]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:573] -> 
[staging/src/amf/amfd/ckpt_dec.cc:577]: (style) Variable 'status' is reassigned 
a value before the old one has been used.
[staging/src/amf/amfd/ckpt_dec.cc:1109]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_edu.cc:51] -> [staging/src/amf/amfd/ckpt_edu.cc:56]: 
(style) Variable 'rc' is reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2281] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2288]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:2314] -> 
[staging/src/amf/amfd/ckpt_enc.cc:2322]: (style) Variable 'status' is 
reassigned a value before the old one has been used.
[staging/src/amf/amfd/ckpt_enc.cc:1951]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:1982]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2015]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2044]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2076]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2111]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2151]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2176]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2216]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2252]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/ckpt_enc.cc:2470]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/clm.cc:344]: (performance) Prefer prefix ++/-- operators 
for non-primitive types.
[staging/src/amf/amfd/cluster.cc:82]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:95]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/cluster.cc:116]: (performance) Prefer prefix ++/-- 
operators for non-primitive types.
[staging/src/amf/amfd/comp.cc:1270] -> 

Re: [devel] [PATCH 1 of 1] log: correct the LOG_NO message in unix socket destination handler [#2355]

2017-03-08 Thread Lennart Lund
Hi Vu

Ack

Thanks
Lennart

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: den 8 mars 2017 10:36
> To: Lennart Lund ; mahesh.va...@oracle.com;
> Canh Van Truong 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] log: correct the LOG_NO message in unix socket
> destination handler [#2355]
> 
>  src/log/logd/lgs_unixsock_dest.cc |  16 +---
>  1 files changed, 13 insertions(+), 3 deletions(-)
> 
> 
> Correct the unclear syslog message and add comments in code
> to explain why we need to resend the log record in case
> the destination receiver is restarted somehow.
> 
> diff --git a/src/log/logd/lgs_unixsock_dest.cc
> b/src/log/logd/lgs_unixsock_dest.cc
> --- a/src/log/logd/lgs_unixsock_dest.cc
> +++ b/src/log/logd/lgs_unixsock_dest.cc
> @@ -93,22 +93,32 @@ void UnixSocketHandler::FormRfc5424(
>  ErrCode UnixSocketHandler::Send(const DestinationHandler::RecordInfo&
> msg) {
>TRACE_ENTER();
>RfcBuffer buffer;
> +  ErrCode ret = ErrCode::kOk;
> 
>FormRfc5424(msg, );
> 
>ssize_t length = buffer.size();
>ssize_t len = sock_.Send(buffer.data(), length);
>// Resend as probably receiver has just been restarted.
> -  // Retry only once, if not succesfully, leave it to upper layer decision.
> +  // If it is the case, the holding file descriptor could be invalid
> +  // and it will get failed to send log record to destination even the 
> receiver
> +  // is up already. If we do re-send once, the file descriptor will be renew
> +  // within the UnixSocket::Send() and probably get successful to send
> +  // log record to the destination.
>if (len != length) {
> -LOG_NO("Failed to send log record to socket destination. Resent.");
> +TRACE("The receiver might be just restarted");
>  len = sock_.Send(buffer.data(), length);
>}
> 
>FlushStatus();
> 
> +  if (len != length) {
> +LOG_NO("Failed to send log record to socket destination.");
> +ret = ErrCode::kErr;
> +  }
> +
>TRACE_LEAVE();
> -  return ((len != length) ? (ErrCode::kErr) : (ErrCode::kOk));
> +  return ret;
>  }
> 
>  void UnixSocketHandler::Close() {

--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for amf: Fix all Cppcheck 1.77 issues [#2341]

2017-03-08 Thread mahesh . valla
Summary:amf: Fix all Cppcheck 1.77 issues [#2341] 
Review request for Trac Ticket(s): #2341
Peer Reviewer(s): Amf Dev
Pull request to: <>
Affected branch(es): <>
Development branch: default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-

changeset e1dd9b3074137effee1fac1dd9f4073373253123
Author: A V Mahesh 
Date:   Wed, 08 Mar 2017 16:35:10 +0530

amfa: Fix all Cppcheck 1.77 issues [#2341]

[staging/src/amf/agent/ava_hdl.cc:59] ->
[staging/src/amf/agent/ava_hdl.cc:67]: (style) Variable 'rc' is 
reassigned a
value before the old one has been used.
[staging/src/amf/agent/ava_hdl.cc:420]: (style) The scope of the 
variable
'rec' can be reduced. [staging/src/amf/agent/ava_hdl.cc:592]: (style) 
The
scope of the variable 'i' can be reduced.
[staging/src/amf/agent/ava_mds.cc:86] ->
[staging/src/amf/agent/ava_mds.cc:90]: (style) Variable 'rc' is 
reassigned a
value before the old one has been used.
[staging/src/amf/agent/ava_mds.cc:149] ->
[staging/src/amf/agent/ava_mds.cc:158]: (style) Variable 'rc' is 
reassigned
a value before the old one has been used.
[staging/src/amf/agent/ava_mds.cc:1020] ->
[staging/src/amf/agent/ava_mds.cc:1028]: (style) Variable 'rc' is 
reassigned
a value before the old one has been used.
[staging/src/amf/agent/ava_mds.cc:1103] ->
[staging/src/amf/agent/ava_mds.cc:1107]: (style) Variable 'msg' is
reassigned a value before the old one has been used.
[staging/src/amf/agent/ava_op.cc:221] ->
[staging/src/amf/agent/ava_op.cc:222]: (style) Variable
'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a 
value
before the old one has been used. [staging/src/amf/agent/ava_op.cc:240] 
->
[staging/src/amf/agent/ava_op.cc:241]: (style) Variable
'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a 
value
before the old one has been used. [staging/src/amf/agent/ava_op.cc:241] 
->
[staging/src/amf/agent/ava_op.cc:242]: (style) Variable
'osaf_cbk.saAmfContainedComponentInstantiateCallback' is reassigned a 
value
before the old one has been used. [staging/src/amf/agent/ava_op.cc:120]:
(style) The scope of the variable 'cb' can be reduced.
[staging/src/amf/agent/ava_hdl.cc:888]: (style) The function
'ava_hdl_pend_resp_get' is never used.
[staging/src/amf/agent/ava_hdl.cc:820]: (style) The function
'ava_hdl_pend_resp_pop' is never used.
[staging/src/amf/agent/ava_mds.cc:1132]: (style) The function
'ava_install_amf_down_cb' is never used.
[staging/src/amf/agent/ava_init.cc:50]: (style) The function
'logtrace_init_constructor' is never used.
[staging/src/amf/agent/amf_agent.cc:1330]: (style) The function
'saAmfCSIQuiescingComplete' is never used.
[staging/src/amf/agent/amf_agent.cc:2719]: (style) The function
'saAmfComponentErrorClear_4' is never used.
[staging/src/amf/agent/amf_agent.cc:2631]: (style) The function
'saAmfComponentErrorReport_4' is never used.
[staging/src/amf/agent/amf_agent.cc:1256]: (style) The function
'saAmfComponentNameGet' is never used.
[staging/src/amf/agent/amf_agent.cc:426]: (style) The function
'saAmfComponentRegister' is never used.
[staging/src/amf/agent/amf_agent.cc:588]: (style) The function
'saAmfComponentUnregister' is never used.
[staging/src/amf/agent/amf_agent.cc:2698]: (style) The function
'saAmfCorrelationIdsGet' is never used.
[staging/src/amf/agent/amf_agent.cc:242]: (style) The function
'saAmfDispatch' is never used. [staging/src/amf/agent/amf_agent.cc:326]:
(style) The function 'saAmfFinalize' is never used.
[staging/src/amf/agent/amf_agent.cc:2326]: (style) The function
'saAmfHAReadinessStateSet' is never used.
[staging/src/amf/agent/amf_agent.cc:1441]: (style) The function
'saAmfHAStateGet' is never used. 
[staging/src/amf/agent/amf_agent.cc:922]:
(style) The function 'saAmfHealthcheckConfirm' is never used.
[staging/src/amf/agent/amf_agent.cc:719]: (style) The function
'saAmfHealthcheckStart' is never used.
[staging/src/amf/agent/amf_agent.cc:838]: (style) The function
'saAmfHealthcheckStop' is never used.
[staging/src/amf/agent/amf_agent.cc:56]: (style) The 

[devel] [PATCH 0 of 1] Review Request for log: correct the LOG_NO message in unix socket destination handler [#2355]

2017-03-08 Thread Vu Minh Nguyen
Summary: log: correct the LOG_NO message in unix socket destination handler 
[#2355]
Review request for Trac Ticket(s): #2355
Peer Reviewer(s): Lennart, Canh, Mahesh
Pull request to: <>
Affected branch(es): Default
Development branch: Default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset 31d2b395cad1e06b9f3727d9c424c2e557acf2c0
Author: Vu Minh Nguyen 
Date:   Wed, 08 Mar 2017 16:33:40 +0700

log: correct the LOG_NO message in unix socket destination handler 
[#2355]

Correct the unclear syslog message and add comments in code to explain 
why
we need to resend the log record in case the destination receiver is
restarted somehow.


Complete diffstat:
--
 src/log/logd/lgs_unixsock_dest.cc |  16 +---
 1 files changed, 13 insertions(+), 3 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 1] Review Request for amfd: handle TIMEOUT for avd_imm_applier_set [#2338]

2017-03-08 Thread nagendra . k
Summary: amfd: handle TIMEOUT for avd_imm_applier_set [#2338]
Review request for Trac Ticket(s): #2338
Peer Reviewer(s): Amf Dev
Pull request to: <>
Affected branch(es): All
Development branch: Default


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
 <>

changeset b461f589dfcde95911f0b04881c5e518278f2b55
Author: Nagendra Kumar
Date:   Wed, 08 Mar 2017 13:12:19 +0530

amfd: handle TIMEOUT for avd_imm_applier_set [#2338]


Complete diffstat:
--
 src/amf/amfd/role.cc |  22 --
 src/amf/amfd/role.h  |   2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)


Testing Commands:
-
1. To reproduce it, do the following changesi at SC-1:
diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -1495,6 +1495,9 @@ SaAisErrorT avd_imm_applier_set(void)
  LOG_ER("Impl Set Failed for %s, returned %d",   
avd_class_names[i], rc);
  break;
  }
+ LOG_ER("1. Impl Set for %s  ", 
avd_class_names[i]);
+ sleep (1);
+ LOG_ER("2. Impl Set for %s  ", 
avd_class_names[i]);

2. Start SC-1 as Act and SC-2 as Standby.
   Now perform si swap of controllers and when logs of "Impl Set Failed for"
   starts comming on Quisced node(SC-1), kill immd on new Act node(SC-2). SC-2 
will reboot.
3. Amfd (SC-1) will hang in avd_imm_applier_set for 10 sec and timeout.

Testing, Expected Results:
--
After step 3, Amfd on SC-1 is declaring itself Act and when
SC-2 comes up after reboot, then it joins as Standby.

Conditions of Submission:
-
Ack

Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  y  y
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.hgrc file (i.e. username, email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and 

[devel] [PATCH 1 of 1] amfd: handle TIMEOUT for avd_imm_applier_set [#2338]

2017-03-08 Thread nagendra . k
 src/amf/amfd/role.cc |  22 --
 src/amf/amfd/role.h  |   2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)


diff --git a/src/amf/amfd/role.cc b/src/amf/amfd/role.cc
--- a/src/amf/amfd/role.cc
+++ b/src/amf/amfd/role.cc
@@ -130,7 +130,7 @@ void avd_role_change_evh(AVD_CL_CB *cb, 
(role == SA_AMF_HA_ACTIVE) && (cb->avail_state_avd == 
SA_AMF_HA_STANDBY)) {
if (true == cb->swap_switch ) {
/* swap resulted Switch  standby -> Active */
-   amfd_switch_stdby_actv(cb);
+   amfd_switch_stdby_actv(cb, true);
status = NCSCC_RC_SUCCESS;
goto done;
}
@@ -803,6 +803,12 @@ try_again:
   failed and amf reinitializes imm interface and
   set applier in avd_imm_reinit_bg_thread. Imm may
   return ERR_EXIST or INVALID_PARAM. */
+   TRACE("ERR_EXIST or INVALID_PARAM");
+   } else if (rc == SA_AIS_ERR_TIMEOUT) {
+   /* Let it proceed as there may be a case of Immd not
+  reachable i.e. node might have gone down during
+  switchover. */
+   TRACE("SA_AIS_ERR_TIMEOUT");
} else
osafassert(0);
} else
@@ -1147,6 +1153,7 @@ uint32_t amfd_switch_qsd_stdby(AVD_CL_CB
  *   change from standby to active in liue of SI SWAP Action
  * 
  * Input: cb - AVD control block pointer.
+ * Input: switch_flag - Whether switchover passed or failed.
  *
  * Returns: NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE.
  *
@@ -1155,14 +1162,15 @@ uint32_t amfd_switch_qsd_stdby(AVD_CL_CB
  * 
  **/
 
-uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb)
+uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb, bool switchover_flag)
 {
uint32_t status = NCSCC_RC_SUCCESS;
SaAisErrorT rc;

TRACE_ENTER();
 
-   LOG_NO("Switching StandBy --> Active State");
+   if (switchover_flag)
+   LOG_NO("Switching StandBy --> Active State");
 
/*
 * Check whether Standby is in sync with Active. If yes then
@@ -1282,8 +1290,10 @@ uint32_t amfd_switch_stdby_actv(AVD_CL_C
}
}
 
-   LOG_NO("Controller switch over done");
-   saflog(LOG_NOTICE, amfSvcUsrName, "Controller switch over done at %x", 
cb->node_id_avd);
+   if (switchover_flag) {
+   LOG_NO("Controller switch over done");
+   saflog(LOG_NOTICE, amfSvcUsrName, "Controller switch over done 
at %x", cb->node_id_avd);
+   }
 
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
@@ -1311,7 +1321,7 @@ uint32_t amfd_switch_qsd_actv (AVD_CL_CB
if (NCSCC_RC_SUCCESS != avd_rde_set_role(SA_AMF_HA_ACTIVE)) {
LOG_ER("rde role change failed from qsd -> actv");
}
-   return amfd_switch_stdby_actv(cb);
+   return amfd_switch_stdby_actv(cb, false);
 }
 
 
diff --git a/src/amf/amfd/role.h b/src/amf/amfd/role.h
--- a/src/amf/amfd/role.h
+++ b/src/amf/amfd/role.h
@@ -31,7 +31,7 @@ extern uint32_t avd_d2d_chg_role_rsp(AVD
 extern uint32_t avd_d2d_chg_role_req(AVD_CL_CB *cb, AVD_ROLE_CHG_CAUSE_T 
cause, SaAmfHAStateT role);
 
 extern uint32_t amfd_switch_qsd_stdby(AVD_CL_CB *cb);
-extern uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb);
+extern uint32_t amfd_switch_stdby_actv(AVD_CL_CB *cb, bool);
 extern uint32_t amfd_switch_qsd_actv(AVD_CL_CB *cb);
 extern uint32_t amfd_switch_actv_qsd(AVD_CL_CB *cb);
 extern uint32_t initialize_for_assignment(cl_cb_tag* cb,

--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel