[devel] [PATCH 1/1] mds: Update test suite 14 to avoid perpetually hanging [#2831]

2018-04-09 Thread Hoa Le
Currently in suite 14, mdstest sends messages with MDS_SENDTYPE_SNDACK
and MDS_SENDTYPE_SNDRSP types to the same destination, this sometimes
makes the Response thread to catch the wrong event and does not respond
to MDS_SENDTYPE_SNDRSP call. This causes the test case to hang forever.

This patch changes the destination of MDS_SENDTYPE_SNDRSP call to
NCSMDS_SVC_ID_INTERNAL_MIN to avoid the above issue.
---
 src/mds/apitest/mdstipc_api.c | 56 +--
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
index 5bfa7ef..de166d1 100644
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -8541,7 +8541,7 @@ void tet_direct_send_all_tp_1()
/*SNDRSP*/
printf("\nDirect send with rsp\n");
if (tet_create_task((NCS_OS_CB)tet_Dvdest_rcvr_all_thread,
-   gl_tet_vdest[1].svc[1].task.t_handle) ==
+   gl_tet_vdest[1].svc[0].task.t_handle) ==
NCSCC_RC_SUCCESS) {
printf("\nTask has been Created\n");
fflush(stdout);
@@ -8549,7 +8549,7 @@ void tet_direct_send_all_tp_1()
/*Sender*/
if (mds_direct_send_message(
gl_tet_adest.mds_pwe1_hdl, NCSMDS_SVC_ID_EXTERNAL_MIN,
-   NCSMDS_SVC_ID_EXTERNAL_MIN, gl_set_msg_fmt_ver,
+   NCSMDS_SVC_ID_INTERNAL_MIN, gl_set_msg_fmt_ver,
MDS_SENDTYPE_SNDRSP, gl_tet_vdest[1].vdest, 0,
MDS_SEND_PRIORITY_LOW, message) != NCSCC_RC_SUCCESS) {
printf("\nFail\n");
@@ -8557,7 +8557,7 @@ void tet_direct_send_all_tp_1()
} else
printf("\nSuccess\n");
/*Now Stop and Release the Receiver Thread*/
-   if (tet_release_task(gl_tet_vdest[1].svc[1].task.t_handle) ==
+   if (tet_release_task(gl_tet_vdest[1].svc[0].task.t_handle) ==
NCSCC_RC_SUCCESS)
printf("\nTASK is released\n");
 
@@ -8565,7 +8565,7 @@ void tet_direct_send_all_tp_1()
/*SNDRACK*/
printf("\n Direct send with response ack\n");
if (tet_create_task((NCS_OS_CB)tet_Dvdest_rcvr_all_rack_thread,
-   gl_tet_vdest[1].svc[1].task.t_handle) ==
+   gl_tet_vdest[1].svc[0].task.t_handle) ==
NCSCC_RC_SUCCESS) {
printf("\nTask has been Created\n");
fflush(stdout);
@@ -8573,7 +8573,7 @@ void tet_direct_send_all_tp_1()
/*Sender */
if (mds_direct_send_message(
gl_tet_adest.mds_pwe1_hdl, NCSMDS_SVC_ID_EXTERNAL_MIN,
-   NCSMDS_SVC_ID_EXTERNAL_MIN, gl_set_msg_fmt_ver,
+   NCSMDS_SVC_ID_INTERNAL_MIN, gl_set_msg_fmt_ver,
MDS_SENDTYPE_SNDRSP, gl_tet_vdest[1].vdest, 0,
MDS_SEND_PRIORITY_LOW, message) == NCSCC_RC_FAILURE) {
printf("\nFail\n");
@@ -8581,7 +8581,7 @@ void tet_direct_send_all_tp_1()
} else
printf("\nSuccess\n");
/*Now Stop and Release the Receiver Thread*/
-   if (tet_release_task(gl_tet_vdest[1].svc[1].task.t_handle) ==
+   if (tet_release_task(gl_tet_vdest[1].svc[0].task.t_handle) ==
NCSCC_RC_SUCCESS)
printf("\nTASK is released\n");
 
@@ -8656,7 +8656,7 @@ void tet_direct_send_all_tp_2()
/*SNDRSP*/
printf("\nDirect send with rsp\n");
if (tet_create_task((NCS_OS_CB)tet_Dvdest_rcvr_all_thread,
-   gl_tet_vdest[1].svc[1].task.t_handle) ==
+   gl_tet_vdest[1].svc[0].task.t_handle) ==
NCSCC_RC_SUCCESS) {
printf("\nTask has been Created\n");
fflush(stdout);
@@ -8664,7 +8664,7 @@ void tet_direct_send_all_tp_2()
/*Sender*/
if (mds_direct_send_message(
gl_tet_adest.mds_pwe1_hdl, NCSMDS_SVC_ID_EXTERNAL_MIN,
-   NCSMDS_SVC_ID_EXTERNAL_MIN, gl_set_msg_fmt_ver,
+   NCSMDS_SVC_ID_INTERNAL_MIN, gl_set_msg_fmt_ver,
MDS_SENDTYPE_SNDRSP, gl_tet_vdest[1].vdest, 0,
MDS_SEND_PRIORITY_LOW, message) != NCSCC_RC_SUCCESS) {
printf("\nFail\n");
@@ -8672,14 +8672,14 @@ void tet_direct_send_all_tp_2()
} else
printf("\nSuccess\n");
/*Now Stop and Release the Receiver Thread*/
-   if 

[devel] [PATCH 0/1] Review Request for mds: Update test suite 14 to avoid perpetually hanging [#2831]

2018-04-09 Thread Hoa Le
Summary: mds: Update test suite 14 to avoid perpetually hanging [#2831]
Review request for Ticket(s): 2831
Peer Reviewer(s): Hans, Anders
Pull request to: Hans, Anders
Affected branch(es): develop, release
Development branch: ticket-2831
Base revision: 1c302a300e449e8a8527671fbd6c7f4e2b41e95d
Personal repository: git://git.code.sf.net/u/xhoalee/review


Impacted area   Impact y/n

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


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

revision ff6d6821bab2562f3bdce9ad0db102a135531e51
Author: Hoa Le 
Date:   Tue, 10 Apr 2018 09:57:23 +0700

mds: Update test suite 14 to avoid perpetually hanging [#2831]

Currently in suite 14, mdstest sends messages with MDS_SENDTYPE_SNDACK
and MDS_SENDTYPE_SNDRSP types to the same destination, this sometimes
makes the Response thread to catch the wrong event and does not respond
to MDS_SENDTYPE_SNDRSP call. This causes the test case to hang forever.

This patch changes the destination of MDS_SENDTYPE_SNDRSP call to
NCSMDS_SVC_ID_INTERNAL_MIN to avoid the above issue.



Complete diffstat:
--
 src/mds/apitest/mdstipc_api.c | 56 +--
 1 file changed, 28 insertions(+), 28 deletions(-)


Testing Commands:
-
mdstest 14


Testing, Expected Results:
--
No error is observed.


Conditions of Submission:
-
Ack from reviewer.


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 ~/.gitconfig file (i.e. user.name, user.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.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0/1] Review Request for base: Re-factor the timer implementation [#2440]

2018-04-09 Thread Anders Widell
Summary: base: Re-factor the timer implementation [#2440]
Review request for Ticket(s): 2440
Peer Reviewer(s): Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2440
Base revision: b83be452a25a37c7f5b568b436d1af544afb7350
Personal repository: git://git.code.sf.net/u/anders-w/review


Impacted area   Impact y/n

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


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

revision 49be7d5f610fb7e23d8df575007fa3b21a5e0946
Author: Anders Widell 
Date:   Mon, 9 Apr 2018 16:10:41 +0200

base: Re-factor the timer implementation [#2440]

Re-factor the NCS timer implementation and provide the AIS TMR API as an
alternative way to use the timer implementation, alongside with the old NCS
API. The AIS TMR API is intended for internal use in OpenSAF services for now,
but it could be exported as an official OpenSAF API later if it turns out to be
working well. OpenSAF services using the TMR API instead of the NCS API will no
longer need a dedicated timer thread.

The new timer implementation is using a C++ STL multiset for the timer queue,
and a Linux timerfd for the selection object.



Added Files:

 src/ais/include/saTmr.h
 src/base/handle/external_mutex.h
 src/base/handle/handle.cc
 src/base/handle/handle.h
 src/base/handle/object_db.cc
 src/base/handle/object_db.h
 src/base/handle/object.h
 src/base/ncssysf_tmr.cc
 src/base/tests/sa_tmr_test.cc
 src/base/timer/saTmr.cc
 src/base/timer/timer.h
 src/base/timer/timer_handle.cc
 src/base/timer/timer_handle.h


Removed Files:
--
 src/base/sysf_tmr.c


Complete diffstat:
--
 cppcheck_append.cc   |   12 +
 src/ais/Makefile.am  |3 +
 src/ais/include/saTmr.h  |  148 ++
 src/base/Makefile.am |   13 +-
 src/base/handle/external_mutex.h |   66 +++
 src/base/handle/handle.cc|   63 +++
 src/base/handle/handle.h |  107 
 src/base/handle/object.h |   52 ++
 src/base/handle/object_db.cc |   91 
 src/base/handle/object_db.h  |  109 
 src/base/ncssysf_tmr.cc  |  254 +
 src/base/ncssysf_tmr.h   |  135 +++--
 src/base/ncssysf_tsk.h   |4 +-
 src/base/sysf_tmr.c  | 1085 --
 src/base/tests/sa_tmr_test.cc| 1079 +
 src/base/tests/sysf_tmr_test.cc  |  205 +--
 src/base/timer/saTmr.cc  |  569 
 src/base/timer/timer.h   |   55 ++
 src/base/timer/timer_handle.cc   |  190 +++
 src/base/timer/timer_handle.h|  101 
 20 files changed, 3149 insertions(+), 1192 deletions(-)


Testing Commands:
-

make check


Testing, Expected Results:
--

Unit tests shall pass


Conditions of Submission:
-

Ack from reviewer(s), or on 2018-04-16 if no comments have been received.


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 

[devel] [PATCH 0/1] Review Request for smf: Improve error logging when applying a CCB [#2832]

2018-04-09 Thread Lennart Lund
Summary: smf: Improve error logging when applying a CCB [#2832]
Review request for Ticket(s): 2832
Peer Reviewer(s): vijay@oracle.com
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2832
Base revision: b83be452a25a37c7f5b568b436d1af544afb7350
Personal repository: git://git.code.sf.net/u/elunlen/review


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):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 66b31fbe198d53ce4cb8917bdf457b27a6595bd3
Author: Lennart Lund 
Date:   Mon, 9 Apr 2018 15:44:57 +0200

smf: Improve error logging when applying a CCB [#2832]

When applying a CCB fail the return code is SA_AIS_ERR_FAILED_OPERATION.
There is a number of reasons for this return code. Add logging of the reason.
Also add logging if failing to delete a node group where the return code is
othervise ignored.



Complete diffstat:
--
 src/smf/smfd/SmfAdminState.cc  | 6 +-
 src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
Ack from reviewer. Very small enhancement that only affects logging
I will push in 3 days also if no comments


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 ~/.gitconfig file (i.e. user.name, user.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.


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] smf: Improve error logging when applying a CCB [#2832]

2018-04-09 Thread Lennart Lund
When applying a CCB fail the return code is SA_AIS_ERR_FAILED_OPERATION.
There is a number of reasons for this return code. Add logging of the reason.
Also add logging if failing to delete a node group where the return code is
othervise ignored.
---
 src/smf/smfd/SmfAdminState.cc  | 6 +-
 src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/smf/smfd/SmfAdminState.cc b/src/smf/smfd/SmfAdminState.cc
index 950844766..6292e165c 100644
--- a/src/smf/smfd/SmfAdminState.cc
+++ b/src/smf/smfd/SmfAdminState.cc
@@ -558,7 +558,11 @@ bool SmfAdminStateHandler::adminOperationNodeGroup(
 LOG_NO("%s: setNodeGroupAdminState() Fail %s", __FUNCTION__,
saf_error(ais_errno));
   }
-  (void)deleteNodeGroup();
+  if (deleteNodeGroup() == false) {
+LOG_NO("%s: deleteNodeGroup(), Fail. "
+"Changing state did not fail. %s Return code is not set to Fail",
+   __FUNCTION__, __FUNCTION__);
+  }
 }
   } else {
 TRACE("\t m_nodelist is empty!");
diff --git a/src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc 
b/src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc
index 082dd81c5..051d76775 100644
--- a/src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc
+++ b/src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc
@@ -56,7 +56,7 @@ bool IsResorceAbort(const SaImmCcbHandleT& ccbHandle) {
   const SaStringT *errString = nullptr;
   SaAisErrorT ais_rc = saImmOmCcbGetErrorStrings(ccbHandle, );
   if ((ais_rc == SA_AIS_OK) && (errString != nullptr)) {
-TRACE("%s: Error string: '%s'", __FUNCTION__, errString[0]);
+LOG_NO("%s: Error string: '%s'", __FUNCTION__, errString[0]);
 std::string err_str(errString[0]);
 if (err_str.find("IMM: Resource abort: ") != std::string::npos) {
   // Is Resource Abort
-- 
2.16.2


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] smfd: Fix incorrect handling of SMFND NCSMDS_UP/DOWN events [#2821]

2018-04-09 Thread Lennart Lund
Hi Nguyen,

My comment was just a minor comment. Just handle it based on what you think is 
best.

Thanks
Lennart

> -Original Message-
> From: Syam Prasad Talluri [mailto:syam.tall...@oracle.com]
> Sent: den 9 april 2018 11:28
> To: Nguyen Tran Khoi Luu ; Lennart Lund
> ; Vijay Roy 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [devel] [PATCH 1/1] smfd: Fix incorrect handling of SMFND
> NCSMDS_UP/DOWN events [#2821]
> 
> Hi Nguyen,
> 
> Reviewed the Patch. Ack from my side.
> 
> Thanks,
> Syam.
> 
> -Original Message-
> From: Nguyen Luu [mailto:nguyen.tk@dektech.com.au]
> Sent: Monday, April 9, 2018 7:56 AM
> To: Lennart Lund ; Vijay Roy
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1/1] smfd: Fix incorrect handling of SMFND
> NCSMDS_UP/DOWN events [#2821]
> 
> Hi,
> 
> I intend to push this patch by the end of today if there are no more
> comments.
> 
> Thanks,
> Nguyen
> 
> On 4/6/2018 10:54 AM, Nguyen Luu wrote:
> > Hi Lennart,
> >
> > Thank you for your comment.
> >
> > You suggested that the changed files be reformatted following Google
> > Coding Style (i.e space-indented); but according to OpenSAF Coding
> > Rules
> >  3A__sourceforge.net_p_opensaf_wiki_Coding-
> 2520Rules_=DwIGaQ=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI
> _JnE=V-rHpog7bglMV_qtz_u-J_IeS6G1w2MSO-
> XRrmj38iQ=VlY7OygEZVrtnevHPu_qib7Y2P1nwqqwVvvp_IR_ZS4=RJtnc
> FTnfz3-HwlTpk4sNF0rke1PxSzYqTiN-qU4Xow=>, C code shall follow Linux
> kernel Coding Style (i.e tab-indented).
> > It seems that the old code line used mixed tabs and spaces, so that's
> > probably why you see my new code line as incorrectly indented. I used
> > 'tabs' actually.
> >
> > Can you check again and confirm the coding style?
> >
> > Thanks,
> > Nguyen
> >
> > On 4/5/2018 8:38 PM, Lennart Lund wrote:
> >> Hi Nguyen,
> >>
> >> Ack with comments. See below [Lennart]
> >>
> >> Thanks
> >> Lennart
> >>
> >>> -Original Message-
> >>> From: Nguyen Luu [mailto:nguyen.tk@dektech.com.au]
> >>> Sent: den 28 mars 2018 10:08
> >>> To: Lennart Lund ; vijay@oracle.com
> >>> Cc: opensaf-devel@lists.sourceforge.net; Nguyen Tran Khoi Luu
> >>> 
> >>> Subject: [PATCH 1/1] smfd: Fix incorrect handling of SMFND
> >>> NCSMDS_UP/DOWN events [#2821]
> >>>
> >>> Current handling of SMFND DOWN event does not take into account
> >>> failed SMFND UP event, which could eventually result in an inexact
> >>> view of the actual number of SMFND nodes in the cluster if, for
> >>> example, a node happened to be DOWN and UP twice, and the first UP
> >>> event somehow failed.
> >>> ---
> >>>   src/smf/smfd/smfd_evt.c   | 7 ---
> >>>   src/smf/smfd/smfd_smfnd.c | 9 +
> >>>   2 files changed, 13 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/src/smf/smfd/smfd_evt.c b/src/smf/smfd/smfd_evt.c index
> >>> 32f83fd..6f60c13 100644
> >>> --- a/src/smf/smfd/smfd_evt.c
> >>> +++ b/src/smf/smfd/smfd_evt.c
> >>> @@ -1,6 +1,7 @@
> >>>   /*  -*- OpenSAF  -*-
> >>>    *
> >>>    * (C) Copyright 2008 The OpenSAF Foundation
> >>> + * Copyright (C) 2018 Ericsson AB. 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 @@ -86,7 +87,7 @@ static void
> >>> proc_mds_info(smfd_cb_t *cb, SMFSV_EVT
> >>> *evt)
> >>>
> >>>   if (mds_info->svc_id == NCSMDS_SVC_ID_SMFND) {
> >>>   if (smfnd_up(mds_info->node_id, mds_info->dest,
> >>> - mds_info->rem_svc_pvt_ver) ==
> >>> SA_AIS_OK)
> >> [Lennart] Format: The following line has incorrect indentation and is
> >> probably too long. It is Ok to reformat this file according to Google
> >> style guide
> >>> +    mds_info-
>  rem_svc_pvt_ver) == NCSCC_RC_SUCCESS)
> >>>   cb->no_of_smfnd++;
> >>>   else
> >>>   LOG_WA("%s: SMFND UP failed", __FUNCTION__); @@
> >>> -100,8 +101,8 @@ static void proc_mds_info(smfd_cb_t *cb,
> SMFSV_EVT
> >>> *evt)
> >>>   }
> >>>
> >>>   if (mds_info->svc_id == NCSMDS_SVC_ID_SMFND) {
> >>> -    smfnd_down(mds_info->node_id);
> >>> -    cb->no_of_smfnd--;
> >>> +    if (smfnd_down(mds_info->node_id) ==
> >>> NCSCC_RC_SUCCESS)
> >>> +    cb->no_of_smfnd--;
> >>>   }
> >>>   break;
> >>>
> >>> diff --git a/src/smf/smfd/smfd_smfnd.c b/src/smf/smfd/smfd_smfnd.c
> >>> index c48adb2..5a64507 100644
> >>> --- a/src/smf/smfd/smfd_smfnd.c
> >>> +++ b/src/smf/smfd/smfd_smfnd.c
> >>> @@ -1,6 +1,7 @@
> >>>   /*  OpenSAF
> >>>    *
> >>>    * (C) Copyright 2008 The OpenSAF Foundation
> >>> + * Copyright (C) 2018 

Re: [devel] [PATCH 1/1] smfd: Fix incorrect handling of SMFND NCSMDS_UP/DOWN events [#2821]

2018-04-09 Thread Syam Prasad Talluri
Hi Nguyen,

Reviewed the Patch. Ack from my side.

Thanks,
Syam.

-Original Message-
From: Nguyen Luu [mailto:nguyen.tk@dektech.com.au] 
Sent: Monday, April 9, 2018 7:56 AM
To: Lennart Lund ; Vijay Roy 
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1/1] smfd: Fix incorrect handling of SMFND 
NCSMDS_UP/DOWN events [#2821]

Hi,

I intend to push this patch by the end of today if there are no more comments.

Thanks,
Nguyen

On 4/6/2018 10:54 AM, Nguyen Luu wrote:
> Hi Lennart,
>
> Thank you for your comment.
>
> You suggested that the changed files be reformatted following Google 
> Coding Style (i.e space-indented); but according to OpenSAF Coding 
> Rules 
> ,
>  C code shall follow Linux kernel Coding Style (i.e tab-indented).
> It seems that the old code line used mixed tabs and spaces, so that's 
> probably why you see my new code line as incorrectly indented. I used 
> 'tabs' actually.
>
> Can you check again and confirm the coding style?
>
> Thanks,
> Nguyen
>
> On 4/5/2018 8:38 PM, Lennart Lund wrote:
>> Hi Nguyen,
>>
>> Ack with comments. See below [Lennart]
>>
>> Thanks
>> Lennart
>>
>>> -Original Message-
>>> From: Nguyen Luu [mailto:nguyen.tk@dektech.com.au]
>>> Sent: den 28 mars 2018 10:08
>>> To: Lennart Lund ; vijay@oracle.com
>>> Cc: opensaf-devel@lists.sourceforge.net; Nguyen Tran Khoi Luu 
>>> 
>>> Subject: [PATCH 1/1] smfd: Fix incorrect handling of SMFND 
>>> NCSMDS_UP/DOWN events [#2821]
>>>
>>> Current handling of SMFND DOWN event does not take into account 
>>> failed SMFND UP event, which could eventually result in an inexact 
>>> view of the actual number of SMFND nodes in the cluster if, for 
>>> example, a node happened to be DOWN and UP twice, and the first UP 
>>> event somehow failed.
>>> ---
>>>   src/smf/smfd/smfd_evt.c   | 7 ---
>>>   src/smf/smfd/smfd_smfnd.c | 9 +
>>>   2 files changed, 13 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/src/smf/smfd/smfd_evt.c b/src/smf/smfd/smfd_evt.c index 
>>> 32f83fd..6f60c13 100644
>>> --- a/src/smf/smfd/smfd_evt.c
>>> +++ b/src/smf/smfd/smfd_evt.c
>>> @@ -1,6 +1,7 @@
>>>   /*  -*- OpenSAF  -*-
>>>    *
>>>    * (C) Copyright 2008 The OpenSAF Foundation
>>> + * Copyright (C) 2018 Ericsson AB. 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 @@ -86,7 +87,7 @@ static void 
>>> proc_mds_info(smfd_cb_t *cb, SMFSV_EVT
>>> *evt)
>>>
>>>   if (mds_info->svc_id == NCSMDS_SVC_ID_SMFND) {
>>>   if (smfnd_up(mds_info->node_id, mds_info->dest,
>>> - mds_info->rem_svc_pvt_ver) ==
>>> SA_AIS_OK)
>> [Lennart] Format: The following line has incorrect indentation and is 
>> probably too long. It is Ok to reformat this file according to Google 
>> style guide
>>> +    mds_info-
 rem_svc_pvt_ver) == NCSCC_RC_SUCCESS)
>>>   cb->no_of_smfnd++;
>>>   else
>>>   LOG_WA("%s: SMFND UP failed", __FUNCTION__); @@ 
>>> -100,8 +101,8 @@ static void proc_mds_info(smfd_cb_t *cb, SMFSV_EVT 
>>> *evt)
>>>   }
>>>
>>>   if (mds_info->svc_id == NCSMDS_SVC_ID_SMFND) {
>>> -    smfnd_down(mds_info->node_id);
>>> -    cb->no_of_smfnd--;
>>> +    if (smfnd_down(mds_info->node_id) ==
>>> NCSCC_RC_SUCCESS)
>>> +    cb->no_of_smfnd--;
>>>   }
>>>   break;
>>>
>>> diff --git a/src/smf/smfd/smfd_smfnd.c b/src/smf/smfd/smfd_smfnd.c 
>>> index c48adb2..5a64507 100644
>>> --- a/src/smf/smfd/smfd_smfnd.c
>>> +++ b/src/smf/smfd/smfd_smfnd.c
>>> @@ -1,6 +1,7 @@
>>>   /*  OpenSAF
>>>    *
>>>    * (C) Copyright 2008 The OpenSAF Foundation
>>> + * Copyright (C) 2018 Ericsson AB. 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 @@ -212,6 +213,14 @@ uint32_t 
>>> smfnd_down(SaClmNodeIdT i_node_id)
>>>   /* Update the node info */
>>>   while (smfnd != NULL) {
>>>   if (smfnd->clmInfo.nodeId == i_node_id) {
>>> +    /* Check if the node state was already Down,
>>> + * probably due to previous failed SMFND UP event
>>> + */
>>> +    if (smfnd->nd_state == ndDown) {
>> [Lennart] Formatting: The following line is too long. It is Ok to 
>> reformat this file to follow Google style guide
>>> +    

Re: [devel] [PATCH 1/1] build: Add support for google gmock framework V2 [#2823]

2018-04-09 Thread Hans Nordebäck

Hi Anders,

I'll remove the turtle example. Perhaps we also can add a git pull if 
the repo is older than some date?


/Thanks HansN


On 04/09/2018 10:09 AM, Anders Widell wrote:

Ack with comments:

1) You must replace the turtle example with something that you have 
written yourself, to avoid potential license problems.


2) One inline comment below, marked AndersW>

regards,

Anders Widell


On 04/03/2018 01:05 PM, Hans Nordeback wrote:

---
  00-README.unittest  | 24 ++--
  src/ais/Makefile.am |  5 -
  src/amf/Makefile.am |  7 +--
  src/base/Makefile.am    | 21 +
  src/base/tests/mock_turtle.cc   | 20 
  src/base/tests/mock_turtle.h    | 18 ++
  src/base/tests/turtle.h | 17 +
  src/dtm/Makefile.am |  5 -
  src/experimental/immcpp/api/Makefile.am |  5 -
  src/log/Makefile.am |  5 -
  test.sh | 12 +---
  11 files changed, 116 insertions(+), 23 deletions(-)
  create mode 100644 src/base/tests/mock_turtle.cc
  create mode 100644 src/base/tests/mock_turtle.h
  create mode 100644 src/base/tests/turtle.h

diff --git a/00-README.unittest b/00-README.unittest
index 79e4b4b41..f297bccd0 100644
--- a/00-README.unittest
+++ b/00-README.unittest
@@ -1,22 +1,25 @@
-Support for using google unit test in openSAF. Using unit test 
during e.g. refactoring
+Support for using google unit test and google mock in openSAF. Using 
unit test and mocking during e.g. refactoring
  to identify units and make code unit testable should improve the 
overall code quality and robustness.

  Regarding google unit test, see:
  https://code.google.com/p/googletest/
    To get and install google test do the following:
  -wget https://googletest.googlecode.com/files/gtest-1.7.0.zip
-unzip gtest-1.7.0.zip
-cd gtest-1.7.0
-./configure
-make
-export GTEST_DIR=`pwd`
+git clone https://github.com/google/googletest.git
+cd googletest
+
+autoreconf -vi
+./configure --with-pthreads
+make -j 4
+
+export GTEST_DIR=`pwd`/googletest
+export GMOCK_DIR=`pwd`/googlemock
    configure openSAF as usual, for example:
  ./bootstrap.ch
  ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" 
--enable-tipc

  -make -j
+make -j 4
    To build and run the unit tests
  make check
@@ -40,8 +43,9 @@ services/saf/amf/
  └── config
    The test code to have the following naming convention as below:
-tests will be in file test_.cc, where  is the name of the 
unit test case,
-e.g test_amfdb.cc. No need to call the RUN_ALL_TESTS() macro, it is 
included in gtest_main
+tests will be in file _test.cc, where  is the name of the 
unit test case,

+mocks will be in file mock_.cc, where  is the name of the mock.
+No need to call the RUN_ALL_TESTS() macro, it is included in 
gtest_main and gmock_main

  and are automatically linked with the unit test cases.
    diff --git a/src/ais/Makefile.am b/src/ais/Makefile.am
index 1af75a0f4..2ef34b219 100644
--- a/src/ais/Makefile.am
+++ b/src/ais/Makefile.am
@@ -101,7 +101,8 @@ bin_testlib_CXXFLAGS = \
    bin_testlib_CPPFLAGS = \
  $(AM_CPPFLAGS) \
-    -I$(GTEST_DIR)/include
+    -I$(GTEST_DIR)/include \
+    -I$(GMOCK_DIR)/include
    bin_testlib_LDFLAGS = \
  $(AM_LDFLAGS)
@@ -112,4 +113,6 @@ bin_testlib_SOURCES = \
  bin_testlib_LDADD = \
  $(GTEST_DIR)/lib/libgtest.la \
  $(GTEST_DIR)/lib/libgtest_main.la \
+    $(GMOCK_DIR)/lib/libgmock.la \
+    $(GMOCK_DIR)/lib/libgmock_main.la \
  lib/libopensaf_core.la
diff --git a/src/amf/Makefile.am b/src/amf/Makefile.am
index 25261fded..413571a52 100644
--- a/src/amf/Makefile.am
+++ b/src/amf/Makefile.am
@@ -194,7 +194,8 @@ bin_testamfd_CXXFLAGS =$(AM_CXXFLAGS)
  bin_testamfd_CPPFLAGS = \
  -DSA_CLM_B01=1 -DSA_EXTENDED_NAME_SOURCE \
  $(AM_CPPFLAGS) \
-    -I$(GTEST_DIR)/include
+    -I$(GTEST_DIR)/include \
+    -I$(GMOCK_DIR)/include
    bin_testamfd_LDFLAGS = \
  $(AM_LDFLAGS) \
@@ -264,7 +265,9 @@ bin_testamfd_LDADD = \
  lib/libSaNtf.la \
  lib/libopensaf_core.la \
  $(GTEST_DIR)/lib/libgtest.la \
-    $(GTEST_DIR)/lib/libgtest_main.la
+    $(GTEST_DIR)/lib/libgtest_main.la \
+    $(GMOCK_DIR)/lib/libgmock.la \
+    $(GMOCK_DIR)/lib/libgmock_main.la
    bin_amfpm_CPPFLAGS = \
  -DSA_EXTENDED_NAME_SOURCE \
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index bb13d6c43..a7316ceb7 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -150,6 +150,8 @@ noinst_HEADERS += \
  src/base/tests/mock_osaf_abort.h \
  src/base/tests/mock_osafassert.h \
  src/base/tests/mock_syslog.h \
+    src/base/tests/mock_turtle.h \
+    src/base/tests/turtle.h \
  src/base/time.h \
  src/base/unix_client_socket.h \
  src/base/unix_server_socket.h \
@@ -163,7 +165,8 @@ 

Re: [devel] [PATCH 1/1] base: Check return code from unlink in nid_create_ipc [#2829]

2018-04-09 Thread Hans Nordebäck

Hi Anders,

yes, I'll change to you suggestion.

/Thanks HansN


On 04/06/2018 04:10 PM, Anders Widell wrote:
Ack with minor comment: instead of calling access(), you could maybe 
simply check for the ENOENT errno value from unlink()?


regards,

Anders Widell


On 04/05/2018 11:53 AM, Hans Nordeback wrote:

---
  src/nid/agent/nid_ipc.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/nid/agent/nid_ipc.c b/src/nid/agent/nid_ipc.c
index 4f43cd309..1a77fd8e2 100644
--- a/src/nid/agent/nid_ipc.c
+++ b/src/nid/agent/nid_ipc.c
@@ -28,6 +28,7 @@
    #include 
  #include 
+#include 
  #include "osaf/configmake.h"
    #include "nid/agent/nid_api.h"
@@ -56,7 +57,13 @@ uint32_t nid_create_ipc(char *strbuf)
  mode_t mask;
    /* Lets Remove any such file if it already exists */
-    unlink(NID_FIFO);
+    if (access(NID_FIFO, F_OK ) != -1 ) {
+    if (unlink(NID_FIFO) < 0) {
+    sprintf(strbuf, " FAILURE: Unable To Delete FIFO Error: 
%s\n",

+    strerror(errno));
+    return NCSCC_RC_FAILURE;
+    }
+    }
    mask = umask(0);





--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


Re: [devel] [PATCH 1/1] build: Add support for google gmock framework V2 [#2823]

2018-04-09 Thread Anders Widell

Ack with comments:

1) You must replace the turtle example with something that you have 
written yourself, to avoid potential license problems.


2) One inline comment below, marked AndersW>

regards,

Anders Widell


On 04/03/2018 01:05 PM, Hans Nordeback wrote:

---
  00-README.unittest  | 24 ++--
  src/ais/Makefile.am |  5 -
  src/amf/Makefile.am |  7 +--
  src/base/Makefile.am| 21 +
  src/base/tests/mock_turtle.cc   | 20 
  src/base/tests/mock_turtle.h| 18 ++
  src/base/tests/turtle.h | 17 +
  src/dtm/Makefile.am |  5 -
  src/experimental/immcpp/api/Makefile.am |  5 -
  src/log/Makefile.am |  5 -
  test.sh | 12 +---
  11 files changed, 116 insertions(+), 23 deletions(-)
  create mode 100644 src/base/tests/mock_turtle.cc
  create mode 100644 src/base/tests/mock_turtle.h
  create mode 100644 src/base/tests/turtle.h

diff --git a/00-README.unittest b/00-README.unittest
index 79e4b4b41..f297bccd0 100644
--- a/00-README.unittest
+++ b/00-README.unittest
@@ -1,22 +1,25 @@
-Support for using google unit test in openSAF. Using unit test during e.g. 
refactoring
+Support for using google unit test and google mock in openSAF. Using unit test 
and mocking during e.g. refactoring
  to identify units and make code unit testable should improve the overall code 
quality and robustness.
  Regarding google unit test, see:
  https://code.google.com/p/googletest/
  
  To get and install google test do the following:
  
-wget https://googletest.googlecode.com/files/gtest-1.7.0.zip

-unzip gtest-1.7.0.zip
-cd gtest-1.7.0
-./configure
-make
-export GTEST_DIR=`pwd`
+git clone https://github.com/google/googletest.git
+cd googletest
+
+autoreconf -vi
+./configure --with-pthreads
+make -j 4
+
+export GTEST_DIR=`pwd`/googletest
+export GMOCK_DIR=`pwd`/googlemock
  
  configure openSAF as usual, for example:

  ./bootstrap.ch
  ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" --enable-tipc
  
-make -j

+make -j 4
  
  To build and run the unit tests

  make check
@@ -40,8 +43,9 @@ services/saf/amf/
  └── config
  
  The test code to have the following naming convention as below:

-tests will be in file test_.cc, where  is the name of the unit test 
case,
-e.g test_amfdb.cc. No need to call the RUN_ALL_TESTS() macro, it is included 
in gtest_main
+tests will be in file _test.cc, where  is the name of the unit test 
case,
+mocks will be in file mock_.cc, where  is the name of the mock.
+No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main and 
gmock_main
  and are automatically linked with the unit test cases.
  
  
diff --git a/src/ais/Makefile.am b/src/ais/Makefile.am

index 1af75a0f4..2ef34b219 100644
--- a/src/ais/Makefile.am
+++ b/src/ais/Makefile.am
@@ -101,7 +101,8 @@ bin_testlib_CXXFLAGS = \
  
  bin_testlib_CPPFLAGS = \

$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
  
  bin_testlib_LDFLAGS = \

$(AM_LDFLAGS)
@@ -112,4 +113,6 @@ bin_testlib_SOURCES = \
  bin_testlib_LDADD = \
$(GTEST_DIR)/lib/libgtest.la \
$(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la \
lib/libopensaf_core.la
diff --git a/src/amf/Makefile.am b/src/amf/Makefile.am
index 25261fded..413571a52 100644
--- a/src/amf/Makefile.am
+++ b/src/amf/Makefile.am
@@ -194,7 +194,8 @@ bin_testamfd_CXXFLAGS =$(AM_CXXFLAGS)
  bin_testamfd_CPPFLAGS = \
-DSA_CLM_B01=1 -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
  
  bin_testamfd_LDFLAGS = \

$(AM_LDFLAGS) \
@@ -264,7 +265,9 @@ bin_testamfd_LDADD = \
lib/libSaNtf.la \
lib/libopensaf_core.la \
$(GTEST_DIR)/lib/libgtest.la \
-   $(GTEST_DIR)/lib/libgtest_main.la
+   $(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la
  
  bin_amfpm_CPPFLAGS = \

-DSA_EXTENDED_NAME_SOURCE \
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index bb13d6c43..a7316ceb7 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -150,6 +150,8 @@ noinst_HEADERS += \
src/base/tests/mock_osaf_abort.h \
src/base/tests/mock_osafassert.h \
src/base/tests/mock_syslog.h \
+   src/base/tests/mock_turtle.h \
+   src/base/tests/turtle.h \
src/base/time.h \
src/base/unix_client_socket.h \
src/base/unix_server_socket.h \
@@ -163,7 +165,8 @@ bin_testleap_CXXFLAGS =$(AM_CXXFLAGS)
  bin_testleap_CPPFLAGS = \
-DSA_CLM_B01=1 \