[devel] [PATCH 0/1] Review Request for rde: improve logging in split brain case [#2556]

2017-10-17 Thread Hoang Vo
Summary: rde: improve logging in split brain case [#2556]
Review request for Ticket(s): 2556
Peer Reviewer(s): anders.wid...@ericsson.com, hans.fe...@ericsson.com
Pull request to: anders.wid...@ericsson.com
Affected branch(es): develop
Development branch: ticket-2556
Base revision: 6a3ae89b9ab2aae9d07e02fc60dc60293986c442
Personal repository: git://git.code.sf.net/u/swgerai/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 f76253ebf02df5434ceaf2d2daf74852d155d596
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 18 Oct 2017 10:33:49 +0700

rde: improve logging in split brain case [#2556]

Add extra CR log when split brain is detected.



Complete diffstat:
--
 src/rde/rded/rde_main.cc | 1 +
 1 file changed, 1 insertion(+)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-
ACK from maintainer(s)

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 1/1] rde: improve logging in split brain case [#2556]

2017-10-17 Thread Hoang Vo
Add extra CR log when split brain is detected.
---
 src/rde/rded/rde_main.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/rde/rded/rde_main.cc b/src/rde/rded/rde_main.cc
index 0298bf3..ded0111 100644
--- a/src/rde/rded/rde_main.cc
+++ b/src/rde/rded/rde_main.cc
@@ -132,6 +132,7 @@ static void CheckForSplitBrain(const rde_msg *msg) {
   PCS_RDA_ROLE own_role = role->role();
   PCS_RDA_ROLE other_role = msg->info.peer_info.ha_role;
   if (own_role == PCS_RDA_ACTIVE && other_role == PCS_RDA_ACTIVE) {
+   LOG_CR("Split-brain detected");
 opensaf_reboot(0, nullptr, "Split-brain detected");
   }
 }
-- 
1.9.1


--
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 ckpt: add timeout handling for test_ckptOverwrite [#2624]

2017-10-12 Thread Hoang Vo
Summary: ckpt: add timeout handling for test_ckptOverwrite [#2624]
Review request for Ticket(s): 2624
Peer Reviewer(s): ajo...@genband.com
Pull request to: ajo...@genband.com
Affected branch(es): develop, release
Development branch: ticket-2624
Base revision: 4fbc3261d53914242bdbc5c300caecc53b88365a
Personal repository: git://git.code.sf.net/u/swgerai/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):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 38ebcac386e4cfda5c0b17feabaa609c526651d9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 12 Oct 2017 16:53:24 +0700

ckpt: add timeout handling for test_ckptOverwrite [#2624]

test_ckptOverwrite verify overwrite behavior and should
handle SA_AIS_ERR_TIMEOUT by retrying operation.



Complete diffstat:
--
 src/ckpt/apitest/test_cpa_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Testing Commands:
-
ckpttest 20 1

Testing, Expected Results:
--
test case pass even in delay network situation

Conditions of Submission:
-
ACK from maintainer

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 1/1] ckpt: add timeout handling for test_ckptOverwrite [#2624]

2017-10-12 Thread Hoang Vo
test_ckptOverwrite verify overwrite behavior and should
handle SA_AIS_ERR_TIMEOUT by retrying operation.
---
 src/ckpt/apitest/test_cpa_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ckpt/apitest/test_cpa_util.c b/src/ckpt/apitest/test_cpa_util.c
index 9c1b6ba..6634790 100644
--- a/src/ckpt/apitest/test_cpa_util.c
+++ b/src/ckpt/apitest/test_cpa_util.c
@@ -1810,7 +1810,7 @@ retry:
result = cpsv_test_result(rc, API_Overwrite[i].exp_output,
  API_Overwrite[i].result_string, cfg_flg);
 
-   if (rc == SA_AIS_ERR_TRY_AGAIN)
+   if (rc == SA_AIS_ERR_TRY_AGAIN || rc == SA_AIS_ERR_TIMEOUT)
goto retry;
 
if (rc == SA_AIS_OK) {
-- 
1.9.1


--
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 clmtest: update non-member node_id for new test environment [#2512]

2017-06-27 Thread Hoang Vo
Summary: clmtest: update non-member node_id for new test environment [#2512]
Review request for Ticket(s): 2512
Peer Reviewer(s): praveen.malv...@oracle.com
Pull request to: praveen.malv...@oracle.com
Affected branch(es): develop, release
Development branch: ticket-2512
Base revision: 829519a4f3a86eb836a55be8301fd5d2befeeec3
Personal repository: git://git.code.sf.net/u/swgerai/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 712a8968c0cf969868e2473310dd8511cc15212f
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 27 Jun 2017 16:24:59 +0700

clmtest: update non-member node_id for new test environment [#2512]

clmtest 7 7 check saClmClusterNodeGet with non-member node,
previously designed as 0x2060F.
change test node_id to 0x2990F to avoid future conflict
when test environment is upgraded.



Complete diffstat:
--
 src/clm/apitest/tet_saClmClusterNodeGet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


Testing Commands:
-
clmtest 7 7

Testing, Expected Results:
--
test case pass with 2SCs 4PLs environment

Conditions of Submission:
-
ACK from maintainer

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 1/1] clmtest: correct independent test cases [#2497]

2017-06-15 Thread Hoang Vo
clmtest 10 3 and 10 4 does not initialize its data struct but reuse
global one lead to failure result when run alone.
---
 src/clm/apitest/tet_saClmClusterNotificationFree.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/clm/apitest/tet_saClmClusterNotificationFree.c 
b/src/clm/apitest/tet_saClmClusterNotificationFree.c
index 5ce002a..22faf15 100644
--- a/src/clm/apitest/tet_saClmClusterNotificationFree.c
+++ b/src/clm/apitest/tet_saClmClusterNotificationFree.c
@@ -53,6 +53,12 @@ void saClmClusterNotificationFree_02(void)
 
 void saClmClusterNotificationFree_03(void)
 {
+   notificationBuffer_4.numberOfItems = 1;
+   notificationBuffer_4.notification =
+   (SaClmClusterNotificationT_4 *)malloc(
+   sizeof(SaClmClusterNotificationT_4) *
+   notificationBuffer_4.numberOfItems);
+
rc = saClmClusterNotificationFree_4(0,
notificationBuffer_4.notification);
test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
@@ -62,6 +68,12 @@ void saClmClusterNotificationFree_03(void)
 
 void saClmClusterNotificationFree_04(void)
 {
+   notificationBuffer_4.numberOfItems = 1;
+   notificationBuffer_4.notification =
+   (SaClmClusterNotificationT_4 *)malloc(
+   sizeof(SaClmClusterNotificationT_4) *
+   notificationBuffer_4.numberOfItems);
+
rc = saClmClusterNotificationFree_4(-1,
notificationBuffer_4.notification);
test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
-- 
1.9.1


--
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 clmtest: correct independent test cases [#2497]

2017-06-15 Thread Hoang Vo
Summary: clmtest: correct independent test cases [#2497]
Review request for Ticket(s): 2497
Peer Reviewer(s): praveen.malv...@oracle.com
Pull request to: praveen.malv...@oracle.com
Affected branch(es): develop, default
Development branch: ticket-2497
Base revision: 0129b4ce2fc7601ef37bfea62fec65c30cd472c4
Personal repository: git://git.code.sf.net/u/swgerai/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 3cd3ca751dfea2fc7a3d575a8361313253eaf816
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 15 Jun 2017 15:15:55 +0700

clmtest: correct independent test cases [#2497]

clmtest 10 3 and 10 4 does not initialize its data struct but reuse
global one lead to failure result when run alone.



Complete diffstat:
--
 src/clm/apitest/tet_saClmClusterNotificationFree.c | 12 
 1 file changed, 12 insertions(+)


Testing Commands:
-
in PL-3, clmtest 10 3 and clmtest 10 4

Testing, Expected Results:
--
test cases passed

Conditions of Submission:
-
ACK from maintainer

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 1/1] test: improve fail report of multiple test_validate [#2486]

2017-06-07 Thread Hoang Vo
When a test case call test_validate() multiple times, the test report
is not clear so enhance it for easier recognizing result.
---
 src/osaf/apitest/utest.c | 33 -
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/osaf/apitest/utest.c b/src/osaf/apitest/utest.c
index 2407eaf..892cc6e 100644
--- a/src/osaf/apitest/utest.c
+++ b/src/osaf/apitest/utest.c
@@ -40,13 +40,14 @@ static unsigned int test_failed;
 
 /* Colors for test result output  */
 #define COLOR_RED "\033[1;31m" /* [1 Bold font. [22 if normal font */
-#define COLOR_RESET "\033[0m;"
+#define COLOR_RESET "\033[0m"
 
 static struct test testlist[NO_SUITES][NR_TESTS];
 static const char *suite_name[NO_SUITES];
 static int last_test_status;
 static SaAisErrorT actualStatus, expectedStatus;
 static unsigned int current_test;
+static unsigned int previous_test;
 
 unsigned int testdebug;
 
@@ -61,20 +62,32 @@ unsigned int testdebug;
 void test_validate(SaUint32T rc, SaUint32T expected)
 {
/* Save for later use */
-   actualStatus = rc;
-   expectedStatus = expected;
+   if (last_test_status != -1) {
+   actualStatus = rc;
+   expectedStatus = expected;
+   }
 
if (rc == expected) {
test_passed++;
-   printf("  %3d  PASSED", current_test);
-   last_test_status = 0;
+   if (previous_test != current_test) {
+   printf("  %3d  PASSED", current_test);
+   } else {
+   printf("/PASSED");
+   }
+   last_test_status |= 0;
} else {
test_failed++;
-   printf("%s  %3d  FAILED", COLOR_RED, current_test);
-   last_test_status = -1;
+   if (previous_test != current_test) {
+   printf("  %3d  %sFAILED%s",
+   current_test, COLOR_RED, COLOR_RESET);
+   } else {
+   printf("/%sFAILED%s", COLOR_RED, COLOR_RESET);
+   }
+   last_test_status |= -1;
}
 
test_total++;
+   previous_test = current_test;
 }
 
 /**
@@ -160,13 +173,15 @@ static int run_test_case(unsigned int suite, unsigned int 
tcase)
 {
if (testlist[suite][tcase].testfunc != NULL) {
current_test = tcase;
+   previous_test = 0;
+   last_test_status = 0;
testlist[suite][tcase].testfunc();
if (last_test_status == 0)
printf("\t%s%s\n", testlist[suite][tcase].slogan,
   COLOR_RESET);
else
-   printf("\t%s (expected %s, got %s)%s\n",
-  testlist[suite][tcase].slogan,
+   printf("\t%s %s(expected %s, got %s)%s\n",
+  testlist[suite][tcase].slogan, COLOR_RED,
   get_saf_error(expectedStatus),
   get_saf_error(actualStatus), COLOR_RESET);
return 0;
-- 
1.9.1


--
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 test: improve fail report of multiple test_validate [#2486]

2017-06-07 Thread Hoang Vo
Summary: test: improve fail report of multiple test_validate [#2486]
Review request for Ticket(s): 2486
Peer Reviewer(s): anders.wid...@ericsson.com
Pull request to: anders.wid...@ericsson.com
Affected branch(es): develop
Development branch: ticket-2486
Base revision: 664e46e54ef3c4b2e11b84e5efc73916ba6f6fc2
Personal repository: git://git.code.sf.net/u/swgerai/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 8872e9d0b9bdbc3a963b0cb5abf4c0b88776de4b
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 7 Jun 2017 14:01:09 +0700

test: improve fail report of multiple test_validate [#2486]

When a test case call test_validate() multiple times, the test report
is not clear so enhance it for easier recognizing result.



Complete diffstat:
--
 src/osaf/apitest/utest.c | 33 -
 1 file changed, 24 insertions(+), 9 deletions(-)


Testing Commands:
-
run clmtest command (contains multiple test_validate call)

Testing, Expected Results:
--
New result format display

Conditions of Submission:
-
ACK from maintainer

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 of 1] Review Request for mdstest: correct test cases [#2178] V2

2017-03-06 Thread Hoang Vo
Summary: mdstest: correct test cases [#2178] V2
Review request for Trac Ticket(s): #2178
Peer Reviewer(s): mahesh.va...@oracle.com
Pull request to: mahesh.va...@oracle.com
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 servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   y
 Other   n


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

changeset 4072c28b03cfa8945ae50163cdd0718de65e2645
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 07 Mar 2017 09:41:55 +0700

mdstest: correct test cases [#2178] V2

mdstest return failed in following cases:
- 13 14: message length
- 11 5, 9 5 and so on

actions:
- correct test case following new update
- wait for vdest_change_role() apply result before processing to next 
test
step


Complete diffstat:
--
 src/mds/apitest/mdstipc_api.c  |  8 ++--
 src/mds/apitest/mdstipc_conf.c |  9 +
 2 files changed, 15 insertions(+), 2 deletions(-)


Testing Commands:
-
run mdstest

Testing, Expected Results:
--
all test cases passed

Conditions of Submission:
-
ACK from maintainer

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 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 1 of 1] mdstest: correct test cases [#2178] V2

2017-03-06 Thread Hoang Vo
 src/mds/apitest/mdstipc_api.c  |  8 ++--
 src/mds/apitest/mdstipc_conf.c |  9 +
 2 files changed, 15 insertions(+), 2 deletions(-)


mdstest return failed in following cases:
- 13 14: message length
- 11 5, 9 5 and so on

actions:
- correct test case following new update
- wait for vdest_change_role() apply result before processing to next test step

diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.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
@@ -8982,7 +8983,6 @@ void tet_direct_just_send_tp_14()
 {
   int FAIL=0;
   MDS_SVC_ID svcids[]={NCSMDS_SVC_ID_EXTERNAL_MIN};
-  char big_message[8000];
 
   /*start up*/
   if(tet_initialise_setup(false))
@@ -9010,7 +9010,9 @@ void tet_direct_just_send_tp_14()
 }
 printf("\nTest Case 14: Not able to send a message of size 
>(MDS_DIRECT_BUF_MAXSIZE) to 2000\n");
 
-memset(big_message, 's', 8000);
+char * big_message = (char*)malloc(MDS_DIRECT_BUF_MAXSIZE + 1);
+memset(big_message, 's', MDS_DIRECT_BUF_MAXSIZE + 1);
+*(big_message + MDS_DIRECT_BUF_MAXSIZE) = 0;
 if(mds_direct_send_message(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,
NCSMDS_SVC_ID_EXTERNAL_MIN,1,
@@ -9024,6 +9026,8 @@ void tet_direct_just_send_tp_14()
 else
   printf("\nSuccess\n");
 
+free(big_message);
+
 printf("\nCancel subscription\n");
 if(mds_service_cancel_subscription(gl_tet_adest.mds_pwe1_hdl,
NCSMDS_SVC_ID_EXTERNAL_MIN,1,
diff --git a/src/mds/apitest/mdstipc_conf.c b/src/mds/apitest/mdstipc_conf.c
--- a/src/mds/apitest/mdstipc_conf.c
+++ b/src/mds/apitest/mdstipc_conf.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
@@ -21,6 +22,7 @@
 #include "mdstipc.h"
 #include "base/osaf_poll.h"
 extern int fill_syncparameters(int);
+extern uint32_t mds_vdest_tbl_get_role(MDS_VDEST_ID vdest_id, V_DEST_RL *role);
 /** ADEST WRAPPERS ***/
 uint32_t adest_get_handle(void)
 {
@@ -273,6 +275,13 @@ uint32_t vdest_change_role(MDS_DEST vdes
 
   if(ncsvda_api(_info)==NCSCC_RC_SUCCESS)
 {
+/*Making sure vdest change role done*/
+V_DEST_RL role = 0;
+mds_vdest_tbl_get_role(vdest, );
+while(role != new_role) {
+sleep(1);
+mds_vdest_tbl_get_role(vdest, );
+}
   printf("\nVDEST_CHANGE ROLE to %d is SUCCESSFULL",new_role);
   return NCSCC_RC_SUCCESS;
 }

--
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 2 of 2] mdstest: handle memory leak [#1860]

2017-03-06 Thread Hoang Vo
 src/mds/apitest/mdstipc.h  |3 +-
 src/mds/apitest/mdstipc_api.c  |  288 
 src/mds/apitest/mdstipc_conf.c |   42 ++---
 3 files changed, 163 insertions(+), 170 deletions(-)


mdstest leak in many cases because of:
- incorrect use of input param
- wrong test sequence (cacel subscription after uninstall)
- malloc then terminate thread (cannot reach free)
- missing free on receiving message (used global pointer)
- encode wrong message length

action: fix above cases

diff --git a/src/mds/apitest/mdstipc.h b/src/mds/apitest/mdstipc.h
--- a/src/mds/apitest/mdstipc.h
+++ b/src/mds/apitest/mdstipc.h
@@ -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
@@ -206,7 +207,7 @@ uint32_t destroy_pwe_on_vdest(MDS_HDL);
 
 /** USER DEFINED WRAPPERS FOR MDS SERVICE APIs **/
 
-uint32_t tet_create_task(NCS_OS_CB ,NCSCONTEXT );
+uint32_t tet_create_task(NCS_OS_CB ,NCSCONTEXT *);
 uint32_t tet_release_task(void *task_handle);
 int is_adest_sel_obj_found(int );
 int is_sel_obj_found(int);
diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -395,7 +395,7 @@ void  tet_svc_install_tp_10()
   printf("\nTest case 10:Installing the External MIN service EXTMIN in a 
seperate thread and Uninstalling it here\n");
   //Install thread
   rc = tet_create_task((NCS_OS_CB)tet_vdest_install_thread,
-   gl_tet_vdest[0].svc[0].task.t_handle);
+   _tet_vdest[0].svc[0].task.t_handle);
   if (rc !=  NCSCC_RC_SUCCESS) {
 printf("\nFail to Install thread\n");
 FAIL = 1;
@@ -403,9 +403,8 @@ void  tet_svc_install_tp_10()
 
   //Now Release the Install Thread
   rc = tet_release_task(gl_tet_vdest[0].svc[0].task.t_handle);
-  if (rc !=  NCSCC_RC_SUCCESS) {
-printf("\nFail to release thread\n");
-FAIL = 1;
+  if (rc ==  NCSCC_RC_SUCCESS) {
+printf("\nTask released\n");
   }
 
   //Counter shall be != 0
@@ -843,7 +842,7 @@ void  tet_svc_install_tp_17()
 void tet_vdest_uninstall_thread()
 {
   // Inside Thread
-  printf("tet_vdest_uninstall_thread\n");
+  printf("\ntet_vdest_uninstall_thread\n");
   test_validate(mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,500), 
NCSCC_RC_SUCCESS);
 }
@@ -1009,7 +1008,7 @@ void tet_svc_unstall_tp_5()
   //Uninstalling the above service in a seperate thread
   //Uninstall thread
   rc = tet_create_task((NCS_OS_CB)tet_vdest_uninstall_thread,
-   gl_tet_vdest[0].svc[0].task.t_handle);
+   _tet_vdest[0].svc[0].task.t_handle);
   if (rc !=  NCSCC_RC_SUCCESS) {
 printf("\nFail to create the uninstall thread\n");
 FAIL = 1;
@@ -1018,8 +1017,8 @@ void tet_svc_unstall_tp_5()
 
   //Now Release the Uninstall Thread
   rc = tet_release_task(gl_tet_vdest[0].svc[0].task.t_handle);
-  if (rc !=  NCSCC_RC_SUCCESS) {
-printf("\nFail to release the uninstall thread\n");
+  if (rc ==  NCSCC_RC_SUCCESS) {
+printf("\nTask released\n");
 FAIL = 1;
   }
 
@@ -1833,16 +1832,6 @@ void tet_svc_subscr_VDEST_10()
 FAIL = 1;
   }
 
-  printf("\tUninstalling 600 and 700\n");
-  for(id=600;id<=700;id=id+100)
-  {
-if(  
mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,id)!=NCSCC_RC_SUCCESS)
-{
-  printf("\nFail to uninstall service %d\n", id);
-  FAIL = 1;
-}
-  }
-
   //Cancelling the subscription
   if(mds_service_cancel_subscription(gl_tet_adest.mds_pwe1_hdl,500,2,
  svcids)!=NCSCC_RC_SUCCESS)
@@ -1850,6 +1839,17 @@ void tet_svc_subscr_VDEST_10()
 printf("\nFail cancel subscription 500\n");
 FAIL = 1;
   }
+
+  printf("\tUninstalling 600 and 700\n");
+  for(id=600;id<=700;id=id+100)
+  {
+if(  
mds_service_uninstall(gl_tet_vdest[0].mds_pwe1_hdl,id)!=NCSCC_RC_SUCCESS)
+{
+  printf("\nFail to uninstall service %d\n", id);
+  FAIL = 1;
+}
+  }
+
   if(  mds_service_uninstall(gl_tet_adest.mds_pwe1_hdl,500)!=NCSCC_RC_SUCCESS)
   {
 printf("\nFail to uninstall service 500\n");
@@ -2123,17 +2123,6 @@ void tet_svc_subscr_VDEST_12()
 FAIL=1;
   }
 
-  printf("\nAction: Uninstalling 600 \n");
-  for(i=0; i<=1;i++)
-  {
-if(  
mds_service_uninstall(gl_tet_vdest[i].mds_pwe1_hdl,600)!=NCSCC_RC_SUCCESS)
-
-{
-  printf("\nFail\n");
-  FAIL=1;
-}
-  } 
-
   printf("\nAction: Cancelling the subscription\n");
   if(mds_service_cancel_subscription(gl_tet_adest.mds_pwe1_hdl,500,1,
  svc_id_sixhd)!=NCSCC_RC_SUCCESS)
@@ -2141,6 +2130,17 @@ void tet_svc_subscr_VDEST_12()
 printf("\nFail\n");
 FAIL=1;
   }
+
+  printf("\nAction: Uninstalling 600 \n");
+  for(i=0; 

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

2017-03-06 Thread Hoang Vo
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

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


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

changeset 9a1f61672dd538472bf0c1340011467a35f83a23
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Mon, 06 Mar 2017 14:52:06 +0700

mds: handle memory leak [#1860]

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.

changeset 1efa643eb496a2938d1ddfecac6e91aa4a1cda88
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Mon, 06 Mar 2017 14:52:08 +0700

mdstest: handle memory leak [#1860]

mdstest leak in many cases because of:
- incorrect use of input param
- wrong test sequence (cacel subscription after uninstall)
- malloc then terminate thread (cannot reach free)
- missing free on receiving message (used global pointer)
- encode wrong message length

action: fix above cases


Complete diffstat:
--
 src/base/sysf_mem.c|3 +
 src/mds/apitest/mdstipc.h  |3 +-
 src/mds/apitest/mdstipc_api.c  |  288 
---
 src/mds/apitest/mdstipc_conf.c |   42 ++---
 src/mds/mds_c_sndrcv.c |   34 +++-
 5 files changed, 181 insertions(+), 189 deletions(-)


Testing Commands:
-
G_SLICE=always-malloc G_DEBUG=gc-friendly  valgrind -v --tool=memcheck 
--leak-check=full --num-callers=40 --log-file=valgrind.log mdstest

Testing, Expected Results:
--
No definitely and indirectly lost report in valgrind.log

Conditions of Submission:
-
ACK from maintainer

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

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

2017-03-06 Thread Hoang Vo
 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) {
-   m_MDS_FREE_DIRECT_BUFF(to_msg->data.info.buff);
-   }
return MDS_RC_MSG_NO_BUFFERING;
}
 
@@ -2071,7 +2059,8 @@ static uint32_t mcm_process_await_active
if (status != NCSCC_RC_SUCCESS) {
m_MDS_LOG_ERR("MDS_SND_RCV: CALLBACK ENC failed 
for svc_id = %s(%d)\n", 
get_svc_names(svc_cb->svc_id), svc_cb->svc_id);
-   return NCSCC_RC_FAILURE;
+   rc = NCSCC_RC_FAILURE;
+   goto free_mem;
}
 
if 

[devel] [PATCH 1 of 1] cpd: to correct failover behavior of cpsv [#1765] V5

2017-02-09 Thread Hoang Vo
 src/ckpt/ckptd/cpd_proc.c |  11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)


problem:
In case failover multiple times, the cpnd is down for a moment so there is no
cpnd opening specific checkpoint. This lead to retention timer is trigger.
When cpnd is up again but has different pid so retention timer is not stoped.
Repica is deleted at retention while its information still be in ckpt database.
That cause problem

Fix:
- Stop timer of removed node.
- Update data in patricia trees (for retention value consistence).

diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -679,7 +679,8 @@ uint32_t cpd_process_cpnd_down(CPD_CB *c
cpd_cpnd_info_node_find_add(>cpnd_tree, cpnd_dest, _info, 
_flag);
if (!cpnd_info)
return NCSCC_RC_SUCCESS;
-
+   /* Stop timer before processing down */
+   cpd_tmr_stop(_info->cpnd_ret_timer);
cref_info = cpnd_info->ckpt_ref_list;
 
while (cref_info) {
@@ -989,6 +990,14 @@ uint32_t cpd_proc_retention_set(CPD_CB *
 
/* Update the retention Time */
(*ckpt_node)->ret_time = reten_time;
+   (*ckpt_node)->attributes.retentionDuration = reten_time;
+
+   /* Update the related patricia tree */
+   CPD_CKPT_MAP_INFO *map_info = NULL;
+   cpd_ckpt_map_node_get(>ckpt_map_tree, (*ckpt_node)->ckpt_name, 
_info);
+   if (map_info) {
+   map_info->attributes.retentionDuration = reten_time;
+   }
return rc;
 }
 

--
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 of 1] Review Request for cpd: to correct failover behavior of cpsv [#1765] V5

2017-02-09 Thread Hoang Vo
Summary: cpd: to correct failover behavior of cpsv [#1765] V5
Review request for Trac Ticket(s): 1765
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

 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):
-
Dear Mahesh and Zoran,

I review and recall what has been done with this ticket in long past.
So I update the description, remove unnecessary change.

Please review again in this case.

Sincerely,
Hoang

changeset 5cd94b76cb0228254241c72a9a8210e13d0bd5f2
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 09 Feb 2017 14:51:33 +0700

cpd: to correct failover behavior of cpsv [#1765] V5

problem: In case failover multiple times, the cpnd is down for a moment 
so
there is no cpnd opening specific checkpoint. This lead to retention 
timer
is trigger. When cpnd is up again but has different pid so retention 
timer
is not stoped. Repica is deleted at retention while its information 
still be
in ckpt database. That cause problem

Fix:
- Stop timer of removed node.
- Update data in patricia trees (for retention value consistence).


Complete diffstat:
--
 src/ckpt/ckptd/cpd_proc.c |  11 ++-
 1 files changed, 10 insertions(+), 1 deletions(-)


Testing Commands:
-
follow steps in the ticket

Testing, Expected Results:
--
test case return OK

Conditions of Submission:
--
ACK from maintainer

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.


--
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.sourc

[devel] [PATCH 1 of 1] cpd: to correct failover behavior of cpsv [#1765]

2017-01-19 Thread Hoang Vo
 src/ckpt/ckptd/cpd_db.c |  15 +++
 src/ckpt/ckptd/cpd_evt.c|  12 
 src/ckpt/ckptd/cpd_proc.c   |  18 --
 src/ckpt/ckptnd/cpnd_evt.c  |   3 ++-
 src/ckpt/ckptnd/cpnd_proc.c |  12 +---
 5 files changed, 50 insertions(+), 10 deletions(-)


problem:
In case a failover happens while a checkpoint is being unlinked, it might 
causes an unfinished
unlink operation (i.e the checkpoint IMM object is not deleted). Later on, when 
the checkpoint is
created again, it will not succeed because the CPD detects that the checkpoint 
IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and re-create new 
one.
- Stop timer of removed node.
- Update data in patricia trees.

diff --git a/src/ckpt/ckptd/cpd_db.c b/src/ckpt/ckptd/cpd_db.c
--- a/src/ckpt/ckptd/cpd_db.c
+++ b/src/ckpt/ckptd/cpd_db.c
@@ -104,6 +104,21 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
/*create the imm runtime object */
if (ha_state == SA_AMF_HA_ACTIVE) {
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
+
+   /* The Checkpoint IMM object exist due to unfinished previous 
opernation (e.g unlink)
+* The action is to delete the old object and create a new one 
*/
+
+   if (err == SA_AIS_ERR_EXIST) {
+   LOG_WA("cpd ckpt node add - the IMM object exits %s", 
ckpt_node->ckpt_name);
+
+   if (delete_runtime_ckpt_object(ckpt_node, immOiHandle) 
!= SA_AIS_OK) {
+   LOG_ER("Deleting run time object %s FAILED", 
ckpt_node->ckpt_name);
+   return NCSCC_RC_FAILURE;
+   }
+
+   err = create_runtime_ckpt_object(ckpt_node, 
immOiHandle);
+   }
+
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
if (err == SA_AIS_ERR_INVALID_PARAM) {
diff --git a/src/ckpt/ckptd/cpd_evt.c b/src/ckpt/ckptd/cpd_evt.c
--- a/src/ckpt/ckptd/cpd_evt.c
+++ b/src/ckpt/ckptd/cpd_evt.c
@@ -310,13 +310,17 @@ static uint32_t cpd_evt_proc_ckpt_create
if (send_evt.info.cpnd.info.ckpt_info.is_active_exists)
send_evt.info.cpnd.info.ckpt_info.active_dest = 
ckpt_node->active_dest;
 
-   if (map_info->attributes.creationFlags & 
SA_CKPT_CHECKPOINT_COLLOCATED)
+   if (map_info->attributes.creationFlags & 
SA_CKPT_CHECKPOINT_COLLOCATED) {
+   TRACE("==HOANG== ckpt_rep_create = true");
send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = 
true;
-   else {
-   if (is_first_rep)
+   } else {
+   if (is_first_rep) {
+   TRACE("==HOANG== ckpt_rep_create = 
true");

send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = true;
-   else
+   } else {
+   TRACE("==HOANG== ckpt_rep_create = 
false");

send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = false;
+   }
}
 
if (ckpt_node->dest_cnt) {
diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -348,7 +348,8 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
proc_rc = 
cpd_ckpt_reploc_node_add(>ckpt_reploc_tree, reploc_info, cb->ha_state, 
cb->immOiHandle);
if (proc_rc != NCSCC_RC_SUCCESS) {
/* goto reploc_node_add_fail; */
-   TRACE_4("cpd db add failed ");
+   LOG_ER("cpd db replica add failed ");
+   goto replica_node_add_fail;
}
}
 
@@ -367,6 +368,10 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
 
+ replica_node_add_fail:
+   cpd_ckpt_node_delete(cb, ckpt_node);
+   ckpt_node = NULL;
+
  ckpt_node_add_fail:
cpd_ckpt_map_node_delete(cb, map_info);
map_info = NULL;
@@ -679,7 +684,8 @@ uint32_t cpd_process_cpnd_down(CPD_CB *c
cpd_cpnd_info_node_find_add(>cpnd_tree, cpnd_dest, _info, 
_flag);
if (!cpnd_info)
return NCSCC_RC_SUCCESS;
-
+   /* Stop timer before processing down */
+   cpd_tmr_stop(_info->cpnd_ret_timer);
cref_info = cpnd_info->ckpt_ref_list;
 
while (cref_info) {
@@ -989,6 +995,14 @@ uint32_t cpd_proc_retention_set(CPD_CB *
 
/* Update the retention Time */
(*ckpt_node)->ret_time = reten_time;
+   (*ckpt_node)->attributes.retentionDuration = reten_time;
+
+   /* Update the related patricia tree */
+   

[devel] [PATCH 0 of 1] Review Request for cpd: to correct failover behavior of cpsv [#1765] V4

2017-01-19 Thread Hoang Vo
Summary: cpd: to correct failover behavior of cpsv [#1765]
Review request for Trac Ticket(s): 1765
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

 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):
-
Rebase source code to newest folder structure
Remove unexpected trace LOC compared to V3

changeset 8d393cacd64e5e5dcc32ad6d6a456871b33a3f4c
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 19 Jan 2017 14:50:18 +0700

cpd: to correct failover behavior of cpsv [#1765]

problem: In case a failover happens while a checkpoint is being 
unlinked, it
might causes an unfinished unlink operation (i.e the checkpoint IMM 
object
is not deleted). Later on, when the checkpoint is created again, it 
will not
succeed because the CPD detects that the checkpoint IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and 
re-create new
one.
- Stop timer of removed node.
- Update data in patricia trees.


Complete diffstat:
--
 src/ckpt/ckptd/cpd_db.c |  15 +++
 src/ckpt/ckptd/cpd_evt.c|  12 
 src/ckpt/ckptd/cpd_proc.c   |  18 --
 src/ckpt/ckptnd/cpnd_evt.c  |   3 ++-
 src/ckpt/ckptnd/cpnd_proc.c |  12 +---
 5 files changed, 50 insertions(+), 10 deletions(-)


Testing Commands:
-
Create checkpoint and set retention to big value Failover by killing osafamfd 2 
times
Check checkpoint information

Testing, Expected Results:
--
Checkpoint information is not change

Conditions of Submission:
-
ACK from maintainer

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.


--
Check out the vibrant tech community on one of 

[devel] [PATCH 1 of 1] Problem:

2017-01-18 Thread Hoang Vo
 src/ckpt/ckptd/cpd_db.c   |   4 
 src/ckpt/ckptd/cpd_proc.c |  30 ++
 2 files changed, 34 insertions(+), 0 deletions(-)



The replica IMM objects are not created after opening a checkpoint in following 
scenario:

1. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE
2. Unlink the checkpoint ( the checkpoint is still being used)
3. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE with same name as the 
one in 1.

After step 3. although the checkpoint is opened successfully, the replica IMM 
objects
are not created.

The problem happens because the CPD does not delete relating nodes from 
ckpt_reploc_tree
when it unlinks the checkpoint in step 2.

Solution:
-
The solution is to remove replica location node of that checkpoint from the 
ckpt_reploc_tree
when unlinking the checkpoint.

diff --git a/src/ckpt/ckptd/cpd_db.c b/src/ckpt/ckptd/cpd_db.c
--- a/src/ckpt/ckptd/cpd_db.c
+++ b/src/ckpt/ckptd/cpd_db.c
@@ -441,6 +441,8 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
 {
uint32_t rc = NCSCC_RC_SUCCESS;
 
+   TRACE_ENTER();
+
if (cb->ha_state == SA_AMF_HA_ACTIVE) {
 
rc = cpd_ckpt_reploc_imm_object_delete(cb, ckpt_reploc_node, 
is_unlink_set);
@@ -462,6 +464,7 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
TRACE_4("cpd db node add failed ");
}
 
+   TRACE_LEAVE();
return NCSCC_RC_FAILURE;
}
 
@@ -470,6 +473,7 @@ uint32_t cpd_ckpt_reploc_node_delete(CPD
m_MMGR_FREE_CPD_CKPT_REPLOC_INFO(ckpt_reploc_node);
}
 
+   TRACE_LEAVE();
return rc;
 }
 
diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -1043,6 +1043,36 @@ uint32_t cpd_proc_unlink_set(CPD_CB *cb,
(*ckpt_node)->attributes = map_info->attributes;
/* Delete the MAP Info */
rc = cpd_ckpt_map_node_delete(cb, map_info);
+
+   /* Delete replica location of the unlinked checkpoint from the 
ckpt_reploc_tree */
+   CPD_NODE_REF_INFO *nref_info = (*ckpt_node)->node_list;
+
+   while (nref_info) {
+   SaClmNodeIdT node_id = 
m_NCS_NODE_ID_FROM_MDS_DEST(nref_info->dest);
+   SaClmClusterNodeT cluster_node;
+   CPD_REP_KEY_INFO key_info;
+   CPD_CKPT_REPLOC_INFO *reploc_info = NULL;
+
+   memset(_node, 0, sizeof(SaClmClusterNodeT));
+   memset(_info, 0, sizeof(CPD_REP_KEY_INFO));
+
+   if (saClmClusterNodeGet(cb->clm_hdl, node_id, 
CPD_CLM_API_TIMEOUT, _node) != SA_AIS_OK) {
+   LOG_ER("cpd unlink set - saClmClusterNodeGet failed for 
node_id %u",node_id);
+   rc = SA_AIS_ERR_LIBRARY;
+   break;
+   }
+
+   key_info.node_name = 
osaf_extended_name_borrow(_node.nodeName);
+   key_info.ckpt_name = ckpt_name;
+
+   cpd_ckpt_reploc_get(>ckpt_reploc_tree, _info, 
_info);
+   if (reploc_info) {
+   cpd_ckpt_reploc_node_delete(cb, reploc_info, 
(*ckpt_node)->is_unlink_set);
+   }
+
+   nref_info = nref_info->next;
+   }
+
TRACE_LEAVE();
return rc;
 }

--
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 of 1] Review Request for cpsv: Update ckpt_reploc_tree when unlinking a checkpoint [#1655

2017-01-18 Thread Hoang Vo
Summary: cpsv: Update ckpt_reploc_tree when unlinking a checkpoint [#1655]
Review request for Trac Ticket(s): 1655
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

 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):
-
Rebase patch to latest folder structure, do not change any source code inside
Patched after 1765

changeset 6ffeaa4fbf2e352bd42a4bba160c4c593efcf749
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 19 Jan 2017 13:59:09 +0700

Problem:
 The replica IMM objects are not created after opening a 
checkpoint
in following scenario:

1. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE 2. Unlink the
checkpoint ( the checkpoint is still being used) 3. Open a checkpoint 
with
flag SA_CKPT_CHECKPOINT_CREATE with same name as the one in 1.

After step 3. although the checkpoint is opened successfully, the 
replica
IMM objects are not created.

The problem happens because the CPD does not delete relating nodes from
ckpt_reploc_tree when it unlinks the checkpoint in step 2.

Solution:
- The solution is to remove replica location node of that 
checkpoint
from the ckpt_reploc_tree when unlinking the checkpoint.


Complete diffstat:
--
 src/ckpt/ckptd/cpd_db.c   |   4 
 src/ckpt/ckptd/cpd_proc.c |  30 ++
 2 files changed, 34 insertions(+), 0 deletions(-)


Testing Commands:
-
Follow testing step specified in the ticket 1655

Testing, Expected Results:
--
Refer the ticket 1655 description for expected result

Conditions of Submission:
-
ACK from maintainer

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.



[devel] [PATCH 1 of 1] cpd: to correct failover behavior of cpsv [#1765]

2017-01-18 Thread Hoang Vo
 src/ckpt/ckptd/cpd_db.c |  15 +++
 src/ckpt/ckptd/cpd_evt.c|  12 
 src/ckpt/ckptd/cpd_proc.c   |  18 --
 src/ckpt/ckptnd/cpnd_evt.c  |   3 ++-
 src/ckpt/ckptnd/cpnd_proc.c |  12 +---
 5 files changed, 50 insertions(+), 10 deletions(-)


problem:
In case a failover happens while a checkpoint is being unlinked, it might 
causes an unfinished
unlink operation (i.e the checkpoint IMM object is not deleted). Later on, when 
the checkpoint is
created again, it will not succeed because the CPD detects that the checkpoint 
IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and re-create new 
one.
- Stop timer of removed node.
- Update data in patricia trees.

diff --git a/src/ckpt/ckptd/cpd_db.c b/src/ckpt/ckptd/cpd_db.c
--- a/src/ckpt/ckptd/cpd_db.c
+++ b/src/ckpt/ckptd/cpd_db.c
@@ -104,6 +104,21 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
/*create the imm runtime object */
if (ha_state == SA_AMF_HA_ACTIVE) {
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
+
+   /* The Checkpoint IMM object exist due to unfinished previous 
opernation (e.g unlink)
+* The action is to delete the old object and create a new one 
*/
+
+   if (err == SA_AIS_ERR_EXIST) {
+   LOG_WA("cpd ckpt node add - the IMM object exits %s", 
ckpt_node->ckpt_name);
+
+   if (delete_runtime_ckpt_object(ckpt_node, immOiHandle) 
!= SA_AIS_OK) {
+   LOG_ER("Deleting run time object %s FAILED", 
ckpt_node->ckpt_name);
+   return NCSCC_RC_FAILURE;
+   }
+
+   err = create_runtime_ckpt_object(ckpt_node, 
immOiHandle);
+   }
+
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
if (err == SA_AIS_ERR_INVALID_PARAM) {
diff --git a/src/ckpt/ckptd/cpd_evt.c b/src/ckpt/ckptd/cpd_evt.c
--- a/src/ckpt/ckptd/cpd_evt.c
+++ b/src/ckpt/ckptd/cpd_evt.c
@@ -310,13 +310,17 @@ static uint32_t cpd_evt_proc_ckpt_create
if (send_evt.info.cpnd.info.ckpt_info.is_active_exists)
send_evt.info.cpnd.info.ckpt_info.active_dest = 
ckpt_node->active_dest;
 
-   if (map_info->attributes.creationFlags & 
SA_CKPT_CHECKPOINT_COLLOCATED)
+   if (map_info->attributes.creationFlags & 
SA_CKPT_CHECKPOINT_COLLOCATED) {
+   TRACE("==HOANG== ckpt_rep_create = true");
send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = 
true;
-   else {
-   if (is_first_rep)
+   } else {
+   if (is_first_rep) {
+   TRACE("==HOANG== ckpt_rep_create = 
true");

send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = true;
-   else
+   } else {
+   TRACE("==HOANG== ckpt_rep_create = 
false");

send_evt.info.cpnd.info.ckpt_info.ckpt_rep_create = false;
+   }
}
 
if (ckpt_node->dest_cnt) {
diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -348,7 +348,8 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
proc_rc = 
cpd_ckpt_reploc_node_add(>ckpt_reploc_tree, reploc_info, cb->ha_state, 
cb->immOiHandle);
if (proc_rc != NCSCC_RC_SUCCESS) {
/* goto reploc_node_add_fail; */
-   TRACE_4("cpd db add failed ");
+   LOG_ER("cpd db replica add failed ");
+   goto replica_node_add_fail;
}
}
 
@@ -367,6 +368,10 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
 
+ replica_node_add_fail:
+   cpd_ckpt_node_delete(cb, ckpt_node);
+   ckpt_node = NULL;
+
  ckpt_node_add_fail:
cpd_ckpt_map_node_delete(cb, map_info);
map_info = NULL;
@@ -679,7 +684,8 @@ uint32_t cpd_process_cpnd_down(CPD_CB *c
cpd_cpnd_info_node_find_add(>cpnd_tree, cpnd_dest, _info, 
_flag);
if (!cpnd_info)
return NCSCC_RC_SUCCESS;
-
+   /* Stop timer before processing down */
+   cpd_tmr_stop(_info->cpnd_ret_timer);
cref_info = cpnd_info->ckpt_ref_list;
 
while (cref_info) {
@@ -989,6 +995,14 @@ uint32_t cpd_proc_retention_set(CPD_CB *
 
/* Update the retention Time */
(*ckpt_node)->ret_time = reten_time;
+   (*ckpt_node)->attributes.retentionDuration = reten_time;
+
+   /* Update the related patricia tree */
+   

[devel] [PATCH 0 of 1] Review Request for cpd: to correct failover behavior of cpsv [#1765] V3

2017-01-18 Thread Hoang Vo
Summary: cpd: to correct failover behavior of cpsv [#1765]
Review request for Trac Ticket(s): 1765
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

 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):
-
Rebase source code to newest folder structure,
do not change anything compare to previous version

changeset 9c34df19e6b98ece2cfcd10be0b748d3b563e029
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 19 Jan 2017 13:52:02 +0700

cpd: to correct failover behavior of cpsv [#1765]

problem: In case a failover happens while a checkpoint is being 
unlinked, it
might causes an unfinished unlink operation (i.e the checkpoint IMM 
object
is not deleted). Later on, when the checkpoint is created again, it 
will not
succeed because the CPD detects that the checkpoint IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and 
re-create new
one.
- Stop timer of removed node.
- Update data in patricia trees.


Complete diffstat:
--
 src/ckpt/ckptd/cpd_db.c |  15 +++
 src/ckpt/ckptd/cpd_evt.c|  12 
 src/ckpt/ckptd/cpd_proc.c   |  18 --
 src/ckpt/ckptnd/cpnd_evt.c  |   3 ++-
 src/ckpt/ckptnd/cpnd_proc.c |  12 +---
 5 files changed, 50 insertions(+), 10 deletions(-)


Testing Commands:
-
Create checkpoint and set retention to big value Failover by
killing osafamfd multiple times Check checkpoint information

Testing, Expected Results:
--
Checkpoint information is not change

Conditions of Submission:
-
ACK from maintainer

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.


--
Check out the vibrant tech 

[devel] [PATCH 0 of 1] Review Request for cpsv: Update ckpt_reploc_tree when unlinking a checkpoint [#1655]

2016-12-14 Thread Hoang Vo
Summary: cpsv: Update ckpt_reploc_tree when unlinking a checkpoint [#1655]
Review request for Trac Ticket(s): #1655
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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):
-
Dear Mahesh,

I made some small changes for rebase.

Sincerely,

changeset 26729ea38e148d4631097681525567bdfab0e699
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 14 Dec 2016 15:11:20 +0700

osaf/services/saf/cpsv/cpd/cpd_db.c | 4 
osaf/services/saf/cpsv/cpd/cpd_proc.c | 30 
++ 2
files changed, 34 insertions(+), 0 deletions(-)

 Problem:
 The replica IMM objects are not created after opening a 
checkpoint
in following scenario:

1. Open a checkpoint with flag SA_CKPT_CHECKPOINT_CREATE 2. Unlink the
checkpoint ( the checkpoint is still being used) 3. Open a checkpoint 
with
flag SA_CKPT_CHECKPOINT_CREATE with same name as the one in 1.

After step 3. although the checkpoint is opened successfully, the 
replica
IMM objects are not created.

The problem happens because the CPD does not delete relating nodes from
ckpt_reploc_tree when it unlinks the checkpoint in step 2.

Solution:
- The solution is to remove replica location node of that 
checkpoint
from the ckpt_reploc_tree when unlinking the checkpoint.


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_db.c   |   4 
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  30 ++
 2 files changed, 34 insertions(+), 0 deletions(-)


Testing Commands:
-
Follow testing step specified in the ticket 1655

Testing, Expected Results:
--
Refer the ticket 1655 description for expected result.

Conditions of Submission:
-
ACK from maintainer

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 af

[devel] [PATCH 1 of 1] cpnd: fix error handling while section_hdr_update_fail [#2207]

2016-11-29 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd_sec.h |   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_db.c|   5 -
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |   8 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc  |  25 ++---
 5 files changed, 24 insertions(+), 18 deletions(-)


problem:
the steps to add a section is add_db_tree -> update_sec_hdr -> update_ckpt_hdr
so if an error occur cpsv should handle error in reverse order.
currently, section_hdr_update_fails, cpsv revert ckpt_hdr also that case error

solution:
only revert db_tree in case section_hdr_update_fails

diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h 
b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,7 +39,7 @@ CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *);
+cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *, bool);
 
 CPND_CKPT_SECTION_INFO *
 cpnd_get_sect_with_id(const CPND_CKPT_NODE *, uint32_t lcl_sec_id);
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -391,6 +391,7 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
int32_t lcl_sec_id = 0;
uint32_t rc = NCSCC_RC_SUCCESS;
uint32_t value = 0, i = 0, j = 0;
+   bool hdr_update = true;
 
TRACE_ENTER();
/* get the lcl_sec_id */
@@ -469,8 +470,10 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
return pSecPtr;
 
  section_hdr_update_fails:
+   hdr_update = false;
+
  ckpt_hdr_update_fails:
-   cpnd_ckpt_sec_del(cp_node, id);
+   cpnd_ckpt_sec_del(cp_node, id, hdr_update);
 
  section_add_fails:
if (pSecPtr->sec_id.id != NULL) 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -2357,12 +2357,12 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
/* delete the 
section */
if (gen_sec_id)

tmp_sec_info =
-   
cpnd_ckpt_sec_del(cp_node, _info->sec_id);
+   
cpnd_ckpt_sec_del(cp_node, _info->sec_id, true);
else

tmp_sec_info =

cpnd_ckpt_sec_del(cp_node,

evt->info.sec_creatReq.
-   
sec_attri.sectionId);
+   
sec_attri.sectionId, true);
 
if 
(tmp_sec_info == sec_info) {

cp_node->replica_info.
@@ -2494,7 +2494,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
rc = cpnd_ckpt_sec_find(cp_node, >info.sec_delReq.sec_id);
if (rc == NCSCC_RC_SUCCESS) {
 
-   sec_info = cpnd_ckpt_sec_del(cp_node, 
>info.sec_delReq.sec_id);
+   sec_info = cpnd_ckpt_sec_del(cp_node, 
>info.sec_delReq.sec_id, true);
/* resetting lcl_sec_id mapping */
if (sec_info == NULL) {
rc = NCSCC_RC_FAILURE;
@@ -2774,7 +2774,7 @@ static uint32_t cpnd_evt_proc_nd2nd_ckpt
send_evt.info.cpnd.info.sec_delete_rsp.error = 
SA_AIS_ERR_TRY_AGAIN;
goto nd_rsp;
}
-   sec_info = cpnd_ckpt_sec_del(cp_node, >info.sec_delete_req.sec_id);
+   sec_info = cpnd_ckpt_sec_del(cp_node, >info.sec_delete_req.sec_id, 
true);
if (sec_info == NULL) {
if 
(m_CPND_IS_COLLOCATED_ATTR_SET(cp_node->create_attrib.creationFlags)) {
TRACE_4("cpnd ckpt sect del failed for 
sec_id:%s,ckpt_id:%llx",
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -1544,7 +1544,7 @@ uint32_t cpnd_proc_sec_expiry(CPND_CB *c
return NCSCC_RC_FAILURE;
}
 
-   cpnd_ckpt_sec_del(cp_node, _info->sec_id);
+   cpnd_ckpt_sec_del(cp_node, _info->sec_id, true);

[devel] [PATCH 0 of 1] Review Request for cpnd: fix error handling while section_hdr_update_fail [#2207] V2

2016-11-29 Thread Hoang Vo
Summary: cpnd: fix error handling while section_hdr_update_fail [#2207] V2
Review request for Trac Ticket(s): #2207
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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):
-
Analyze show that the found coredump is not related to this problem so I submit 
this patch.
Coredump problem will be add in different ticket.

changeset 755a02bd67e52067829b27aabcf1aa7185a442dd
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 29 Nov 2016 15:58:48 +0700

cpnd: fix error handling while section_hdr_update_fail [#2207]

problem: the steps to add a section is add_db_tree -> update_sec_hdr ->
update_ckpt_hdr so if an error occur cpsv should handle error in reverse
order. currently, section_hdr_update_fails, cpsv revert ckpt_hdr also 
that
case error

solution: only revert db_tree in case section_hdr_update_fails


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpnd_sec.h |   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_db.c|   5 -
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |   8 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc  |  25 ++---
 5 files changed, 24 insertions(+), 18 deletions(-)


Testing Commands:
-
N/A

Testing, Expected Results:
--
N/A

Conditions of Submission:
-
ACK from maintainer

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.


--
___
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 cpnd: fix error handling while section_hdr_update_fail [#2207]

2016-11-24 Thread Hoang Vo
Summary: cpnd: fix error handling while section_hdr_update_fail [#2207]
Review request for Trac Ticket(s): 2207
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 ea62374e13496cd28a1026f64860feac3515adb9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 24 Nov 2016 16:48:59 +0700

cpnd: fix error handling while section_hdr_update_fail [#2207]

problem: the steps to add a section is add_db_tree -> update_sec_hdr ->
update_ckpt_hdr so if an error occur cpsv should handle error in reverse
order. currently, section_hdr_update_fails, cpsv revert ckpt_hdr also 
that
case error

solution: only revert db_tree in case section_hdr_update_fails


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpnd_sec.h |   3 +++
 osaf/services/saf/cpsv/cpnd/cpnd_db.c|   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc  |  31 +++
 3 files changed, 33 insertions(+), 5 deletions(-)


Testing Commands:
-
N/A

Testing, Expected Results:
--
N/A

Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpnd: fix error handling while section_hdr_update_fail [#2207]

2016-11-24 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd_sec.h |   3 +++
 osaf/services/saf/cpsv/cpnd/cpnd_db.c|   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_sec.cc  |  31 +++
 3 files changed, 33 insertions(+), 5 deletions(-)


problem:
the steps to add a section is add_db_tree -> update_sec_hdr -> update_ckpt_hdr
so if an error occur cpsv should handle error in reverse order.
currently, section_hdr_update_fails, cpsv revert ckpt_hdr also that case error

solution:
only revert db_tree in case section_hdr_update_fails

diff --git a/osaf/libs/common/cpsv/include/cpnd_sec.h 
b/osaf/libs/common/cpsv/include/cpnd_sec.h
--- a/osaf/libs/common/cpsv/include/cpnd_sec.h
+++ b/osaf/libs/common/cpsv/include/cpnd_sec.h
@@ -39,6 +39,9 @@ CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_get_create(const CPND_CKPT_NODE *, const SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
+cpnd_ckpt_sec_del_db(CPND_CKPT_NODE *, SaCkptSectionIdT *);
+
+CPND_CKPT_SECTION_INFO *
 cpnd_ckpt_sec_del(CPND_CKPT_NODE *, SaCkptSectionIdT *);
 
 CPND_CKPT_SECTION_INFO *
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -468,10 +468,12 @@ CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_ad
TRACE_LEAVE();
return pSecPtr;
 
- section_hdr_update_fails:
  ckpt_hdr_update_fails:
cpnd_ckpt_sec_del(cp_node, id);
 
+ section_hdr_update_fails:
+   cpnd_ckpt_sec_del_db(cp_node, id);
+
  section_add_fails:
if (pSecPtr->sec_id.id != NULL) 
m_MMGR_FREE_CPND_DEFAULT(pSecPtr->sec_id.id);
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc 
b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
--- a/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_sec.cc
@@ -157,19 +157,19 @@ cpnd_ckpt_sec_find(const CPND_CKPT_NODE 
 }
 
 /
- * Name  : cpnd_ckpt_sec_del
+ * Name  : cpnd_ckpt_sec_del_db
  *
- * Description   : Function to remove the section from a checkpoint.
+ * Description   : Function to remove the section from a checkpoint map db.
  *
  * Arguments : CPND_CKPT_NODE *cp_node - Check point node.
  *   : SaCkptSectionIdT id - Section Identifier
- * 
+ *
  * Return Values :  ptr to CPND_CKPT_SECTION_INFO/NULL;
  *
  * Notes : None.
  */
 CPND_CKPT_SECTION_INFO *
-cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
+cpnd_ckpt_sec_del_db(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
 {
   CPND_CKPT_SECTION_INFO *sectionInfo(0);
 
@@ -206,6 +206,29 @@ cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_nod
 osafassert(false);
   }
 
+  TRACE_LEAVE();
+
+  return sectionInfo;
+}
+
+/
+ * Name  : cpnd_ckpt_sec_del
+ *
+ * Description   : Function to remove the section from a checkpoint.
+ *
+ * Arguments : CPND_CKPT_NODE *cp_node - Check point node.
+ *   : SaCkptSectionIdT id - Section Identifier
+ *
+ * Return Values :  ptr to CPND_CKPT_SECTION_INFO/NULL;
+ *
+ * Notes : None.
+ */
+CPND_CKPT_SECTION_INFO *
+cpnd_ckpt_sec_del(CPND_CKPT_NODE *cp_node, SaCkptSectionIdT *id)
+{
+  TRACE_ENTER();
+  CPND_CKPT_SECTION_INFO *sectionInfo = cpnd_ckpt_sec_del_db(cp_node, id);
+
   if (sectionInfo) {
 cp_node->replica_info.n_secs--;
 cp_node->replica_info.mem_used = cp_node->replica_info.mem_used - 
(sectionInfo->sec_size);

--
___
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 cpnd: ensure shared memory size before writing [#2202]

2016-11-23 Thread Hoang Vo
Summary: cpnd: ensure shared memory size before writing [#2202]
Review request for Trac Ticket(s): 2202
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 76516d1c454a9e6b5397f79e2253947370c0815b
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 23 Nov 2016 16:32:06 +0700

cpnd: ensure shared memory size before writing [#2202]

problem: when checkpoint service init without shared memory size 
guaranteed
works in high memory load, core dump occur while adding section to
checkpoint.

solution: check the true size of shared memory before writing to it.


Complete diffstat:
--
 osaf/libs/core/include/ncs_osprm.h  |   9 +
 osaf/libs/core/leap/os_defs.c   |  19 +--
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c |  16 
 3 files changed, 42 insertions(+), 2 deletions(-)


Testing Commands:
-
In high memory load, create a checkpoint and create sections

Testing, Expected Results:
--
Checkpoint and sections are created successfully

Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpnd: ensure shared memory size before writing [#2202]

2016-11-23 Thread Hoang Vo
 osaf/libs/core/include/ncs_osprm.h  |   9 +
 osaf/libs/core/leap/os_defs.c   |  19 +--
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c |  16 
 3 files changed, 42 insertions(+), 2 deletions(-)


problem: when checkpoint service init without shared memory size guaranteed
works in high memory load, core dump occur while adding section to checkpoint.

solution:  check the true size of shared memory before writing to it.

diff --git a/osaf/libs/core/include/ncs_osprm.h 
b/osaf/libs/core/include/ncs_osprm.h
--- a/osaf/libs/core/include/ncs_osprm.h
+++ b/osaf/libs/core/include/ncs_osprm.h
@@ -557,6 +557,7 @@ typedef enum {
   NCS_OS_POSIX_SHM_REQ_UNLINK,/* unlink is shm_unlink */
   NCS_OS_POSIX_SHM_REQ_READ,
   NCS_OS_POSIX_SHM_REQ_WRITE,
+  NCS_OS_POSIX_SHM_REQ_STATS,
   NCS_OS_POSIX_SHM_REQ_MAX
 } NCS_OS_POSIX_SHM_REQ_TYPE;
 typedef struct ncs_os_posix_shm_req_open_info_tag {
@@ -598,6 +599,13 @@ typedef struct ncs_os_posix_shm_req_writ
   uint64_t i_offset;
 } NCS_OS_POSIX_SHM_REQ_WRITE_INFO;
 
+typedef struct ncs_os_posix_shm_req_stats_info_tag {
+  uint32_t i_hdl;
+  int32_t i_fd;
+  bool ensures_space;
+  void *o_addr;
+} NCS_OS_POSIX_SHM_REQ_STATS_INFO;
+
 typedef struct ncs_shm_req_info {
   NCS_OS_POSIX_SHM_REQ_TYPE type;
 
@@ -607,6 +615,7 @@ typedef struct ncs_shm_req_info {
 NCS_OS_POSIX_SHM_REQ_UNLINK_INFO unlink;
 NCS_OS_POSIX_SHM_REQ_READ_INFO read;
 NCS_OS_POSIX_SHM_REQ_WRITE_INFO write;
+NCS_OS_POSIX_SHM_REQ_STATS_INFO stats;
   } info;
 
 } NCS_OS_POSIX_SHM_REQ_INFO;
diff --git a/osaf/libs/core/leap/os_defs.c b/osaf/libs/core/leap/os_defs.c
--- a/osaf/libs/core/leap/os_defs.c
+++ b/osaf/libs/core/leap/os_defs.c
@@ -799,9 +799,9 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S
}
} else {
if (ftruncate(req->info.open.o_fd, (off_t) 
shm_size /* off_t == long */ ) < 0) {
-   printf("ftruncate failed with errno 
value %d \n", errno);
+   LOG_WA("ftruncate failed with errno 
value %d \n", errno);
return NCSCC_RC_FAILURE;
-}
+}
}
 
uint32_t prot_flag = 
ncs_shm_prot_flags(req->info.open.i_flags);
@@ -859,6 +859,21 @@ uint32_t ncs_os_posix_shm(NCS_OS_POSIX_S
   req->info.write.i_write_size);
break;
 
+   case NCS_OS_POSIX_SHM_REQ_STATS:
+   if (!req->info.stats.o_addr) {
+   printf("Output space is not defined\n");
+   return NCSCC_RC_FAILURE;
+   }
+
+   if (req->info.stats.ensures_space) {
+   return NCSCC_RC_SUCCESS;
+   } else {
+   if(fstat(req->info.stats.i_fd, req->info.stats.o_addr)) 
{
+   return NCSCC_RC_FAILURE;
+   }
+   }
+   break;
+
default:
printf("Option Not supported %d \n", req->type);
return NCSCC_RC_FAILURE;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -1851,6 +1851,22 @@ uint32_t cpnd_sec_hdr_update(CPND_CKPT_S
CPSV_SECT_HDR sec_hdr;
uint32_t rc = NCSCC_RC_SUCCESS;
NCS_OS_POSIX_SHM_REQ_INFO write_req;
+   struct stat shm_stat;
+   memset(_req, '\0', sizeof(write_req));
+   memset(_stat, '\0', sizeof(shm_stat));
+   write_req.type = NCS_OS_POSIX_SHM_REQ_STATS;
+   write_req.info.stats.i_fd = cp_node->replica_info.open.info.open.o_fd;
+   write_req.info.stats.ensures_space = false;
+   write_req.info.stats.o_addr = _stat;
+   shm_stat.st_size = sizeof(CPSV_CKPT_HDR) + (sec_info->lcl_sec_id + 1) * 
(sizeof(CPSV_SECT_HDR) + cp_node->create_attrib.maxSectionSize);
+   rc = ncs_os_posix_shm(_req);
+   if (rc != NCSCC_RC_SUCCESS) {
+   return rc;
+   }
+
+   if (shm_stat.st_size < sizeof(CPSV_CKPT_HDR) + (sec_info->lcl_sec_id + 
1) * (sizeof(CPSV_SECT_HDR) + cp_node->create_attrib.maxSectionSize)) {
+   return NCSCC_RC_OUT_OF_MEM;
+   }
memset(_req, '\0', sizeof(write_req));
memset(_hdr, '\0', sizeof(CPSV_SECT_HDR));
sec_hdr.lcl_sec_id = sec_info->lcl_sec_id;

--
___
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 fix crash problem in cpd while rolling update got error [#2187]

2016-11-16 Thread Hoang Vo
Summary: cpd check null pointer before use [#2187]
Review request for Trac Ticket(s): #2187
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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):
-
V2: fix for loop following maintainer's comments, tested with all existing test 
cases

changeset 64fa8a63c6b21f0ea8ca09f1408ad3045f21c5c9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 17 Nov 2016 08:58:50 +0700

fix crash problem by checking null pointer before accessing its detail 
V2


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_red.c |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] fix crash problem by checking null pointer before accessing its detail V2

2016-11-16 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_red.c |  11 +++
 1 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/osaf/services/saf/cpsv/cpd/cpd_red.c 
b/osaf/services/saf/cpsv/cpd/cpd_red.c
--- a/osaf/services/saf/cpsv/cpd/cpd_red.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_red.c
@@ -301,7 +301,6 @@ void cpd_a2s_ckpt_dest_del(CPD_CB *cb, S
 void cpd_a2s_ckpt_usr_info(CPD_CB *cb, CPD_CKPT_INFO_NODE *ckpt_node)
 {
CPD_MBCSV_MSG cpd_msg;
-   int count = 0;
uint32_t rc = SA_AIS_OK;
memset(_msg, '\0', sizeof(CPD_MBCSV_MSG));
 
@@ -316,18 +315,22 @@ void cpd_a2s_ckpt_usr_info(CPD_CB *cb, C
cpd_msg.info.usr_info_2.ckpt_on_scxb2 = ckpt_node->ckpt_on_scxb2;
 
if (ckpt_node->node_users_cnt) {
+   int count = 0;
CPD_NODE_USER_INFO *node_user = ckpt_node->node_users;
-   cpd_msg.info.usr_info_2.node_users_cnt = 
ckpt_node->node_users_cnt;
cpd_msg.info.usr_info_2.node_list = 
malloc(ckpt_node->node_users_cnt * sizeof(CPD_NODE_USER_INFO));
memset(cpd_msg.info.usr_info_2.node_list, '\0', 
(sizeof(CPD_NODE_USER_INFO) * ckpt_node->node_users_cnt));
 
-   for (count = 0; count < ckpt_node->node_users_cnt; count++) {
+   for (; node_user != NULL && count < ckpt_node->node_users_cnt; 
node_user = node_user->next) {
cpd_msg.info.usr_info_2.node_list[count].dest = 
node_user->dest;
cpd_msg.info.usr_info_2.node_list[count].num_users = 
node_user->num_users;
cpd_msg.info.usr_info_2.node_list[count].num_readers = 
node_user->num_readers;
cpd_msg.info.usr_info_2.node_list[count].num_writers = 
node_user->num_writers;
-   node_user = node_user->next;
+   ++count;
}
+
+   /* Update node_users_cnt in case of mismatch */
+   ckpt_node->node_users_cnt = count;
+   cpd_msg.info.usr_info_2.node_users_cnt = count;
}
 
rc = cpd_mbcsv_async_update(cb, _msg);

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] fix crash problem by checking null pointer before accessing its detail

2016-11-14 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_red.c |  5 +
 1 files changed, 5 insertions(+), 0 deletions(-)


diff --git a/osaf/services/saf/cpsv/cpd/cpd_red.c 
b/osaf/services/saf/cpsv/cpd/cpd_red.c
--- a/osaf/services/saf/cpsv/cpd/cpd_red.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_red.c
@@ -322,6 +322,11 @@ void cpd_a2s_ckpt_usr_info(CPD_CB *cb, C
memset(cpd_msg.info.usr_info_2.node_list, '\0', 
(sizeof(CPD_NODE_USER_INFO) * ckpt_node->node_users_cnt));
 
for (count = 0; count < ckpt_node->node_users_cnt; count++) {
+   if (node_user == NULL) {
+   ckpt_node->node_users_cnt = count;
+   cpd_msg.info.usr_info_2.node_users_cnt = count;
+   break;
+   }
cpd_msg.info.usr_info_2.node_list[count].dest = 
node_user->dest;
cpd_msg.info.usr_info_2.node_list[count].num_users = 
node_user->num_users;
cpd_msg.info.usr_info_2.node_list[count].num_readers = 
node_user->num_readers;

--
___
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 fix crash problem in cpd while rolling update got error [#2187]

2016-11-14 Thread Hoang Vo
Summary: cpd check null pointer before use [#2187]
Review request for Trac Ticket(s): #2187
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 e4510824f22cf37445bbd1f4a6d6972bda15de5a
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 15 Nov 2016 11:15:11 +0700

fix crash problem by checking null pointer before accessing its detail


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_red.c |  5 +
 1 files changed, 5 insertions(+), 0 deletions(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpnd: use shared memory based on ckpt name length [#2108] V2

2016-10-26 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpsv_shm.h |   28 +-
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  868 --
 2 files changed, 355 insertions(+), 541 deletions(-)


problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent on all 
nodes
CKPT_INFO size inscrease when support longDN lead to total size increase.

solution:
- From start, cpnd use old format shm.
- Run time cpnd keep using old format shm until first longDN checkpoint is 
created.
After that cpnd create extended format shm for longDN use.
- Fix init size for shm.

diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -27,7 +27,9 @@
 #define SHM_NEXT -3
 #define SHM_INIT -1
 
-#define CPSV_CPND_SHM_VERSION1
+#define CPSV_CPND_SHM_VERSION  1
+#define CPSV_CPND_SHM_VERSION_DEPRECATE2
+#define CPSV_CPND_SHM_VERSION_EXTENDED 3
 
 typedef struct cpsv_ckpt_hdr {
SaCkptCheckpointHandleT ckpt_id;/* Index for identifying the 
checkpoint */
@@ -57,7 +59,7 @@ typedef struct cpsv_sect_hdr {
 } CPSV_SECT_HDR;
 
 typedef struct ckpt_info {
-   char ckpt_name[kOsafMaxDnLength];
+   SaNameT ckpt_name;
SaCkptCheckpointHandleT ckpt_id;
uint32_t maxSections;
SaSizeT maxSecSize;
@@ -74,23 +76,10 @@ typedef struct ckpt_info {
int32_t next;
 } CKPT_INFO;
 
-typedef struct ckpt_info_v0 {
-   SaNameT ckpt_name;
-   SaCkptCheckpointHandleT ckpt_id;
-   uint32_t maxSections;
-   SaSizeT maxSecSize;
-   NODE_ID node_id;
-   int32_t offset;
-   uint32_t client_bitmap;
-   int32_t is_valid;
-   uint32_t bm_offset;
-   bool is_unlink;
-   bool is_close;
-   bool cpnd_rep_create;
-   bool is_first;
-   SaTimeT close_time;
-   int32_t next;
-} CKPT_INFO_V0;
+typedef struct ckpt_extend_info {
+   char ckpt_name[kOsafMaxDnLength + 1];
+   uint32_t is_valid;
+} CKPT_EXTENDED_INFO;
 
 typedef struct client_info {
SaCkptHandleT ckpt_app_hdl;
@@ -109,6 +98,7 @@ typedef struct gbl_shm_ptr {
void *base_addr;
void *cli_addr;
void *ckpt_addr;
+   void *extended_addr;/* Added in CPSV_CPND_SHM_VERSION_EXTENDED */
int32_t n_clients;
int32_t n_ckpts;
 } GBL_SHM_PTR;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -40,8 +40,6 @@
 
 #define m_CPND_CKPTINFO_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO))
 
-#define m_CPND_CKPTINFO_V0_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO_V0))
-
 #define m_CPND_CKPTINFO_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO))
 
 #define m_CPND_CKPTHDR_UPDATE(ckpt_hdr,offset)  
memcpy(offset,_hdr,sizeof(CKPT_HDR))
@@ -50,13 +48,11 @@ static uint32_t cpnd_res_ckpt_sec_add(CP
 static bool cpnd_find_exact_ckptinfo(CPND_CB *cb, CKPT_INFO *ckpt_info, 
uint32_t bitmap_offset,
 uint32_t *offset, uint32_t 
*prev_offset);
 static void cpnd_clear_ckpt_info(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
uint32_t curr_offset, uint32_t prev_offset);
-static uint32_t cpnd_restore_client_info(CPND_CB *cb, uint8_t *cli_addr);
-static uint32_t cpnd_restore_ckpt_info_v1(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
-static uint32_t cpnd_restore_ckpt_info_v0(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
-static void cpnd_destroy_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_OPEN_INFO 
*open_req);
-static void *cpnd_create_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_INFO *req_info);
-static void cpnd_update_shm_cpnd_cp_info(CPND_CB *cb);
-static void cpnd_convert_cp_info_v0(CKPT_INFO_V0 *cp_info_v0, CKPT_INFO 
*cp_info);
+static void cpnd_destroy_shm(NCS_OS_POSIX_SHM_REQ_OPEN_INFO *open_req);
+static uint32_t cpnd_shm_extended_open(CPND_CB *cb, uint32_t flag);
+static uint32_t cpnd_extended_name_lend(SaConstStringT value, SaNameT* name);
+static SaConstStringT cpnd_extended_name_borrow(const SaNameT* name);
+static void cpnd_extended_name_free(const SaNameT* name);
 
 
/***
 *
  * Name   : cpnd_client_extract_bits
@@ -324,10 +320,24 @@ void cpnd_restart_update_timer(CPND_CB *
 
 void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, 
CPND_CB *cb, SaClmNodeIdT nodeid)
 {
-   uint32_t rc = NCSCC_RC_SUCCESS;
+   uint32_t counter = 0, count, num_bitset = 0, n_clients, rc = 
NCSCC_RC_SUCCESS, bit_position;
+   uint64_t i_offset;
+   int32_t next_offset;
+   CPND_CKPT_CLIENT_NODE *cl_node = NULL;
+   CPND_CKPT_NODE *cp_node = NULL;
+   CLIENT_INFO cl_info;
+   CLIENT_HDR cli_hdr;
+   CKPT_INFO cp_info, tmp_cp_info;
+   

[devel] [PATCH 0 of 1] Review Request for cpnd: use shared memory based on ckpt name length [#2108] V2

2016-10-26 Thread Hoang Vo
Summary: cpnd: use shared memory based on ckpt name length [#2108] V2
Review request for Trac Ticket(s): #2108
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 dbf22bb0cf646cff8ae79dbed2dcb2df64729987
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 26 Oct 2016 15:58:58 +0700

cpnd: use shared memory based on ckpt name length [#2108] V2

problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent 
on all
nodes CKPT_INFO size inscrease when support longDN lead to total size
increase.

solution:
- From start, cpnd use old format shm.
- Run time cpnd keep using old format shm until first longDN checkpoint 
is
created. After that cpnd create extended format shm for longDN use.
- Fix init size for shm.


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpsv_shm.h |   28 +---
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  868 
+++
 2 files changed, 355 insertions(+), 541 deletions(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-


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.


--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists

[devel] [PATCH 0 of 1] Review Request for cpnd: use shared memory based on ckpt name length [#2108] V2

2016-10-20 Thread Hoang Vo
Summary: cpnd: use shared memory based on ckpt name length [#2108] V2
Review request for Trac Ticket(s): #2108
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 29132508b0e9e52b1ceb20742ea2482a48863e36
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Fri, 21 Oct 2016 09:36:28 +0700

cpnd: use shared memory based on ckpt name length [#2108] V2

problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent 
on all
nodes CKPT_INFO size inscrease when support longDN lead to total size
increase.

solution:
- From start, cpnd use old format shm.
- Run time cpnd keep using old format shm until first longDN checkpoint 
is
created. After that cpnd create extended format shm for longDN use.
- Fix init size for shm.


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpsv_shm.h |   28 +---
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  859 
+--
 2 files changed, 336 insertions(+), 551 deletions(-)


Testing Commands:
-
Run osaftest on cpsv
Create longDN checkpoins in SC and PL

Testing, Expected Results:
--
All test cases passed

Conditions of Submission:
-
ACK from maintainer

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.


--
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/

[devel] [PATCH 1 of 1] cpnd: use shared memory based on ckpt name length [#2108] V2

2016-10-20 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpsv_shm.h |   28 +-
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  859 +++---
 2 files changed, 336 insertions(+), 551 deletions(-)


problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent on all 
nodes
CKPT_INFO size inscrease when support longDN lead to total size increase.

solution:
- From start, cpnd use old format shm.
- Run time cpnd keep using old format shm until first longDN checkpoint is 
created.
After that cpnd create extended format shm for longDN use.
- Fix init size for shm.

diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -27,7 +27,9 @@
 #define SHM_NEXT -3
 #define SHM_INIT -1
 
-#define CPSV_CPND_SHM_VERSION1
+#define CPSV_CPND_SHM_VERSION  1
+#define CPSV_CPND_SHM_VERSION_DEPRECATE2
+#define CPSV_CPND_SHM_VERSION_EXTENDED 3
 
 typedef struct cpsv_ckpt_hdr {
SaCkptCheckpointHandleT ckpt_id;/* Index for identifying the 
checkpoint */
@@ -57,7 +59,7 @@ typedef struct cpsv_sect_hdr {
 } CPSV_SECT_HDR;
 
 typedef struct ckpt_info {
-   char ckpt_name[kOsafMaxDnLength];
+   SaNameT ckpt_name;
SaCkptCheckpointHandleT ckpt_id;
uint32_t maxSections;
SaSizeT maxSecSize;
@@ -74,23 +76,10 @@ typedef struct ckpt_info {
int32_t next;
 } CKPT_INFO;
 
-typedef struct ckpt_info_v0 {
-   SaNameT ckpt_name;
-   SaCkptCheckpointHandleT ckpt_id;
-   uint32_t maxSections;
-   SaSizeT maxSecSize;
-   NODE_ID node_id;
-   int32_t offset;
-   uint32_t client_bitmap;
-   int32_t is_valid;
-   uint32_t bm_offset;
-   bool is_unlink;
-   bool is_close;
-   bool cpnd_rep_create;
-   bool is_first;
-   SaTimeT close_time;
-   int32_t next;
-} CKPT_INFO_V0;
+typedef struct ckpt_extend_info {
+   char ckpt_name[kOsafMaxDnLength + 1];
+   uint32_t is_valid;
+} CKPT_EXTENDED_INFO;
 
 typedef struct client_info {
SaCkptHandleT ckpt_app_hdl;
@@ -109,6 +98,7 @@ typedef struct gbl_shm_ptr {
void *base_addr;
void *cli_addr;
void *ckpt_addr;
+   void *extended_addr;/* Added in CPSV_CPND_SHM_VERSION_EXTENDED */
int32_t n_clients;
int32_t n_ckpts;
 } GBL_SHM_PTR;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -40,8 +40,6 @@
 
 #define m_CPND_CKPTINFO_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO))
 
-#define m_CPND_CKPTINFO_V0_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO_V0))
-
 #define m_CPND_CKPTINFO_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO))
 
 #define m_CPND_CKPTHDR_UPDATE(ckpt_hdr,offset)  
memcpy(offset,_hdr,sizeof(CKPT_HDR))
@@ -50,13 +48,10 @@ static uint32_t cpnd_res_ckpt_sec_add(CP
 static bool cpnd_find_exact_ckptinfo(CPND_CB *cb, CKPT_INFO *ckpt_info, 
uint32_t bitmap_offset,
 uint32_t *offset, uint32_t 
*prev_offset);
 static void cpnd_clear_ckpt_info(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
uint32_t curr_offset, uint32_t prev_offset);
-static uint32_t cpnd_restore_client_info(CPND_CB *cb, uint8_t *cli_addr);
-static uint32_t cpnd_restore_ckpt_info_v1(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
-static uint32_t cpnd_restore_ckpt_info_v0(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
-static void cpnd_destroy_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_OPEN_INFO 
*open_req);
-static void *cpnd_create_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_INFO *req_info);
-static void cpnd_update_shm_cpnd_cp_info(CPND_CB *cb);
-static void cpnd_convert_cp_info_v0(CKPT_INFO_V0 *cp_info_v0, CKPT_INFO 
*cp_info);
+static void cpnd_destroy_shm(NCS_OS_POSIX_SHM_REQ_OPEN_INFO *open_req);
+static uint32_t cpnd_shm_extended_open(CPND_CB *cb, uint32_t flag);
+static uint32_t cpnd_extended_name_lend(SaConstStringT value, SaNameT* name);
+static void cpnd_extended_name_free(const SaNameT* name);
 
 
/***
 *
  * Name   : cpnd_client_extract_bits
@@ -324,10 +319,24 @@ void cpnd_restart_update_timer(CPND_CB *
 
 void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, 
CPND_CB *cb, SaClmNodeIdT nodeid)
 {
-   uint32_t rc = NCSCC_RC_SUCCESS;
+   uint32_t counter = 0, count, num_bitset = 0, n_clients, rc = 
NCSCC_RC_SUCCESS, bit_position;
+   uint64_t i_offset;
+   int32_t next_offset;
+   CPND_CKPT_CLIENT_NODE *cl_node = NULL;
+   CPND_CKPT_NODE *cp_node = NULL;
+   CLIENT_INFO cl_info;
+   CLIENT_HDR cli_hdr;
+   CKPT_INFO cp_info, tmp_cp_info;
+   SaCkptHandleT client_hdl;
char *buf = NULL, *buffer = NULL;

[devel] [PATCH 0 of 1] Review Request for cpd: to correct failover behavior of cpsv [#1765] V2

2016-10-13 Thread Hoang Vo
Summary: cpd: to correct failover behavior of cpsv [#1765]
Review request for Trac Ticket(s): 1765
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 4bf73f541377092c8efd79dc452ebba5db683bb9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 13 Oct 2016 15:26:46 +0700

cpd: to correct failover behavior of cpsv [#1765]

problem: In case a failover happens while a checkpoint is being 
unlinked, it
might causes an unfinished unlink operation (i.e the checkpoint IMM 
object
is not deleted). Later on, when the checkpoint is created again, it 
will not
succeed because the CPD detects that the checkpoint IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and 
re-create new
one.
- Stop timer of removed node.
- Update data in patricia trees.


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_db.c   |  15 +++
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  18 --
 2 files changed, 31 insertions(+), 2 deletions(-)


Testing Commands:
-
Create checkpoint and set retention to big value
Failover by killing osafamfd multiple times
Check checkpoint information

Testing, Expected Results:
--
Checkpoint information is not change

Conditions of Submission:
-
ACK from maintainer

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.


--
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

[devel] [PATCH 1 of 1] cpd: to correct failover behavior of cpsv [#1765]

2016-10-13 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_db.c   |  15 +++
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  18 --
 2 files changed, 31 insertions(+), 2 deletions(-)


problem:
In case a failover happens while a checkpoint is being unlinked, it might 
causes an unfinished
unlink operation (i.e the checkpoint IMM object is not deleted). Later on, when 
the checkpoint is
created again, it will not succeed because the CPD detects that the checkpoint 
IMM object existing.

Fix:
- When error occur delete the existing checkpoint IMM object and re-create new 
one.
- Stop timer of removed node.
- Update data in patricia trees.

diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -104,6 +104,21 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
/*create the imm runtime object */
if (ha_state == SA_AMF_HA_ACTIVE) {
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
+
+   /* The Checkpoint IMM object exist due to unfinished previous 
opernation (e.g unlink)
+* The action is to delete the old object and create a new one 
*/
+
+   if (err == SA_AIS_ERR_EXIST) {
+   LOG_WA("cpd ckpt node add - the IMM object exits %s", 
ckpt_node->ckpt_name);
+
+   if (delete_runtime_ckpt_object(ckpt_node, immOiHandle) 
!= SA_AIS_OK) {
+   LOG_ER("Deleting run time object %s FAILED", 
ckpt_node->ckpt_name);
+   return NCSCC_RC_FAILURE;
+   }
+
+   err = create_runtime_ckpt_object(ckpt_node, 
immOiHandle);
+   }
+
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
if (err == SA_AIS_ERR_INVALID_PARAM) {
diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
b/osaf/services/saf/cpsv/cpd/cpd_proc.c
--- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
@@ -348,7 +348,8 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
proc_rc = 
cpd_ckpt_reploc_node_add(>ckpt_reploc_tree, reploc_info, cb->ha_state, 
cb->immOiHandle);
if (proc_rc != NCSCC_RC_SUCCESS) {
/* goto reploc_node_add_fail; */
-   TRACE_4("cpd db add failed ");
+   LOG_ER("cpd db replica add failed ");
+   goto replica_node_add_fail;
}
}
 
@@ -367,6 +368,10 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
TRACE_LEAVE();
return NCSCC_RC_SUCCESS;
 
+ replica_node_add_fail:
+   cpd_ckpt_node_delete(cb, ckpt_node);
+   ckpt_node = NULL;
+
  ckpt_node_add_fail:
cpd_ckpt_map_node_delete(cb, map_info);
map_info = NULL;
@@ -679,7 +684,8 @@ uint32_t cpd_process_cpnd_down(CPD_CB *c
cpd_cpnd_info_node_find_add(>cpnd_tree, cpnd_dest, _info, 
_flag);
if (!cpnd_info)
return NCSCC_RC_SUCCESS;
-
+   /* Stop timer before processing down */
+   cpd_tmr_stop(_info->cpnd_ret_timer);
cref_info = cpnd_info->ckpt_ref_list;
 
while (cref_info) {
@@ -984,6 +990,14 @@ uint32_t cpd_proc_retention_set(CPD_CB *
 
/* Update the retention Time */
(*ckpt_node)->ret_time = reten_time;
+   (*ckpt_node)->attributes.retentionDuration = reten_time;
+
+   /* Update the related patricia tree */
+   CPD_CKPT_MAP_INFO *map_info = NULL;
+   cpd_ckpt_map_node_get(>ckpt_map_tree, (*ckpt_node)->ckpt_name, 
_info);
+   if (map_info) {
+   map_info->attributes.retentionDuration = reten_time;
+   }
return rc;
 }
 

--
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 of 1] Review Request for cpnd: use shared memory based on ckpt name length [#2108]

2016-10-11 Thread Hoang Vo
Summary: cpnd: use shared memory based on ckpt name length [#2108]
Review request for Trac Ticket(s): 2108
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 529a7b18aea989e8bee4363911b09fe324ac3f42
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 11 Oct 2016 14:25:22 +0700

cpnd: use shared memory based on ckpt name length [#2108]

problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent 
on all
nodes CKPT_INFO size inscrease when support longDN lead to total size
increase.

solution:
- From start, cpnd use small format shm.
- Run time cpnd keep using small format shm until first longDN 
checkpoint is
created. After that cpnd use big format shm.


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpsv_shm.h |9 +-
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  565 
++-
 2 files changed, 536 insertions(+), 38 deletions(-)


Testing Commands:
-
- Run all osaftest test cases
- Create longDN and shortDN checkpoint sequently

Testing, Expected Results:
--
- All test cases passed

Conditions of Submission:
-
ACK from maintainer

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.


--
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 of 1] cpnd: use shared memory based on ckpt name length [#2108]

2016-10-11 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpsv_shm.h |9 +-
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  565 --
 2 files changed, 536 insertions(+), 38 deletions(-)


problem: In the case of CKPT osafckptnd increased 3,5Mb - 240 percent on all 
nodes
CKPT_INFO size inscrease when support longDN lead to total size increase.

solution:
- From start, cpnd use small format shm.
- Run time cpnd keep using small format shm until first longDN checkpoint is 
created.
After that cpnd use big format shm.

diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -27,7 +27,8 @@
 #define SHM_NEXT -3
 #define SHM_INIT -1
 
-#define CPSV_CPND_SHM_VERSION1
+#define CPSV_CPND_SHM_VERSION_SHORT_DN 0
+#define CPSV_CPND_SHM_VERSION_LONG_DN  1
 
 typedef struct cpsv_ckpt_hdr {
SaCkptCheckpointHandleT ckpt_id;/* Index for identifying the 
checkpoint */
@@ -134,4 +135,10 @@ typedef enum cpnd_type_info {
CPND_CKPT_INFO
 } CPND_TYPE_INFO;
 
+#define cpsv_cpnd_shm_size(x) x == CPSV_CPND_SHM_VERSION_LONG_DN ? \
+   sizeof(CLIENT_HDR) + (MAX_CLIENTS * sizeof(CLIENT_INFO)) +  
\
+   sizeof(CKPT_HDR) + (MAX_CKPTS * sizeof(CKPT_INFO)) :
\
+   sizeof(CLIENT_HDR) + (MAX_CLIENTS * sizeof(CLIENT_INFO)) +  
\
+   sizeof(CKPT_HDR) + (MAX_CKPTS * sizeof(CKPT_INFO_V0))   
\
+
 #endif
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -44,20 +44,34 @@
 
 #define m_CPND_CKPTINFO_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO))
 
+#define m_CPND_CKPTINFO_V0_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO_V0))
+
 #define m_CPND_CKPTHDR_UPDATE(ckpt_hdr,offset)  
memcpy(offset,_hdr,sizeof(CKPT_HDR))
 
+void *cpnd_restart_shm(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, CPND_CB *cb, 
SaClmNodeIdT nodeid);
+uint32_t cpnd_update_ckpt_with_clienthdl_v1(CPND_CB *cb, CPND_CKPT_NODE 
*cp_node, SaCkptHandleT client_hdl);
+uint32_t cpnd_update_ckpt_with_clienthdl_v0(CPND_CB *cb, CPND_CKPT_NODE 
*cp_node, SaCkptHandleT client_hdl);
+uint32_t cpnd_write_ckpt_info_v1(CPND_CB *cb, CPND_CKPT_NODE *cp_node, int32_t 
offset, SaCkptHandleT client_hdl);
+uint32_t cpnd_write_ckpt_info_v0(CPND_CB *cb, CPND_CKPT_NODE *cp_node, int32_t 
offset, SaCkptHandleT client_hdl);
+
 static uint32_t cpnd_res_ckpt_sec_add(CPND_CKPT_SECTION_INFO *pSecPtr, 
CPND_CKPT_NODE *cp_node);
 static bool cpnd_find_exact_ckptinfo(CPND_CB *cb, CKPT_INFO *ckpt_info, 
uint32_t bitmap_offset,
 uint32_t *offset, uint32_t 
*prev_offset);
+static bool cpnd_find_exact_ckptinfo_v0(CPND_CB *cb, CKPT_INFO_V0 *ckpt_info, 
uint32_t bitmap_offset,
+uint32_t *offset, uint32_t 
*prev_offset);
 static void cpnd_clear_ckpt_info(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
uint32_t curr_offset, uint32_t prev_offset);
 static uint32_t cpnd_restore_client_info(CPND_CB *cb, uint8_t *cli_addr);
 static uint32_t cpnd_restore_ckpt_info_v1(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
 static uint32_t cpnd_restore_ckpt_info_v0(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
+static void cpnd_restart_client_reset_v1(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
CPND_CKPT_CLIENT_NODE *cl_node);
+static void cpnd_restart_client_reset_v0(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
CPND_CKPT_CLIENT_NODE *cl_node);
 static void cpnd_destroy_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_OPEN_INFO 
*open_req);
 static void *cpnd_create_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_INFO *req_info);
 static void cpnd_update_shm_cpnd_cp_info(CPND_CB *cb);
 static void cpnd_convert_cp_info_v0(CKPT_INFO_V0 *cp_info_v0, CKPT_INFO 
*cp_info);
 
+static CPND_SHM_VERSION cpnd_shm_version;
+
 
/***
 *
  * Name   : cpnd_client_extract_bits
  *
@@ -296,12 +310,21 @@ void cpnd_restart_update_timer(CPND_CB *
CKPT_INFO ckpt_info;
 
memset(_info, '\0', sizeof(CKPT_INFO));
-   if (cp_node->offset >= 0) {
+   if (cp_node->offset < 0) {
+   return;
+   }
+   if (cpnd_shm_version.shm_version == CPSV_CPND_SHM_VERSION_LONG_DN) {
m_CPND_CKPTINFO_READ(ckpt_info, (char *)cb->shm_addr.ckpt_addr 
+ sizeof(CKPT_HDR),
 cp_node->offset * sizeof(CKPT_INFO));
ckpt_info.close_time = closetime;
m_CPND_CKPTINFO_UPDATE((char *)cb->shm_addr.ckpt_addr + 
sizeof(CKPT_HDR),
   ckpt_info, cp_node->offset * 
sizeof(CKPT_INFO));
+   } else {
+   m_CPND_CKPTINFO_V0_READ(ckpt_info, (char 

[devel] [PATCH 1 of 1] cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068] V3

2016-09-29 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd_evt.h.old |   0 
 osaf/libs/common/cpsv/include/cpnd_init.h|   1 -
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |  12 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |  25 -
 6 files changed, 6 insertions(+), 39 deletions(-)


Problem:
Statistically the check point create time for SC and PL (sync and async) has
degradation more than 30% after bring in patch 8004

Solution:
Remove unnecessary checking that cost time. imm will take the role of checking

diff --git a/osaf/libs/common/cpsv/include/cpnd_evt.h.old 
b/osaf/libs/common/cpsv/include/cpnd_evt.h.old
deleted file mode 100644
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -130,7 +130,6 @@ uint32_t cpnd_all_repl_rsp_expiry(CPND_C
 uint32_t cpnd_open_active_sync_expiry(CPND_CB *cb, CPND_TMR_INFO *tmr_info);
 void cpnd_proc_free_read_data(CPSV_EVT *evt);
 SaUint32T cpnd_get_scAbsenceAllowed_attr();
-SaUint32T cpnd_get_longDnsAllowed_attr();
 /* End cpnd_proc.c */
 
 /* File : ---  cpnd_amf.c */
diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -106,6 +106,9 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
+   if (err == SA_AIS_ERR_INVALID_PARAM) {
+   return NCSCC_RC_INVALID_INPUT;
+   }
return NCSCC_RC_FAILURE;
}
}
diff --git a/osaf/services/saf/cpsv/cpd/cpd_evt.c 
b/osaf/services/saf/cpsv/cpd/cpd_evt.c
--- a/osaf/services/saf/cpsv/cpd/cpd_evt.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_evt.c
@@ -238,9 +238,11 @@ static uint32_t cpd_evt_proc_ckpt_create
rc = SA_AIS_ERR_NO_MEMORY;
goto send_rsp;
} else if (proc_rc != NCSCC_RC_SUCCESS) {
-
TRACE_4("cpd ckpt create failure ckpt name,dest :  %s, 
%"PRIu64, ckpt_name, sinfo->dest);
rc = SA_AIS_ERR_LIBRARY;
+   if (proc_rc == NCSCC_RC_INVALID_INPUT) {
+   rc = SA_AIS_ERR_INVALID_PARAM;
+   }
goto send_rsp;
}
 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -605,12 +605,6 @@ static uint32_t cpnd_evt_proc_ckpt_open(
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.openReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;
@@ -1137,12 +1131,6 @@ static uint32_t cpnd_evt_proc_ckpt_unlin
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.ulinkReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.ulinkRsp.error = 
SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.ulinkRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -2735,31 +2735,6 @@ SaUint32T cpnd_get_scAbsenceAllowed_attr
 }
 
 
/
- * Name  : cpnd_get_longDnsAllowed_attr()
- *
- * Description   : This function gets scAbsenceAllowed attribute
- *
- * Arguments : -
- * 
- * Return Values : scAbsenceAllowed attribute (0 = not allowed)
- 
*/
-SaUint32T cpnd_get_longDnsAllowed_attr()
-{
-   SaUint32T rc_attr_val = 0;
-   char *attribute_names[] = {
-   "longDnsAllowed",
-   NULL
-   };
-
-   TRACE_ENTER();
-
-   rc_attr_val = cpnd_get_imm_attr(attribute_names);
-
-   TRACE_LEAVE();
-   

[devel] [PATCH 0 of 1] Review Request for cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068] V3

2016-09-29 Thread Hoang Vo
Summary: cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068] V3
Review request for Trac Ticket(s): 2068
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com; anders.wid...@ericsson.com
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 servicesn
 OpenSAF servicesy
 Core libraries  n
 Samples n
 Tests   n
 Other   n


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

changeset e7e4d893fd7e11ca0c14376c9ab4c5914c8256f9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 29 Sep 2016 15:05:49 +0700

cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068]
V3

Problem: Statistically the check point create time for SC and PL (sync 
and
async) has degradation more than 30% after bring in patch 8004

Solution: Remove unnecessary checking that cost time. imm will take the 
role
of checking


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpnd_evt.h.old |   0 
 osaf/libs/common/cpsv/include/cpnd_init.h|   1 -
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |  12 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |  25 -
 6 files changed, 6 insertions(+), 39 deletions(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-


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.


--
___
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 cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068] V2

2016-09-29 Thread Hoang Vo
Summary: cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068] V2
Review request for Trac Ticket(s): 2068
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com; anders.wid...@ericsson.com
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 5b53a6c30bc73ede4d26ce59ba8092de1215a6c5
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 29 Sep 2016 13:18:09 +0700

cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068]
V2

Problem: Statistically the check point create time for SC and PL (sync 
and
async) has degradation more than 30% after bring in patch 8004

Solution: Remove unnecessary checking that cost time. imm will take the 
role
of checking


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpnd_evt.h.old |   0 
 osaf/libs/common/cpsv/include/cpnd_init.h|   1 -
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |  12 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |  25 -
 6 files changed, 6 insertions(+), 39 deletions(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-


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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068] V2

2016-09-29 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd_evt.h.old |   0 
 osaf/libs/common/cpsv/include/cpnd_init.h|   1 -
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c   |  12 
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |  25 -
 6 files changed, 6 insertions(+), 39 deletions(-)


Problem:
Statistically the check point create time for SC and PL (sync and async) has
degradation more than 30% after bring in patch 8004

Solution:
Remove unnecessary checking that cost time. imm will take the role of checking

diff --git a/osaf/libs/common/cpsv/include/cpnd_evt.h.old 
b/osaf/libs/common/cpsv/include/cpnd_evt.h.old
deleted file mode 100644
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -130,7 +130,6 @@ uint32_t cpnd_all_repl_rsp_expiry(CPND_C
 uint32_t cpnd_open_active_sync_expiry(CPND_CB *cb, CPND_TMR_INFO *tmr_info);
 void cpnd_proc_free_read_data(CPSV_EVT *evt);
 SaUint32T cpnd_get_scAbsenceAllowed_attr();
-SaUint32T cpnd_get_longDnsAllowed_attr();
 /* End cpnd_proc.c */
 
 /* File : ---  cpnd_amf.c */
diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -106,6 +106,9 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
+   if (err == SA_AIS_ERR_INVALID_PARAM) {
+   return NCSCC_RC_FAILURE|NCSCC_RC_INVALID_INPUT;
+   }
return NCSCC_RC_FAILURE;
}
}
diff --git a/osaf/services/saf/cpsv/cpd/cpd_evt.c 
b/osaf/services/saf/cpsv/cpd/cpd_evt.c
--- a/osaf/services/saf/cpsv/cpd/cpd_evt.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_evt.c
@@ -238,9 +238,11 @@ static uint32_t cpd_evt_proc_ckpt_create
rc = SA_AIS_ERR_NO_MEMORY;
goto send_rsp;
} else if (proc_rc != NCSCC_RC_SUCCESS) {
-
TRACE_4("cpd ckpt create failure ckpt name,dest :  %s, 
%"PRIu64, ckpt_name, sinfo->dest);
rc = SA_AIS_ERR_LIBRARY;
+   if (proc_rc_RC_INVALID_INPUT) {
+   rc = SA_AIS_ERR_INVALID_PARAM;
+   }
goto send_rsp;
}
 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -605,12 +605,6 @@ static uint32_t cpnd_evt_proc_ckpt_open(
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.openReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;
@@ -1137,12 +1131,6 @@ static uint32_t cpnd_evt_proc_ckpt_unlin
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.ulinkReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.ulinkRsp.error = 
SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.ulinkRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -2735,31 +2735,6 @@ SaUint32T cpnd_get_scAbsenceAllowed_attr
 }
 
 
/
- * Name  : cpnd_get_longDnsAllowed_attr()
- *
- * Description   : This function gets scAbsenceAllowed attribute
- *
- * Arguments : -
- * 
- * Return Values : scAbsenceAllowed attribute (0 = not allowed)
- 
*/
-SaUint32T cpnd_get_longDnsAllowed_attr()
-{
-   SaUint32T rc_attr_val = 0;
-   char *attribute_names[] = {
-   "longDnsAllowed",
-   NULL
-   };
-
-   TRACE_ENTER();
-
-   rc_attr_val = cpnd_get_imm_attr(attribute_names);
-
-   TRACE_LEAVE();

[devel] [PATCH 1 of 1] cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068]

2016-09-26 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_db.c|   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c   |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c |  12 
 3 files changed, 6 insertions(+), 13 deletions(-)


Problem:
Statistically the check point create time for SC and PL (sync and async) has
degradation more than 30% after bring in patch 8004

Solution:
Remove unnecessary checking that cost time. imm will take the role of checking

diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -106,6 +106,9 @@ uint32_t cpd_ckpt_node_add(NCS_PATRICIA_
err = create_runtime_ckpt_object(ckpt_node, immOiHandle);
if (err != SA_AIS_OK) {
LOG_ER("create runtime ckpt object failed with error: 
%u",err);
+   if (err == SA_AIS_ERR_INVALID_PARAM) {
+   return NCSCC_RC_FAILURE|NCSCC_RC_INVALID_INPUT;
+   }
return NCSCC_RC_FAILURE;
}
}
diff --git a/osaf/services/saf/cpsv/cpd/cpd_evt.c 
b/osaf/services/saf/cpsv/cpd/cpd_evt.c
--- a/osaf/services/saf/cpsv/cpd/cpd_evt.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_evt.c
@@ -238,9 +238,11 @@ static uint32_t cpd_evt_proc_ckpt_create
rc = SA_AIS_ERR_NO_MEMORY;
goto send_rsp;
} else if (proc_rc != NCSCC_RC_SUCCESS) {
-
TRACE_4("cpd ckpt create failure ckpt name,dest :  %s, 
%"PRIu64, ckpt_name, sinfo->dest);
rc = SA_AIS_ERR_LIBRARY;
+   if (proc_rc_RC_INVALID_INPUT) {
+   rc = SA_AIS_ERR_INVALID_PARAM;
+   }
goto send_rsp;
}
 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -605,12 +605,6 @@ static uint32_t cpnd_evt_proc_ckpt_open(
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.openReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.openRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;
@@ -1137,12 +1131,6 @@ static uint32_t cpnd_evt_proc_ckpt_unlin
TRACE_ENTER();
memset(_evt, '\0', sizeof(CPSV_EVT));
 
-   if ((cpnd_get_longDnsAllowed_attr() == 0) && 
osaf_is_an_extended_name(>info.ulinkReq.ckpt_name)) {
-   LOG_ER("cpnd - longDnsAllowed == false - NOT supporting 
extended name");
-   send_evt.info.cpa.info.ulinkRsp.error = 
SA_AIS_ERR_INVALID_PARAM;
-   goto agent_rsp;
-   }
-
if (!cpnd_is_cpd_up(cb)) {
send_evt.info.cpa.info.ulinkRsp.error = SA_AIS_ERR_TRY_AGAIN;
goto agent_rsp;

--
___
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 cpsv: remove longDnsAllowed checking each checkpoint creating time [#2068]

2016-09-26 Thread Hoang Vo
Summary: cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068]
Review request for Trac Ticket(s): 2068
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 3b249a948c534b6c5ebdd648cfffaebc3c4d4d74
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 27 Sep 2016 12:02:02 +0700

cpsv: remove longDnsAllowed checking each checkpoint creating time 
[#2068]

Problem: Statistically the check point create time for SC and PL (sync 
and
async) has degradation more than 30% after bring in patch 8004

Solution: Remove unnecessary checking that cost time. imm will take the 
role
of checking


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_db.c|   3 +++
 osaf/services/saf/cpsv/cpd/cpd_evt.c   |   4 +++-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c |  12 
 3 files changed, 6 insertions(+), 13 deletions(-)


Testing Commands:
-
Run osaftest test cases

Testing, Expected Results:
--
All test cases must pass

Conditions of Submission:
-
ACK from maintainer

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.


--
___
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 cpd: coredump error while creating checkpoint after previous creating got error [#2055]

2016-09-21 Thread Hoang Vo
Summary: cpd: coredump error while creating checkpoint after previous creating 
got error [#2055]
Review request for Trac Ticket(s): 2055
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 5a008720463c765a471af1d435d7fa57937251f8
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 21 Sep 2016 17:29:57 +0700

cpd: coredump error while creating checkpoint after previous creating 
got
error [#2055]

Problem: First creating time, cpd got error in creating immOm object 
and run
to error handling steps, this free node_info memory without removing it 
from
nsc_patricia_tree. Second creating time, cpd try to access node_info 
and got
error.

Solution: Do not free node_info memory here when this scope does not 
init
it. Only free mode_info in cpd_cpnd_info_node_delete function.


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  5 -
 1 files changed, 0 insertions(+), 5 deletions(-)


Testing Commands:
-
Run all osaftests test cases for ckpt

Testing, Expected Results:
--
All test cases passed

Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpd: coredump error while creating checkpoint after previous creating got error [#2055]

2016-09-21 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  5 -
 1 files changed, 0 insertions(+), 5 deletions(-)


Problem:
First creating time, cpd got error in creating immOm object and run to error 
handling steps, this free node_info memory without removing it from 
nsc_patricia_tree.
Second creating time, cpd try to access node_info and got error.

Solution:
Do not free node_info memory here when this scope does not init it. Only free 
mode_info in cpd_cpnd_info_node_delete function.

diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
b/osaf/services/saf/cpsv/cpd/cpd_proc.c
--- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
@@ -383,11 +383,6 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
}
}
 
-   if (node_info) {
-   m_MMGR_FREE_CPD_CPND_INFO_NODE(node_info);
-
-   }
-
TRACE_LEAVE();
return proc_rc;
 

--
___
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 ckpt: ckpttest for long dn 5_55 5_57 7_12 is failing #2032

2016-09-20 Thread Hoang Vo
Summary: ckpt: ckpttest for long dn is failing #2032
Review request for Trac Ticket(s): #2032
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 servicesn
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   y
 Other   n


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

changeset 0a8d025d3bbdcaa9e752b8a8f1d7c605787701b7
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 20 Sep 2016 13:08:31 +0700

[mq]: 2032_fix_ckpttest.patch


Complete diffstat:
--
 tests/cpsv/test_cpa.c  |  2 +-
 tests/cpsv/test_cpa_util.c |  6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


Testing Commands:
-
Enable long DN:
immcfg -a longDnsAllowed=1 opensafImm=opensafImm,safApp=safImmService
export SA_ENABLE_EXTENDED_NAMES=1
RUn test
ckpttest

Testing, Expected Results:
--
All test cases must passed

Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] [mq]: 2032_fix_ckpttest.patch

2016-09-20 Thread Hoang Vo
 tests/cpsv/test_cpa.c  |  2 +-
 tests/cpsv/test_cpa_util.c |  6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


diff --git a/tests/cpsv/test_cpa.c b/tests/cpsv/test_cpa.c
--- a/tests/cpsv/test_cpa.c
+++ b/tests/cpsv/test_cpa.c
@@ -45,7 +45,7 @@ const char *saf_error_string[] = {
 #endif
 
 #define VALID_EXTENDED_NAME_LENGTH 400
-#define INVALID_EXTENDED_NAME_LENGTH 2049
+#define INVALID_EXTENDED_NAME_LENGTH 2050
 
 
 extern int gl_prev_act;
diff --git a/tests/cpsv/test_cpa_util.c b/tests/cpsv/test_cpa_util.c
--- a/tests/cpsv/test_cpa_util.c
+++ b/tests/cpsv/test_cpa_util.c
@@ -391,7 +391,7 @@ struct SafCheckpointOpen API_Open[]={
 [CKPT_OPEN_ALL_CREATE_EXTENDED_NAME_SUCCESS_T] = 
{,_replicas_ckpt_with_valid_extended_name_length,_replicas,SA_CKPT_CHECKPOINT_CREATE,
  
APP_TIMEOUT,_replicas_Createhdl,SA_AIS_OK,"ckpt with ALL_REPLICAS and 
valid extended name created"},
 [CKPT_OPEN_ALL_CREATE_EXTENDED_NAME_INVALID_PARAM_T] = 
{,_replicas_ckpt_with_invalid_extended_name_length,_replicas,SA_CKPT_CHECKPOINT_CREATE,
- 
APP_TIMEOUT,_replicas_Createhdl,SA_AIS_ERR_INVALID_PARAM,"ckpt with 
ALL_REPLICAS and invalid extended name created"},
+ 
APP_TIMEOUT,_replicas_Createhdl,SA_AIS_ERR_TOO_BIG,"ckpt with 
ALL_REPLICAS and invalid extended name created"},
 
 /* NULL ckptHandle, */
 
@@ -560,7 +560,7 @@ struct SafCheckpointOpenAsync API_OpenAs
 [CKPT_OPEN_ASYNC_ALL_CREATE_EXTENDED_NAME_SUCCESS_T] = 
{,1021, _replicas_ckpt_with_valid_extended_name_length, 
_replicas,
  
SA_CKPT_CHECKPOINT_CREATE,SA_AIS_OK,"all replicas ckpt with valid extended name 
created with invocation 1021"},
 [CKPT_OPEN_ASYNC_ALL_CREATE_EXTENDED_NAME_INVALID_PARAM_T] = 
{,0, _replicas_ckpt_with_invalid_extended_name_length, 
_replicas,
- 
SA_CKPT_CHECKPOINT_CREATE,SA_AIS_ERR_INVALID_PARAM,"all replicas ckpt invalid 
with extended name created"},
+ 
SA_CKPT_CHECKPOINT_CREATE,SA_AIS_ERR_TOO_BIG,"all replicas ckpt invalid with 
extended name created"},
 };
 
 int test_ckptOpenAsync(int i,CONFIG_FLAG cfg_flg) 
@@ -1946,7 +1946,7 @@ struct SafCheckpointUnlink API_Unlink[]=
 
   [CKPT_UNLINK_ALL_REPLICAS_EXTENDED_NAME_SUCCESS_T] = 
{,_replicas_ckpt_with_valid_extended_name_length,SA_AIS_OK,"Unlinked
 ckpt all replicas with extended name length"},
 
-  [CKPT_UNLINK_ALL_REPLICAS_EXTENDED_NAME_INVALID_PARAM_T] = 
{,_replicas_ckpt_with_invalid_extended_name_length,SA_AIS_ERR_INVALID_PARAM,"Unlinked
 ckpt all replicas with invalid extended name length"},
+  [CKPT_UNLINK_ALL_REPLICAS_EXTENDED_NAME_INVALID_PARAM_T] = 
{,_replicas_ckpt_with_invalid_extended_name_length,SA_AIS_ERR_TOO_BIG,"Unlinked
 ckpt all replicas with invalid extended name length"},
 
   #if 0
   [CKPT_UNLINK_NOT_EXIST4_T] = 
{,_ckpt,SA_AIS_OK,"Unlinked ckpt collcated 
replicas"},

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] imported patch 1967_fix_headless_error_cppcheck.patch

2016-08-24 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_proc.c  |   4 ++--
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c |  11 ++-
 2 files changed, 4 insertions(+), 11 deletions(-)


diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
b/osaf/services/saf/cpsv/cpd/cpd_proc.c
--- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
@@ -1142,7 +1142,7 @@ void cpd_cb_dump(void)
 

TRACE("--");
TRACE(" CKPT ID:  = %d", 
(uint32_t)ckpt_node->ckpt_id);
-   TRACE(" CKPT Name len  = %lu", 
strlen(ckpt_node->ckpt_name));
+   TRACE(" CKPT Name len  = %zu", 
strlen(ckpt_node->ckpt_name));
TRACE(" CKPT Name: %s", ckpt_node->ckpt_name);
 
TRACE(" UNLINK = %d, Active Exists = %d", 
ckpt_node->is_unlink_set,
@@ -1196,7 +1196,7 @@ void cpd_cb_dump(void)
name = ckpt_map_node->ckpt_name;
 

TRACE("--");
-   TRACE(" CKPT Name len  = %lu", strlen(name));
+   TRACE(" CKPT Name len  = %zu", strlen(name));
TRACE(" CKPT Name: %s", name);
 
TRACE(" CKPT ID:  = %d", 
(uint32_t)ckpt_map_node->ckpt_id);
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -4700,8 +4700,8 @@ static uint32_t cpnd_transfer_replica(CP
 
while (1) {
 
-   if (((size + tmp_sec_info->sec_size) > MAX_SYNC_TRANSFER_SIZE)
-   || (total_num == cp_node->replica_info.n_secs)) {
+   if ((total_num == cp_node->replica_info.n_secs) ||
+   ((size + tmp_sec_info->sec_size) > MAX_SYNC_TRANSFER_SIZE)) {
 
send_evt.info.cpnd.info.ckpt_nd2nd_sync.num_of_elmts = 
num;
send_evt.info.cpnd.info.ckpt_nd2nd_sync.data = sec_data;
@@ -4758,13 +4758,6 @@ static uint32_t cpnd_transfer_replica(CP
total_num++;
 
tmp_sec_info = cpnd_ckpt_sec_get_next(_node->replica_info, 
tmp_sec_info);
-   if (tmp_sec_info == NULL) {
-   rc = NCSCC_RC_FAILURE;
-   TRACE_4("cpnd ckpt memory get next allocation failed");
-   send_evt.info.cpnd.info.ckpt_nd2nd_sync.data = sec_data;
-   
cpnd_proc_free_cpsv_ckpt_data(send_evt.info.cpnd.info.ckpt_nd2nd_sync.data);
-   return rc;
-   }
}
 
TRACE_LEAVE();

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpsv: To update checkpoint user number for each node [#1669] V5

2016-08-18 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpd_cb.h   |6 +-
 osaf/libs/common/cpsv/include/cpd_proc.h |3 +
 osaf/libs/common/cpsv/include/cpd_red.h  |   13 ++
 osaf/libs/common/cpsv/include/cpsv_evt.h |8 +
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   14 ++-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |8 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |   97 ---
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  148 +++
 osaf/services/saf/cpsv/cpd/cpd_red.c |   30 -
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 +--
 10 files changed, 347 insertions(+), 37 deletions(-)


Problem:
---
The saCkptCheckpointNumOpeners is not updated when a node which has a 
checkpoint client restarts.

Solution:

Currently CPD doesn't store number of user on each node. This patch updates CPD 
to update information
about users on each node for each checkpoint. When a node restarts, the CPD 
update the total number of
users for a checkpoint accordingly. This is reflected on 
saCkptCheckpointNumOpeners attribute correctly.

diff --git a/osaf/libs/common/cpsv/include/cpd_cb.h 
b/osaf/libs/common/cpsv/include/cpd_cb.h
--- a/osaf/libs/common/cpsv/include/cpd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpd_cb.h
@@ -22,7 +22,7 @@
 #include 
 #include "cpd_tmr.h"
 
-#define CPSV_CPD_MBCSV_VERSION1
+#define CPSV_CPD_MBCSV_VERSION2
 
 #define m_CPND_IS_ON_SCXB(m,n) ((m==n)?1:0)
 
@@ -50,7 +50,7 @@
  CPD_WRT_CPA_SUBPART_VER_MIN + 1 )
 
 #define CPSV_CPD_MBCSV_VERSION_MIN 1
-#define CPSV_CPD_MBCSV_VERSION 1
+#define CPSV_CPD_MBCSV_VERSION_USR_INFO 2
 
 #include "saImmOi.h"
 
@@ -92,6 +92,8 @@ typedef struct cpd_ckpt_info_node {
uint32_t num_users;
uint32_t num_readers;
uint32_t num_writers;
+   uint32_t node_users_cnt;
+   CPD_NODE_USER_INFO *node_users;
 
/* for imm */
SaUint32T ckpt_used_size;
diff --git a/osaf/libs/common/cpsv/include/cpd_proc.h 
b/osaf/libs/common/cpsv/include/cpd_proc.h
--- a/osaf/libs/common/cpsv/include/cpd_proc.h
+++ b/osaf/libs/common/cpsv/include/cpd_proc.h
@@ -108,5 +108,8 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
 uint32_t cpd_mbcsv_close(CPD_CB *cb);
 bool cpd_is_noncollocated_replica_present_on_payload(CPD_CB *cb, 
CPD_CKPT_INFO_NODE *ckpt_node);
 uint32_t cpd_ckpt_reploc_imm_object_delete(CPD_CB *cb,  CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node ,bool is_unlink_set);
+void cpd_proc_increase_node_user_info(CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST 
cpnd_dest, SaCkptCheckpointOpenFlagsT open_flags);
+void cpd_proc_decrease_node_user_info(CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST 
cpnd_dest, SaCkptCheckpointOpenFlagsT open_flags);
+void cpd_proc_update_user_info_when_node_down(CPD_CB *cb, NODE_ID node_id);
 uint32_t cpd_proc_ckpt_update_post(CPD_CB *cb);
 #endif
diff --git a/osaf/libs/common/cpsv/include/cpd_red.h 
b/osaf/libs/common/cpsv/include/cpd_red.h
--- a/osaf/libs/common/cpsv/include/cpd_red.h
+++ b/osaf/libs/common/cpsv/include/cpd_red.h
@@ -64,6 +64,18 @@ typedef struct cpd_a2s_ckpt_usr_info {
 
 } CPD_A2S_CKPT_USR_INFO;
 
+typedef struct cpd_a2s_ckpt_usr_info_2 {
+   SaCkptCheckpointHandleT ckpt_id;
+   uint32_t num_user;
+   uint32_t num_writer;
+   uint32_t num_reader;
+   uint32_t num_sections;
+   uint32_t ckpt_on_scxb1;
+   uint32_t ckpt_on_scxb2;
+   uint32_t node_users_cnt;
+   CPD_NODE_USER_INFO *node_list;
+} CPD_A2S_CKPT_USR_INFO_2;
+
 typedef struct cpd_mbcsv_msg {
CPD_MBCSV_MSG_TYPE type;
union {
@@ -76,6 +88,7 @@ typedef struct cpd_mbcsv_msg {
CPD_A2S_CKPT_UNLINK ckpt_ulink;
CPD_A2S_CKPT_USR_INFO usr_info;
CPSV_CKPT_DEST_INFO dest_down;
+   CPD_A2S_CKPT_USR_INFO_2 usr_info_2;
} info;
 } CPD_MBCSV_MSG;
 
diff --git a/osaf/libs/common/cpsv/include/cpsv_evt.h 
b/osaf/libs/common/cpsv/include/cpsv_evt.h
--- a/osaf/libs/common/cpsv/include/cpsv_evt.h
+++ b/osaf/libs/common/cpsv/include/cpsv_evt.h
@@ -840,6 +840,14 @@ typedef struct cpd_tmr_info {
} info;
 } CPD_TMR_INFO;
 
+typedef struct cpd_node_user_info {
+   MDS_DEST dest;
+   uint32_t num_users;
+   uint32_t num_writers;
+   uint32_t num_readers;
+   struct cpd_node_user_info *next;
+} CPD_NODE_USER_INFO;
+
 /**
  CPD Event Data Structures
  
**/
diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -137,6 +137,7 @@ uint32_t cpd_ckpt_node_delete(CPD_CB *cb
 {
uint32_t rc = NCSCC_RC_SUCCESS;
CPD_NODE_REF_INFO *nref_info, *next_info;
+   CPD_NODE_USER_INFO *node_user, *next_node_user;
 
TRACE_ENTER();
 
@@ -153,6 +154,13 @@ uint32_t cpd_ckpt_node_delete(CPD_CB *cb

[devel] [PATCH 0 of 1] Review Request for cpsv: To update checkpoint user number for each node [#1669] V5

2016-08-18 Thread Hoang Vo
Summary: cpsv: To update checkpoint user number for each node [#1669] V5
Review request for Trac Ticket(s): 1669
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com;
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 09fb5a5a13c8362268fec6059aa997c942b8f257
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Fri, 19 Aug 2016 12:00:54 +0700

cpsv: To update checkpoint user number for each node [#1669] V5

Problem:
--- The saCkptCheckpointNumOpeners is not updated when a node which 
has a
checkpoint client restarts.

Solution:
 Currently CPD doesn't store number of user on each node. This 
patch
updates CPD to update information about users on each node for each
checkpoint. When a node restarts, the CPD update the total number of 
users
for a checkpoint accordingly. This is reflected on
saCkptCheckpointNumOpeners attribute correctly.


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpd_cb.h   |6 +++-
 osaf/libs/common/cpsv/include/cpd_proc.h |3 ++
 osaf/libs/common/cpsv/include/cpd_red.h  |   13 +++
 osaf/libs/common/cpsv/include/cpsv_evt.h |8 +++
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   14 ++-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |8 +++
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |   97 
--
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  148 

 osaf/services/saf/cpsv/cpd/cpd_red.c |   30 --
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 
+
 10 files changed, 347 insertions(+), 37 deletions(-)


Testing Commands:
-

1. Create a checkpoint on PL3 with flag (creation flag SA_CKPT_WR_ALL_REPLICAS)
2. Open this checkpoint on PL4
3. Restart PL3

Testing, Expected Results:
--
After step 3. the saCkptCheckpointNumOpeners is changed.

Conditions of Submission:
-
ACK from maintainer

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 revie

[devel] [PATCH 7 of 8] ckpt: Add new test cases to verify long DN feature on CPSV [#1574] v1

2016-08-18 Thread Hoang Vo
 tests/cpsv/Makefile.am  |1 +
 tests/cpsv/test_cpa.c   |  180 +++-
 tests/cpsv/test_cpa_util.c  |   16 +++-
 tests/cpsv/test_cpsv.h  |6 +
 tests/cpsv/test_cpsv_conf.h |3 +
 5 files changed, 201 insertions(+), 5 deletions(-)


diff --git a/tests/cpsv/Makefile.am b/tests/cpsv/Makefile.am
--- a/tests/cpsv/Makefile.am
+++ b/tests/cpsv/Makefile.am
@@ -21,6 +21,7 @@ MAINTAINERCLEANFILES = Makefile.in
 bin_PROGRAMS = ckpttest
 
 ckpttest_CPPFLAGS = \
+   -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/tests/unit_test_fw/inc \
-I$(top_srcdir)/osaf/libs/common/immsv/include \
diff --git a/tests/cpsv/test_cpa.c b/tests/cpsv/test_cpa.c
--- a/tests/cpsv/test_cpa.c
+++ b/tests/cpsv/test_cpa.c
@@ -1,6 +1,8 @@
 #include 
 #include 
 
+#include "saAis.h"
+#include "osaf_extended_name.h"
 #include "test_cpsv.h"
 #include "test_cpsv_conf.h"
 #include "ncs_main_papi.h"
@@ -42,6 +44,10 @@ const char *saf_error_string[] = {
 #define m_TEST_CPSV_PRINTF(...) 
 #endif
 
+#define VALID_EXTENDED_NAME_LENGTH 400
+#define INVALID_EXTENDED_NAME_LENGTH 2049
+
+
 extern int gl_prev_act;
 
 /** Ultility Functions /
@@ -82,6 +88,18 @@ void printResult(int result)
 
 }
 
+bool is_extended_name_enable() {
+
+  char *extended_name_env = getenv("SA_ENABLE_EXTENDED_NAMES");
+  if (extended_name_env == 0) 
+ return false;
+
+  if (strcmp(extended_name_env, "1") != 0)
+ return false;
+
+  return true;
+}
+
 void handleAssigner(SaInvocationT invocation, SaCkptCheckpointHandleT 
checkpointHandle)
 {
if (invocation == 1014)
@@ -122,8 +140,7 @@ void fill_ckpt_attri(SaCkptCheckpointCre


   
 void fill_ckpt_name(SaNameT *name,char *string)
 {
-   strcpy((char *)name->value,string);
-   name->length = strlen((char *)name->value);
+   saAisNameLend(string, name);
 }
 
 void fill_sec_attri(SaCkptSectionCreationAttributesT 
*sec_cr_attr,SaCkptSectionIdT *sec,SaTimeT exp_time)
@@ -279,6 +296,20 @@ void fill_testcase_data()

fill_ckpt_name(_replica_ckpt_large,"safCkpt=weak_replica_large_ckpt,safApp=safCkptService");

fill_ckpt_name(_ckpt_large,"safCkpt=collocated_large_ckpt,safApp=safCkptService");
 
+   char *ckpt_name = malloc(VALID_EXTENDED_NAME_LENGTH);
+   memset(ckpt_name, 0, VALID_EXTENDED_NAME_LENGTH);
+   memset(ckpt_name, '.', VALID_EXTENDED_NAME_LENGTH - 1);
+   int length = sprintf(ckpt_name, 
"safCkpt=all_replicas_ckpt_with_valid_extended_name_length");
+   *(ckpt_name + length) = '.';
+   saAisNameLend(ckpt_name, 
_replicas_ckpt_with_valid_extended_name_length);
+
+   ckpt_name = malloc(INVALID_EXTENDED_NAME_LENGTH);
+   memset(ckpt_name, 0, INVALID_EXTENDED_NAME_LENGTH);
+   memset(ckpt_name, '.', INVALID_EXTENDED_NAME_LENGTH - 1);
+   length = sprintf(ckpt_name, 
"safCkpt=all_replicas_ckpt_with_invalid_extended_name_length");
+   *(ckpt_name + length) = '.';
+   saAisNameLend(ckpt_name, 
_replicas_ckpt_with_invalid_extended_name_length);
+
/* Variables for sec create */
tcd.sec_id1 = (SaUint8T*)"11";
tcd.section1.idLen = 2;
@@ -451,6 +482,9 @@ void test_ckpt_cleanup(CPSV_CLEANUP_CKPT
   error = test_ckptUnlink(CKPT_UNLINK_SUCCESS9_T,TEST_CONFIG_MODE);
   break;
 
+ case CPSV_CLEAN_ASYNC_ALL_REPLICAS_CKPT_EXTENDED_NAME:
+  error = 
test_ckptUnlink(CKPT_UNLINK_ALL_REPLICAS_EXTENDED_NAME_SUCCESS_T,TEST_CONFIG_MODE);
+  break;
   }
 
   if(error != TEST_PASS)
@@ -2278,6 +2312,122 @@ final1:
   test_validate(result, TEST_PASS);
 }
 
+void cpsv_it_open_55()
+{
+  int result;
+  printHead("To verify creating a ckpt with valid extended name length");
+
+  /* Skip the test if Extended Name is not enable */
+  if (is_extended_name_enable() == false)
+ return test_validate(TEST_PASS, TEST_PASS);
+
+  result = test_ckptInitialize(CKPT_INIT_SUCCESS_T,TEST_CONFIG_MODE);
+  if(result != TEST_PASS)
+ goto final1;
+
+  result = 
test_ckptOpen(CKPT_OPEN_ALL_CREATE_EXTENDED_NAME_SUCCESS_T,TEST_NONCONFIG_MODE);
+
+  test_cpsv_cleanup(CPSV_CLEAN_INIT_SUCCESS_T);
+
+final1:
+  printResult(result);
+  test_validate(result, TEST_PASS);
+}
+
+void cpsv_it_open_56()
+{
+  int result;
+  printHead("To verify creating a ckpt with invalid extended name length");
+
+  /* Skip the test if Extended Name is not enable */
+  if (is_extended_name_enable() == false)
+ return test_validate(TEST_PASS, TEST_PASS);
+
+  result = test_ckptInitialize(CKPT_INIT_SUCCESS_T,TEST_CONFIG_MODE);
+  if(result != TEST_PASS)
+ goto final1;
+
+  result = 
test_ckptOpen(CKPT_OPEN_ALL_CREATE_EXTENDED_NAME_INVALID_PARAM_T,TEST_NONCONFIG_MODE);
+
+  test_cpsv_cleanup(CPSV_CLEAN_INIT_SUCCESS_T);
+
+final1:
+  printResult(result);
+  test_validate(result, TEST_PASS);
+}
+
+void cpsv_it_open_57()
+{
+  int result;
+  

[devel] [PATCH 5 of 8] cpd: Add new mbcsv messages supporting extended SaNameT [#1574] v2

2016-08-18 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c |  22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)


diff --git a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c 
b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
--- a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
@@ -23,6 +23,8 @@
 **/
 
 #include "cpd.h"
+extern uint32_t cpsv_encode_extended_name(NCS_UBAID *uba, SaNameT *name);
+extern uint32_t cpsv_decode_extended_name(NCS_UBAID *uba, SaNameT *name);
 
 
/**
  * Name   : cpd_mbcsv_async_update
@@ -385,6 +387,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
TRACE_4("edu exec async create failed");
rc = NCSCC_RC_FAILURE;
}
+
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_msg->info.ckpt_create.ckpt_name); 
+
break;
 
case CPD_A2S_MSG_CKPT_UNLINK:
@@ -395,6 +400,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
TRACE_4("edu exec async unlink failed");
rc = NCSCC_RC_FAILURE;
}
+
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_msg->info.ckpt_ulink.ckpt_name); 
+
break;
 
case CPD_A2S_MSG_CKPT_RDSET:
@@ -573,6 +581,8 @@ uint32_t cpd_mbcsv_enc_msg_resp(CPD_CB *
TRACE_LEAVE();
return rc;
}
+   
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_create.ckpt_name);
 
if (ckpt_create.dest_list)
m_MMGR_FREE_CPSV_CPND_DEST_INFO(ckpt_create.dest_list);
@@ -783,6 +793,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
rc = NCSCC_RC_FAILURE;
goto end;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_create->ckpt_name);
+
cpd_msg->type = evt_type;
cpd_msg->info.ckpt_create = *ckpt_create;
rc = cpd_process_sb_msg(cb, cpd_msg);
@@ -808,6 +821,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
rc = NCSCC_RC_FAILURE;
goto end;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_unlink->ckpt_name);
+
cpd_msg->type = evt_type;
cpd_msg->info.ckpt_ulink = *ckpt_unlink;
rc = cpd_process_sb_msg(cb, cpd_msg);
@@ -998,6 +1014,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB 
TRACE_LEAVE();
return rc;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_data->ckpt_name);
+
mbcsv_msg.info.ckpt_create = *ckpt_data;
proc_rc = cpd_sb_proc_ckpt_create(cb, _msg);
if (proc_rc != NCSCC_RC_SUCCESS) {
@@ -1007,6 +1026,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB 
if (ckpt_data->dest_list)
m_MMGR_FREE_CPSV_SYS_MEMORY(ckpt_data->dest_list);
 
+   if (osaf_is_an_extended_name(_data->ckpt_name))
+   free((void 
*)osaf_extended_name_borrow(_data->ckpt_name));
+
memset(ckpt_data, 0, sizeof(CPD_A2S_CKPT_CREATE));
memset(_msg, 0, sizeof(CPD_MBCSV_MSG));
}

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0 of 8] Review Request for CKPT: Support DNs longer than 255 bytes [#1574] v5

2016-08-18 Thread Hoang Vo
Summary: CKPT: Support DNs longer than 255 bytes {#1574}
Review request for Trac Ticket(s): 1574
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 05233bdae1fb000fea001964eba1c51ebf3bfd8e
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpd: Add support for extended SaNameT [#1574] v3

changeset cecabec5b6be73e731e540fd439e1d0e3534809f
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpnd: Add support for extended SaNameT [#1574] v3

changeset 940dc877c94a9539e3da06d89c6480ef7e0ceda0
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpa: Add support for extended SaNameT [#1574] v1

changeset 1f74531a36163bdfecd6b27174443d51c11ecf61
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpsv: Add new message to support extended SaNameT [#1574] v3

changeset 29df19302186b3275ad06db00dc62f275dea25e1
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpd: Add new mbcsv messages supporting extended SaNameT [#1574] v2

changeset 3f72410a7c2bb077647bdd4e46869a31a832f1d8
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and 
CPA
[#1574] v4

changeset f32a0b3ca1ebf6049d2103e68e91d98bf086c48e
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

ckpt: Add new test cases to verify long DN feature on CPSV [#1574] v1

changeset 1aa38b707cf2cec14c416631cfc7e5518b25735f
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Thu, 18 Aug 2016 13:51:56 +0700

cpnd: add support for shm recovery for in-service update without 
restarting
node [#1574] v1


Complete diffstat:
--
 osaf/libs/agents/saf/cpa/Makefile.am  |1 +
 osaf/libs/agents/saf/cpa/cpa_api.c|   48 --
 osaf/libs/agents/saf/cpa/cpa_db.c |2 +
 osaf/libs/agents/saf/cpa/cpa_mds.c|4 +-
 osaf/libs/agents/saf/cpa/cpa_proc.c   |2 +-
 osaf/libs/common/cpsv/cpsv_evt.c  |  440 
++---
 osaf/libs/common/cpsv/include/cpa.h   |1 +
 osaf/libs/common/cpsv/include/cpa_cb.h|2 +-
 osaf/libs/common/cpsv/include/cpa_proc.h  |2 +-
 osaf/libs/common/cpsv/include/cpd.h   |1 +
 osaf/libs/common/cpsv/include/cpd_cb.h|   17 +-
 osaf/libs/common/cpsv/include/cpd_imm.h   |4 +-
 osaf/libs/common/cpsv/include/cpd_mem.h   |   25 +++-
 osaf/libs/common/cpsv/include/cpd_proc.h  |2 +-
 osaf/libs/common/cpsv/include/cpnd.h  |1 +
 osaf/libs/common/cpsv/include/cpnd_cb.h   |5 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |3 +-
 osaf/libs/common/cpsv/include/cpsv_evt.h  |   10 +
 osaf/libs/common/cpsv/include/cpsv_shm.h  |   24 +++-
 osaf/services/saf/cpsv/cpd/Makefile.am|1 +
 osaf/services/saf/cpsv/cpd/cpd_amf.c  |7 +-
 osaf/services/saf/cpsv/cpd/cpd_db.c   |   95 +++---
 osaf/services/saf/cpsv/cpd/cpd_evt.c  |  103 ++-
 osaf/services/saf/cpsv/cpd/cpd_imm.c  |  268 
++
 osaf/services/saf/cpsv/cpd/cpd_main.c |7 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c|   31 -
 osaf/services/saf/cpsv/cpd/cpd_mds.c  |   84 -
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  180 ++--
 osaf/services/saf/cpsv/cpd/cpd_red.c  |6 +-
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c|   57 +++-
 osaf/services/saf/cpsv/cpnd/Makefile.am   |1 +
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |6 +-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|   73 ---
 osaf/services/saf/cpsv/cpnd/cpnd_main.c   |7 +
 osaf/services/saf/cpsv/cpnd/cpnd_mds.c|   86 -
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |   84 +---
 osaf/services/saf/cpsv/cpnd/cpnd_res.c|  823 
++
 tests/cpsv/Makefile.am|1 +
 tests/cpsv/test_cpa.c |  180 -
 t

[devel] [PATCH 6 of 8] cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and CPA [#1574] v4

2016-08-18 Thread Hoang Vo
 osaf/libs/agents/saf/cpa/cpa_api.c  |  12 
 osaf/libs/agents/saf/cpa/cpa_mds.c  |   2 +-
 osaf/libs/common/cpsv/cpsv_evt.c|   1 +
 osaf/services/saf/cpsv/cpd/cpd_proc.c   |   2 +-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c  |   2 ++
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c |   2 +-
 6 files changed, 18 insertions(+), 3 deletions(-)


diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -880,6 +880,10 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
@@ -1192,6 +1196,10 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
@@ -1597,6 +1605,10 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* retrieve CPA CB */
m_CPA_RETRIEVE_CB(cb);
diff --git a/osaf/libs/agents/saf/cpa/cpa_mds.c 
b/osaf/libs/agents/saf/cpa/cpa_mds.c
--- a/osaf/libs/agents/saf/cpa/cpa_mds.c
+++ b/osaf/libs/agents/saf/cpa/cpa_mds.c
@@ -515,9 +515,9 @@ static uint32_t cpa_mds_svc_evt(CPA_CB *
   /* Populate & Send the Open Event to CPND */
   memset(, 0, sizeof(CPSV_EVT));
   evt.type = CPSV_EVT_TYPE_CPND;
-  evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_LIST_UPDATE;
   evt.info.cpnd.info.ckptListUpdate.client_hdl = 
lc_node->cl_hdl; 
   osaf_extended_name_lend(lc_node->ckpt_name, 
_name);
+  evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_LIST_UPDATE;
 
   proc_rc = cpa_mds_msg_send(cb->cpa_mds_hdl, 
>cpnd_mds_dest, , NCSMDS_SVC_ID_CPND);
 
diff --git a/osaf/libs/common/cpsv/cpsv_evt.c b/osaf/libs/common/cpsv/cpsv_evt.c
--- a/osaf/libs/common/cpsv/cpsv_evt.c
+++ b/osaf/libs/common/cpsv/cpsv_evt.c
@@ -2378,6 +2378,7 @@ static uint32_t cpsv_encode_extended_nam
if(!osaf_is_an_extended_name(name))
return NCSCC_RC_SUCCESS;
 
+   TRACE("length = %d", name->length);
SaConstStringT value = osaf_extended_name_borrow(name);
uint16_t length = osaf_extended_name_length(name);
 
diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
b/osaf/services/saf/cpsv/cpd/cpd_proc.c
--- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
@@ -61,9 +61,9 @@ uint32_t cpd_noncolloc_ckpt_rep_create(C
/* Send the Replica create info to CPND */
memset(_evt, 0, sizeof(CPSV_EVT));
send_evt.type = CPSV_EVT_TYPE_CPND;
-   send_evt.info.cpnd.type = CPND_EVT_D2ND_CKPT_CREATE;
 
osaf_extended_name_lend(map_info->ckpt_name, 
_evt.info.cpnd.info.ckpt_create.ckpt_name);
+   send_evt.info.cpnd.type = CPND_EVT_D2ND_CKPT_CREATE;
 
d2nd_info = _evt.info.cpnd.info.ckpt_create.ckpt_info;
 
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -4638,6 +4638,8 @@ uint32_t cpnd_evt_destroy(CPSV_EVT *evt)
if 
(osaf_is_an_extended_name(>info.cpnd.info.ckptListUpdate.ckpt_name))
free((void 
*)osaf_extended_name_borrow(>info.cpnd.info.ckptListUpdate.ckpt_name));
} else if (evt->info.cpnd.type == CPND_EVT_D2ND_CKPT_CREATE) {
+   if (evt->info.cpnd.info.ckpt_create.ckpt_info.dest_list != NULL)
+   
m_MMGR_FREE_CPSV_SYS_MEMORY(evt->info.cpnd.info.ckpt_create.ckpt_info.dest_list);
if 
(osaf_is_an_extended_name(>info.cpnd.info.ckpt_create.ckpt_name))
free((void 
*)osaf_extended_name_borrow(>info.cpnd.info.ckpt_create.ckpt_name));
}
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -2529,9 +2529,9 @@ void 

[devel] [PATCH 8 of 8] cpnd: add support for shm recovery for in-service update without restarting node [#1574] v1

2016-08-18 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpsv_shm.h |   18 +
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |1 -
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  821 +++---
 3 files changed, 633 insertions(+), 207 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -74,6 +74,24 @@ typedef struct ckpt_info {
int32_t next;
 } CKPT_INFO;
 
+typedef struct ckpt_info_v0 {
+   SaNameT ckpt_name;
+   SaCkptCheckpointHandleT ckpt_id;
+   uint32_t maxSections;
+   SaSizeT maxSecSize;
+   NODE_ID node_id;
+   int32_t offset;
+   uint32_t client_bitmap;
+   int32_t is_valid;
+   uint32_t bm_offset;
+   bool is_unlink;
+   bool is_close;
+   bool cpnd_rep_create;
+   bool is_first;
+   SaTimeT close_time;
+   int32_t next;
+} CKPT_INFO_V0;
+
 typedef struct client_info {
SaCkptHandleT ckpt_app_hdl;
uint32_t ckpt_open_ref_cnt;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -1813,7 +1813,6 @@ uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_
memset(_req, '\0', sizeof(write_req));
memset(_hdr, '\0', sizeof(CPSV_CKPT_HDR));
ckpt_hdr.ckpt_id = cp_node->ckpt_id;
-   strncpy(ckpt_hdr.ckpt_name, cp_node->ckpt_name, kOsafMaxDnLength);
ckpt_hdr.create_attrib = cp_node->create_attrib;
ckpt_hdr.open_flags = cp_node->open_flags;
ckpt_hdr.is_unlink = cp_node->is_unlink;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -40,6 +40,8 @@
 
 #define m_CPND_CKPTINFO_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO))
 
+#define m_CPND_CKPTINFO_V0_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO_V0))
+
 #define m_CPND_CKPTINFO_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO))
 
 #define m_CPND_CKPTHDR_UPDATE(ckpt_hdr,offset)  
memcpy(offset,_hdr,sizeof(CKPT_HDR))
@@ -48,6 +50,13 @@ static uint32_t cpnd_res_ckpt_sec_add(CP
 static bool cpnd_find_exact_ckptinfo(CPND_CB *cb, CKPT_INFO *ckpt_info, 
uint32_t bitmap_offset,
 uint32_t *offset, uint32_t 
*prev_offset);
 static void cpnd_clear_ckpt_info(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
uint32_t curr_offset, uint32_t prev_offset);
+static uint32_t cpnd_restore_client_info(CPND_CB *cb, uint8_t *cli_addr);
+static uint32_t cpnd_restore_ckpt_info_v1(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
+static uint32_t cpnd_restore_ckpt_info_v0(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
+static void cpnd_destroy_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_OPEN_INFO 
*open_req);
+static void *cpnd_create_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_INFO *req_info);
+static void cpnd_update_shm_cpnd_cp_info(CPND_CB *cb);
+static void cpnd_convert_cp_info_v0(CKPT_INFO_V0 *cp_info_v0, CKPT_INFO 
*cp_info);
 
 
/***
 *
  * Name   : cpnd_client_extract_bits
@@ -315,24 +324,10 @@ void cpnd_restart_update_timer(CPND_CB *
 
 void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, 
CPND_CB *cb, SaClmNodeIdT nodeid)
 {
-   uint32_t counter = 0, count, num_bitset = 0, n_clients, rc = 
NCSCC_RC_SUCCESS, bit_position;
-   uint64_t i_offset;
-   int32_t next_offset;
-   CPND_CKPT_CLIENT_NODE *cl_node = NULL;
-   CPND_CKPT_NODE *cp_node = NULL;
-   CLIENT_INFO cl_info;
-   CLIENT_HDR cli_hdr;
-   CKPT_INFO cp_info, tmp_cp_info;
-   SaCkptHandleT client_hdl;
+   uint32_t rc = NCSCC_RC_SUCCESS;
char *buf = NULL, *buffer = NULL;
uint8_t size = 0, total_length;
GBL_SHM_PTR gbl_shm_addr = {0, 0, 0, 0, 0};
-   memset(_info, '\0', sizeof(CKPT_INFO));
-   NCS_OS_POSIX_SHM_REQ_INFO ckpt_rep_open;
-   SaTimeT presentTime, timeout = 0;
-   int64_t now, diff_time, giga_sec;
-   uint32_t max_client_hdl = 0;
-   SaTimeT tmpTime = 0;
CPND_SHM_VERSION cpnd_shm_version;
 
TRACE_ENTER();
@@ -371,18 +366,15 @@ void *cpnd_restart_shm_create(NCS_OS_POS
 
if (rc == NCSCC_RC_FAILURE) {   /* INITIALLY IT FAILS SO CREATE A 
SHARED MEMORY */
TRACE_1("cpnd comming up first time");
-   cpnd_open_req->info.open.i_flags = O_CREAT | O_RDWR;
-   rc = ncs_os_posix_shm(cpnd_open_req);
-   if (NCSCC_RC_FAILURE == rc) {
+
+   if (NULL == cpnd_create_shm_cpnd_cp_info(cpnd_open_req)) {
LOG_ER("cpnd open request fail for RDWR mode %s",buf);

[devel] [PATCH 1 of 8] cpd: Add support for extended SaNameT [#1574] v3

2016-08-18 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpd.h  |1 +
 osaf/libs/common/cpsv/include/cpd_cb.h   |   17 +-
 osaf/libs/common/cpsv/include/cpd_imm.h  |4 +-
 osaf/libs/common/cpsv/include/cpd_mem.h  |   25 ++-
 osaf/libs/common/cpsv/include/cpd_proc.h |2 +-
 osaf/services/saf/cpsv/cpd/Makefile.am   |1 +
 osaf/services/saf/cpsv/cpd/cpd_amf.c |7 +-
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   95 +-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |  103 +++
 osaf/services/saf/cpsv/cpd/cpd_imm.c |  268 +-
 osaf/services/saf/cpsv/cpd/cpd_main.c|7 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |9 +-
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  178 ++--
 osaf/services/saf/cpsv/cpd/cpd_red.c |6 +-
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 ++---
 15 files changed, 474 insertions(+), 306 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpd.h 
b/osaf/libs/common/cpsv/include/cpd.h
--- a/osaf/libs/common/cpsv/include/cpd.h
+++ b/osaf/libs/common/cpsv/include/cpd.h
@@ -33,6 +33,7 @@
 #ifndef CPD_H
 #define CPD_H
 
+#include "osaf_extended_name.h"
 #include "cpsv.h"
 #include "ncssysf_def.h"
 #include "ncs_main_papi.h"
diff --git a/osaf/libs/common/cpsv/include/cpd_cb.h 
b/osaf/libs/common/cpsv/include/cpd_cb.h
--- a/osaf/libs/common/cpsv/include/cpd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpd_cb.h
@@ -78,7 +78,7 @@ typedef struct cpsv_node_ref_info {
 typedef struct cpd_ckpt_info_node {
NCS_PATRICIA_NODE patnode;
SaCkptCheckpointHandleT ckpt_id;
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
uint32_t dest_cnt;
CPD_NODE_REF_INFO *node_list;
bool is_unlink_set;
@@ -123,8 +123,7 @@ typedef struct cpd_cpnd_info_node {
uint32_t timer_state;
bool ckpt_cpnd_scxb_exist;
/* for imm */
-   SaNameT node_name;
-   SaNameT ckpt_name;
+   SaConstStringT node_name;
uint32_t rep_type;
 } CPD_CPND_INFO_NODE;
 
@@ -132,15 +131,15 @@ typedef struct cpd_cpnd_info_node {
 
 typedef struct cpd_ckpt_map_info {
NCS_PATRICIA_NODE patnode;
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
SaCkptCheckpointHandleT ckpt_id;
SaCkptCheckpointCreationAttributesT attributes;
SaVersionT client_version;
 } CPD_CKPT_MAP_INFO;
 
 typedef struct cpd_rep_key_info {
-   SaNameT ckpt_name;
-   SaNameT node_name;
+  SaConstStringT ckpt_name;
+  SaConstStringT node_name;
 } CPD_REP_KEY_INFO;
 
 typedef struct cpd_ckpt_reploc_info {
@@ -219,7 +218,7 @@ typedef struct cpd_cb_tag {
 #define CPD_CB_NULL  ((CPD_CB *)0)
 
 /* Function Declarations */
-CPD_CKPT_INFO_NODE *cpd_find_add_ckpt_name(CPD_CB *cpd_cb, SaNameT ckpt_name);
+CPD_CKPT_INFO_NODE *cpd_find_add_ckpt_name(CPD_CB *cpd_cb, SaConstStringT 
ckpt_name);
 
 void cpd_free_ckpt_node(CPD_CB *gld_cb, CPD_CKPT_INFO_NODE *ckpt_info);
 
@@ -248,9 +247,9 @@ void cpd_ckpt_reploc_tree_destroy(CPD_CB
 
 uint32_t cpd_ckpt_map_tree_init(CPD_CB *cb);
 uint32_t cpd_ckpt_map_node_get(NCS_PATRICIA_TREE *ckpt_map_tree,
-SaNameT *ckpt_name, CPD_CKPT_MAP_INFO 
**ckpt_map_node);
+SaConstStringT ckpt_name, 
CPD_CKPT_MAP_INFO **ckpt_map_node);
 void cpd_ckpt_map_node_getnext(NCS_PATRICIA_TREE *ckpt_map_tree,
-   SaNameT *ckpt_name, CPD_CKPT_MAP_INFO 
**ckpt_map_node);
+   SaConstStringT *ckpt_name, 
CPD_CKPT_MAP_INFO **ckpt_map_node);
 
 uint32_t cpd_ckpt_map_node_add(NCS_PATRICIA_TREE *ckpt_map_tree, 
CPD_CKPT_MAP_INFO *ckpt_map_node);
 uint32_t cpd_ckpt_map_node_delete(CPD_CB *cb, CPD_CKPT_MAP_INFO 
*ckpt_map_node);
diff --git a/osaf/libs/common/cpsv/include/cpd_imm.h 
b/osaf/libs/common/cpsv/include/cpd_imm.h
--- a/osaf/libs/common/cpsv/include/cpd_imm.h
+++ b/osaf/libs/common/cpsv/include/cpd_imm.h
@@ -4,7 +4,9 @@ extern SaAisErrorT cpd_imm_init(SaImmOiH
 extern void cpd_imm_reinit_bg(CPD_CB * cb);
 extern void cpd_imm_declare_implementer(SaImmOiHandleT* immOiHandle, 
SaSelectionObjectT* imm_sel_obj);
 extern SaAisErrorT create_runtime_ckpt_object(CPD_CKPT_INFO_NODE *ckpt_node, 
SaImmOiHandleT immOiHandle);
+extern SaAisErrorT delete_runtime_ckpt_object(CPD_CKPT_INFO_NODE *ckpt_node, 
SaImmOiHandleT immOiHandle);
 extern SaAisErrorT create_runtime_replica_object(CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node, SaImmOiHandleT immOiHandle);
-extern void cpd_create_association_class_dn(const SaNameT *child_dn, const 
SaNameT *parent_dn, const char *rdn_tag, SaNameT *dn);
+extern SaAisErrorT delete_runtime_replica_object(CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node, SaImmOiHandleT immOiHandle);
+extern void cpd_create_association_class_dn(const char *child_dn, const char 
*parent_dn, const char *rdn_tag, char **dn);
 extern SaAisErrorT cpd_clean_checkpoint_objects(CPD_CB *cb);
 extern SaUint32T cpd_get_scAbsenceAllowed_attr();
diff --git 

[devel] [PATCH 4 of 8] cpsv: Add new message to support extended SaNameT [#1574] v3

2016-08-18 Thread Hoang Vo
 osaf/libs/common/cpsv/cpsv_evt.c |  439 +-
 osaf/libs/common/cpsv/include/cpsv_evt.h |   10 +
 osaf/services/saf/cpsv/cpd/cpd_mds.c |   84 +-
 osaf/services/saf/cpsv/cpnd/cpnd_mds.c   |   86 +-
 4 files changed, 581 insertions(+), 38 deletions(-)


diff --git a/osaf/libs/common/cpsv/cpsv_evt.c b/osaf/libs/common/cpsv/cpsv_evt.c
--- a/osaf/libs/common/cpsv/cpsv_evt.c
+++ b/osaf/libs/common/cpsv/cpsv_evt.c
@@ -30,11 +30,14 @@
 
 #include "cpsv.h"
 #include "cpa_tmr.h"
+#include "osaf_extended_name.h"
 
 FUNC_DECLARATION(CPSV_CKPT_DATA);
 static SaCkptSectionIdT *cpsv_evt_dec_sec_id(NCS_UBAID *i_ub, uint32_t svc_id);
 static uint32_t cpsv_evt_enc_sec_id(NCS_UBAID *o_ub, SaCkptSectionIdT *sec_id);
 static void cpsv_convert_sec_id_to_string(char *sec_id_str, SaCkptSectionIdT 
*section_id);
+static uint32_t cpsv_encode_extended_name_flat(NCS_UBAID *uba, SaNameT *name);
+static uint32_t cpsv_decode_extended_name_flat(NCS_UBAID *uba, SaNameT *name);
 
 const char *cpa_evt_str[] = {
"STRING_0",
@@ -254,8 +257,8 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPND_EVT_A2ND_CKPT_OPEN:
{
CPSV_A2ND_OPEN_REQ *info = >info.cpnd.info.openReq;
-   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_OPEN(hdl=%llu, %s)",
-   info->client_hdl, info->ckpt_name.value);
+   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_OPEN_2(hdl=%llu, %s)",
+   info->client_hdl, 
osaf_extended_name_borrow(>ckpt_name));
break;
}
case CPND_EVT_A2ND_CKPT_CLOSE:
@@ -268,7 +271,7 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPND_EVT_A2ND_CKPT_UNLINK:
{
CPSV_A2ND_CKPT_UNLINK *info = 
>info.cpnd.info.ulinkReq;
-   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_UNLINK(%s)", info->ckpt_name.value);
+   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_UNLINK_2(%s)", osaf_extended_name_borrow(>ckpt_name));
break;
}
case CPND_EVT_A2ND_CKPT_RDSET:
@@ -513,12 +516,22 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPND_EVT_D2ND_CKPT_CREATE:
{
CPSV_D2ND_CKPT_CREATE *info = 
>info.cpnd.info.ckpt_create;
-   snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_CREATE(%s, create_rep=%s, active=0x%X)",
-   info->ckpt_info.ckpt_id, info->ckpt_name.value,
+   snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_CREATE_2(%s, create_rep=%s, is_act=%s, active=0x%X, 
dest_cnt=%d)",
+   info->ckpt_info.ckpt_id, 
osaf_extended_name_borrow(>ckpt_name),
info->ckpt_info.ckpt_rep_create ? "true" : 
"false",
-   
m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest));
+   info->ckpt_info.is_active_exists ? "true" : 
"false",
+   
m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest),
+   info->ckpt_info.dest_cnt);
+
+   SaCkptCheckpointCreationAttributesT *attr = 
>ckpt_info.attributes;
+   TRACE("mSecS=%lld, flags=%d, mSec=%d, mSecIdS=%lld, 
ret=%lld, ckptS=%lld", attr->maxSectionSize, 
+   attr->creationFlags, attr->maxSections, 
attr->maxSectionIdSize, attr->retentionDuration,
+   attr->checkpointSize);
+   for (int i = 0; i < info->ckpt_info.dest_cnt; i++)
+   TRACE("dest[%d] = 0x%" PRIX64 " ", i, 
info->ckpt_info.dest_list[i].dest);
break;
}
+
case CPND_EVT_D2ND_CKPT_DESTROY:
{
snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_DESTROY", evt->info.cpnd.info.ckpt_destroy.ckpt_id);
@@ -608,8 +621,8 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPND_EVT_A2ND_CKPT_LIST_UPDATE:
{
CPSV_A2ND_CKPT_LIST_UPDATE *info = 
>info.cpnd.info.ckptListUpdate;
-   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_LIST_UPDATE(hdl=%llu, %s)", 
-   info->client_hdl, info->ckpt_name.value);
+   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_LIST_UPDATE_2(hdl=%llu, %s)", 
+   info->client_hdl, 
osaf_extended_name_borrow(>ckpt_name));
break;
}
case CPND_EVT_A2ND_ARRIVAL_CB_UNREG:
@@ -813,13 +826,20 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPD_EVT_ND2D_CKPT_CREATE:
{
CPSV_ND2D_CKPT_CREATE 

[devel] [PATCH 2 of 8] cpnd: Add support for extended SaNameT [#1574] v3

2016-08-18 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd.h  |   1 +
 osaf/libs/common/cpsv/include/cpnd_cb.h   |   5 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |   3 +-
 osaf/libs/common/cpsv/include/cpsv_shm.h  |   6 +-
 osaf/services/saf/cpsv/cpnd/Makefile.am   |   1 +
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |   6 +-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  71 ++
 osaf/services/saf/cpsv/cpnd/cpnd_main.c   |   7 ++
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  83 ++
 osaf/services/saf/cpsv/cpnd/cpnd_res.c|  20 +++---
 10 files changed, 143 insertions(+), 60 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpnd.h 
b/osaf/libs/common/cpsv/include/cpnd.h
--- a/osaf/libs/common/cpsv/include/cpnd.h
+++ b/osaf/libs/common/cpsv/include/cpnd.h
@@ -34,6 +34,7 @@
 #define CPND_H
 
 #include 
+#include "osaf_extended_name.h"
 #include "ncssysf_def.h"
 #include "ncs_main_papi.h"
 #include "ncssysf_tsk.h"
diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -34,6 +34,9 @@ extern uint32_t gl_cpnd_cb_hdl;
 #define m_CPND_GIVEUP_CPND_CBncshm_give_hdl(gl_cpnd_cb_hdl)
 
 #define CPND_MAX_REPLICAS 1000
+#define CPND_MAX_REPLICA_NAME_LENGTH 255
+#define CPND_REP_NAME_MAX_CKPT_NAME_LENGTH (CPND_MAX_REPLICA_NAME_LENGTH - 32)
+
 #define CPSV_GEN_SECTION_ID_SIZE 4
 #define CPSV_WAIT_TIME  1000
 
@@ -169,7 +172,7 @@ typedef struct cpnd_all_repl_write_evt_n
 typedef struct cpnd_ckpt_node {
NCS_PATRICIA_NODE patnode;
SaCkptCheckpointHandleT ckpt_id;/* index for identifying the 
checkpoint */
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
SaCkptCheckpointCreationAttributesT create_attrib;
SaCkptCheckpointOpenFlagsT open_flags;
uint32_t ckpt_lcl_ref_cnt;
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -130,6 +130,7 @@ uint32_t cpnd_all_repl_rsp_expiry(CPND_C
 uint32_t cpnd_open_active_sync_expiry(CPND_CB *cb, CPND_TMR_INFO *tmr_info);
 void cpnd_proc_free_read_data(CPSV_EVT *evt);
 SaUint32T cpnd_get_scAbsenceAllowed_attr();
+SaUint32T cpnd_get_longDnsAllowed_attr();
 /* End cpnd_proc.c */
 
 /* File : ---  cpnd_amf.c */
@@ -163,7 +164,7 @@ void cpnd_evt_node_get(CPND_CB *cb, SaCk
 void cpnd_evt_node_getnext(CPND_CB *cb, SaCkptCheckpointHandleT lcl_ckpt_id, 
CPSV_CPND_ALL_REPL_EVT_NODE **evt_node);
 uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
-CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaNameT 
ckpt_name);
+CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT 
ckpt_name);
 CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
SaCkptSectionIdT *id, SaTimeT exp_time,
  uint32_t gen_flag);
 void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -18,6 +18,8 @@
 #ifndef CPSV_SHM_H
 #define CPSV_SHM_H
 
+#include "osaf_extended_name.h"
+
 #define MAX_CLIENTS 1000
 #define MAX_CKPTS  2000
 #define MAX_SIZE  30
@@ -29,7 +31,7 @@
 
 typedef struct cpsv_ckpt_hdr {
SaCkptCheckpointHandleT ckpt_id;/* Index for identifying the 
checkpoint */
-   SaNameT ckpt_name;
+   char ckpt_name[kOsafMaxDnLength];
SaCkptCheckpointCreationAttributesT create_attrib;
SaCkptCheckpointOpenFlagsT open_flags;
uint32_t ckpt_lcl_ref_cnt;
@@ -55,7 +57,7 @@ typedef struct cpsv_sect_hdr {
 } CPSV_SECT_HDR;
 
 typedef struct ckpt_info {
-   SaNameT ckpt_name;
+   char ckpt_name[kOsafMaxDnLength];
SaCkptCheckpointHandleT ckpt_id;
uint32_t maxSections;
SaSizeT maxSecSize;
diff --git a/osaf/services/saf/cpsv/cpnd/Makefile.am 
b/osaf/services/saf/cpsv/cpnd/Makefile.am
--- a/osaf/services/saf/cpsv/cpnd/Makefile.am
+++ b/osaf/services/saf/cpsv/cpnd/Makefile.am
@@ -26,6 +26,7 @@ osaf_execbin_PROGRAMS = osafckptnd
 osafckptnd_CPPFLAGS = \
-DSA_CLM_B01=1 \
-DNCS_CPND=1  \
+   -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/osaf/libs/common/immsv/include \
-I$(top_srcdir)/osaf/libs/common/cpsv/include
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -158,6 +158,8 @@ void cpnd_ckpt_node_destroy(CPND_CB *cb,
 
cpnd_ckpt_sec_map_destroy(_node->replica_info);
 
+   free((void 

[devel] [PATCH 3 of 8] cpa: Add support for extended SaNameT [#1574] v1

2016-08-18 Thread Hoang Vo
 osaf/libs/agents/saf/cpa/Makefile.am |   1 +
 osaf/libs/agents/saf/cpa/cpa_api.c   |  36 
 osaf/libs/agents/saf/cpa/cpa_db.c|   2 +
 osaf/libs/agents/saf/cpa/cpa_mds.c   |   2 +-
 osaf/libs/agents/saf/cpa/cpa_proc.c  |   2 +-
 osaf/libs/common/cpsv/include/cpa.h  |   1 +
 osaf/libs/common/cpsv/include/cpa_cb.h   |   2 +-
 osaf/libs/common/cpsv/include/cpa_proc.h |   2 +-
 8 files changed, 26 insertions(+), 22 deletions(-)


diff --git a/osaf/libs/agents/saf/cpa/Makefile.am 
b/osaf/libs/agents/saf/cpa/Makefile.am
--- a/osaf/libs/agents/saf/cpa/Makefile.am
+++ b/osaf/libs/agents/saf/cpa/Makefile.am
@@ -22,6 +22,7 @@ noinst_LTLIBRARIES = libcpa.la
 
 libcpa_la_CPPFLAGS = \
-DNCS_CPA=1 \
+   -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/osaf/libs/common/cpsv/include
 
diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -870,19 +870,20 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
bool locked = false;
uint32_t time_out=0;
CPA_GLOBAL_CKPT_NODE *gc_node = NULL;
+   SaConstStringT ckpt_name = NULL;

TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);
-   if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
(checkpointName->length == 0)) {
+   if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
(osaf_extended_name_length(checkpointName) == 0)) {
TRACE_4("Cpa CkptOpen Api failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
TRACE_LEAVE2("API return code = %u", rc);
return SA_AIS_ERR_INVALID_PARAM;
}
 
-   m_CPSV_SET_SANAMET(checkpointName);
+   ckpt_name = osaf_extended_name_borrow(checkpointName);
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
-if (strncmp((const char *)checkpointName->value, "safCkpt=", 8) != 0) {
+if (strncmp(ckpt_name, "safCkpt=", 8) != 0) {
 TRACE_4("Cpa CkptOpen:DN failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
TRACE_LEAVE2("API return code = %u", rc);
 return SA_AIS_ERR_INVALID_PARAM;
@@ -909,7 +910,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
 

/* Draft Validations */
-   rc = cpa_open_attr_validate(checkpointCreationAttributes, 
checkpointOpenFlags, checkpointName);
+   rc = cpa_open_attr_validate(checkpointCreationAttributes, 
checkpointOpenFlags);
if (rc != SA_AIS_OK) {
/* No need to log, already logged inside the 
cpa_open_attr_validate */
goto done;
@@ -965,7 +966,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
lc_node->cl_hdl = ckptHandle;
lc_node->open_flags = checkpointOpenFlags;
 
-   lc_node->ckpt_name = *checkpointName;
+   lc_node->ckpt_name = strdup(ckpt_name);
 
/* Add CPA_LOCAL_CKPT_NODE to lcl_ckpt_hdl_tree */
proc_rc = cpa_lcl_ckpt_node_add(>lcl_ckpt_tree, lc_node);
@@ -984,7 +985,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
evt.info.cpnd.info.openReq.client_hdl = ckptHandle;
evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl;
 
-   evt.info.cpnd.info.openReq.ckpt_name = *checkpointName;
+   osaf_extended_name_lend(ckpt_name, 
_name);
 
if (checkpointCreationAttributes) {
evt.info.cpnd.info.openReq.ckpt_attrib = 
*checkpointCreationAttributes;
@@ -1128,6 +1129,7 @@ gl_node_add_fail:
 
  lc_node_add_fail:
if (lc_node != NULL) {
+   free((void *)lc_node->ckpt_name);
m_MMGR_FREE_CPA_LOCAL_CKPT_NODE(lc_node);
}
 
@@ -1179,6 +1181,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
CPA_LOCAL_CKPT_NODE *lc_node = NULL;
CPA_CLIENT_NODE *cl_node = NULL;
uint32_t proc_rc = NCSCC_RC_SUCCESS;
+   SaConstStringT ckpt_name = NULL;

TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);

@@ -1188,19 +1191,17 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
return SA_AIS_ERR_INVALID_PARAM;
}
 
-   /* Draft Validations */
-
-   m_CPSV_SET_SANAMET(checkpointName);
+   ckpt_name = osaf_extended_name_borrow(checkpointName);
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
-if (strncmp((const char *)checkpointName->value, "safCkpt=", 8) != 0) {
+if (strncmp(ckpt_name, "safCkpt=", 8) != 0) {
 TRACE_4("cpa CkptOpen:DN Api failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);

[devel] [PATCH 1 of 1] cpd: handle BAD_HANDLE from saClmDispatch [#1822]

2016-08-16 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_init.c |  67 ++-
 1 files changed, 66 insertions(+), 1 deletions(-)


Problem:
---
cpd doesn't seem to currently recover from BAD_HANDLE when calling 
saClmDispatch()
This is important if a node is promoted to a controller.

Solution:

Re-initialize CLM HANDLE

diff --git a/osaf/services/saf/cpsv/cpd/cpd_init.c 
b/osaf/services/saf/cpsv/cpd/cpd_init.c
--- a/osaf/services/saf/cpsv/cpd/cpd_init.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_init.c
@@ -61,6 +61,8 @@ static uint32_t cpd_lib_destroy(CPD_DEST
 
 static bool cpd_clear_mbx(NCSCONTEXT arg, NCSCONTEXT msg);
 
+static SaAisErrorT cpd_clm_init_bg(CPD_CB *cb);
+
 void cpd_main_process(CPD_CB *cb);
 
 /
@@ -200,6 +202,63 @@ done:
 }
 
 /
+ * Name  : cpd_clm_init_thread
+ *
+ * Description   : This function is thread function to initialize clm
+ *
+ * Arguments : -
+ *
+ * Return Values : -
+ *
+ * Notes : None.
+ */
+static void* cpd_clm_init_thread(void* arg)
+{
+   CPD_CB *cb = (CPD_CB*)arg;
+
+   TRACE_ENTER();
+
+   SaAisErrorT rc = cpd_clm_init(cb);
+   if (rc != SA_AIS_OK) {
+   exit(EXIT_FAILURE);
+   }
+
+   /* Notify main process to update clm select object */
+   ncs_sel_obj_ind((NCS_SEL_OBJ*)>clm_sel_obj);
+
+   TRACE_LEAVE();
+   return NULL;
+}
+
+/
+ * Name  : cpd_clm_init_bg
+ *
+ * Description   : This function is to start initialize clm thread
+ *
+ * Arguments : -
+ *
+ * Return Values : -
+ *
+ * Notes : None.
+ */
+static SaAisErrorT cpd_clm_init_bg(CPD_CB *cb)
+{
+   pthread_t thread;
+   pthread_attr_t attr;
+   pthread_attr_init();
+   pthread_attr_setdetachstate(, PTHREAD_CREATE_DETACHED);
+
+   if (pthread_create(, , cpd_clm_init_thread, cb) != 0) {
+   LOG_ER("pthread_create FAILED: %s", strerror(errno));
+   exit(EXIT_FAILURE);
+   }
+
+   pthread_attr_destroy();
+
+   return SA_AIS_OK;
+}
+
+/
  * Name  : cpd_lib_init
  *
  * Description   : This is the function which initalize the CPD libarary.
@@ -572,7 +631,13 @@ void cpd_main_process(CPD_CB *cb)
if (fds[FD_CLM].revents & POLLIN) {
/* dispatch all the CLM pending function */
error = saClmDispatch(cb->clm_hdl, SA_DISPATCH_ALL);
-   if (error != SA_AIS_OK) {
+   if (error == SA_AIS_ERR_BAD_HANDLE) {
+   LOG_NO("Bad CLM handle. Reinitializing.");
+   osaf_nanosleep();
+   cpd_clm_init_bg(cb);
+   /* Ignore the FD_CLM */
+   fds[FD_CLM].fd = -1;
+   } else if (error != SA_AIS_OK) {
LOG_ER("saClmDispatch failed: %u", error);
}
}

--
___
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 cpd: handle BAD_HANDLE from saClmDispatch [#1822]

2016-08-16 Thread Hoang Vo
Summary: cpd: handle BAD_HANDLE from saClmDispatch [#1822]
Review request for Trac Ticket(s): #1822
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 25bbd0d6aea119774155b8794c473d73d0dc9b2e
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 16 Aug 2016 13:21:06 +0700

cpd: handle BAD_HANDLE from saClmDispatch [#1822]

Problem:
--- cpd doesn't seem to currently recover from BAD_HANDLE when 
calling
saClmDispatch() This is important if a node is promoted to a controller.

Solution:
 Re-initialize CLM HANDLE


Complete diffstat:
--
 osaf/services/saf/cpsv/cpd/cpd_init.c |  67 
++-
 1 files changed, 66 insertions(+), 1 deletions(-)


Testing Commands:
-
Run osaftest: nosetests -sv osaftest/tests/ckpt/test_ckpt_suite.py
Run roaming SC test case: nosetests 
osaftest/tests/eriFeature/roamingSc/test_reallocation_after_headless_state.py:TestRoamingSc006.test_roamingSc006_1

Testing, Expected Results:
--
All test cases must pass

Conditions of Submission:
-
ACK from maintainer

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.


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1 of 1] cpsv: To update checkpoint user number for each node [#1669] V4

2016-08-03 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpd_cb.h   |2 +
 osaf/libs/common/cpsv/include/cpd_proc.h |3 +
 osaf/libs/common/cpsv/include/cpd_red.h  |   13 ++
 osaf/libs/common/cpsv/include/cpsv_evt.h |8 +
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   14 ++-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |8 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |   96 ---
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  148 +++
 osaf/services/saf/cpsv/cpd/cpd_red.c |   30 -
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 +--
 10 files changed, 344 insertions(+), 35 deletions(-)


Problem:
---
The saCkptCheckpointNumOpeners is not updated when a node which has a 
checkpoint client restarts.

Solution:

Currently CPD doesn't store number of user on each node. This patch updates CPD 
to update information
about users on each node for each checkpoint. When a node restarts, the CPD 
update the total number of
users for a checkpoint accordingly. This is reflected on 
saCkptCheckpointNumOpeners attribute correctly.

diff --git a/osaf/libs/common/cpsv/include/cpd_cb.h 
b/osaf/libs/common/cpsv/include/cpd_cb.h
--- a/osaf/libs/common/cpsv/include/cpd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpd_cb.h
@@ -92,6 +92,8 @@ typedef struct cpd_ckpt_info_node {
uint32_t num_users;
uint32_t num_readers;
uint32_t num_writers;
+   uint32_t node_users_cnt;
+   CPD_NODE_USER_INFO *node_users;
 
/* for imm */
SaUint32T ckpt_used_size;
diff --git a/osaf/libs/common/cpsv/include/cpd_proc.h 
b/osaf/libs/common/cpsv/include/cpd_proc.h
--- a/osaf/libs/common/cpsv/include/cpd_proc.h
+++ b/osaf/libs/common/cpsv/include/cpd_proc.h
@@ -108,5 +108,8 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
 uint32_t cpd_mbcsv_close(CPD_CB *cb);
 bool cpd_is_noncollocated_replica_present_on_payload(CPD_CB *cb, 
CPD_CKPT_INFO_NODE *ckpt_node);
 uint32_t cpd_ckpt_reploc_imm_object_delete(CPD_CB *cb,  CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node ,bool is_unlink_set);
+void cpd_proc_increase_node_user_info(CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST 
cpnd_dest, SaCkptCheckpointOpenFlagsT open_flags);
+void cpd_proc_decrease_node_user_info(CPD_CKPT_INFO_NODE *ckpt_node, MDS_DEST 
cpnd_dest, SaCkptCheckpointOpenFlagsT open_flags);
+void cpd_proc_update_user_info_when_node_down(CPD_CB *cb, NODE_ID node_id);
 uint32_t cpd_proc_ckpt_update_post(CPD_CB *cb);
 #endif
diff --git a/osaf/libs/common/cpsv/include/cpd_red.h 
b/osaf/libs/common/cpsv/include/cpd_red.h
--- a/osaf/libs/common/cpsv/include/cpd_red.h
+++ b/osaf/libs/common/cpsv/include/cpd_red.h
@@ -64,6 +64,18 @@ typedef struct cpd_a2s_ckpt_usr_info {
 
 } CPD_A2S_CKPT_USR_INFO;
 
+typedef struct cpd_a2s_ckpt_usr_info_2 {
+   SaCkptCheckpointHandleT ckpt_id;
+   uint32_t num_user;
+   uint32_t num_writer;
+   uint32_t num_reader;
+   uint32_t num_sections;
+   uint32_t ckpt_on_scxb1;
+   uint32_t ckpt_on_scxb2;
+   uint32_t node_users_cnt;
+   CPD_NODE_USER_INFO *node_list;
+} CPD_A2S_CKPT_USR_INFO_2;
+
 typedef struct cpd_mbcsv_msg {
CPD_MBCSV_MSG_TYPE type;
union {
@@ -76,6 +88,7 @@ typedef struct cpd_mbcsv_msg {
CPD_A2S_CKPT_UNLINK ckpt_ulink;
CPD_A2S_CKPT_USR_INFO usr_info;
CPSV_CKPT_DEST_INFO dest_down;
+   CPD_A2S_CKPT_USR_INFO_2 usr_info_2;
} info;
 } CPD_MBCSV_MSG;
 
diff --git a/osaf/libs/common/cpsv/include/cpsv_evt.h 
b/osaf/libs/common/cpsv/include/cpsv_evt.h
--- a/osaf/libs/common/cpsv/include/cpsv_evt.h
+++ b/osaf/libs/common/cpsv/include/cpsv_evt.h
@@ -840,6 +840,14 @@ typedef struct cpd_tmr_info {
} info;
 } CPD_TMR_INFO;
 
+typedef struct cpd_node_user_info {
+   MDS_DEST dest;
+   uint32_t num_users;
+   uint32_t num_writers;
+   uint32_t num_readers;
+   struct cpd_node_user_info *next;
+} CPD_NODE_USER_INFO;
+
 /**
  CPD Event Data Structures
  
**/
diff --git a/osaf/services/saf/cpsv/cpd/cpd_db.c 
b/osaf/services/saf/cpsv/cpd/cpd_db.c
--- a/osaf/services/saf/cpsv/cpd/cpd_db.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_db.c
@@ -137,6 +137,7 @@ uint32_t cpd_ckpt_node_delete(CPD_CB *cb
 {
uint32_t rc = NCSCC_RC_SUCCESS;
CPD_NODE_REF_INFO *nref_info, *next_info;
+   CPD_NODE_USER_INFO *node_user, *next_node_user;
 
TRACE_ENTER();
 
@@ -153,6 +154,13 @@ uint32_t cpd_ckpt_node_delete(CPD_CB *cb
nref_info = next_info;
}
 
+   node_user = ckpt_node->node_users;
+   while (node_user) {
+   next_node_user = node_user->next;
+   free(node_user);
+   node_user = next_node_user;
+   }
+
/* delete imm ckpt runtime object */
if ((cb->ha_state == SA_AMF_HA_ACTIVE) && (ckpt_node->is_unlink_set != 
true)) {
   

[devel] [PATCH 0 of 1] Review Request for cpsv: To update checkpoint user number for each node [#1669] V4

2016-08-03 Thread Hoang Vo
Summary: cpsv: To update checkpoint user number for each node [#1669] V4
Review request for Trac Ticket(s): 1669
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com; anders.wid...@ericsson.com
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 a3c955aed8fc6edab76a536b97f66369d305fc89
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Wed, 03 Aug 2016 17:20:08 +0700

cpsv: To update checkpoint user number for each node [#1669] V4

Problem:
--- The saCkptCheckpointNumOpeners is not updated when a node which 
has a
checkpoint client restarts.

Solution:
 Currently CPD doesn't store number of user on each node. This 
patch
updates CPD to update information about users on each node for each
checkpoint. When a node restarts, the CPD update the total number of 
users
for a checkpoint accordingly. This is reflected on
saCkptCheckpointNumOpeners attribute correctly.


Complete diffstat:
--
 osaf/libs/common/cpsv/include/cpd_cb.h   |2 +
 osaf/libs/common/cpsv/include/cpd_proc.h |3 ++
 osaf/libs/common/cpsv/include/cpd_red.h  |   13 +++
 osaf/libs/common/cpsv/include/cpsv_evt.h |8 +++
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   14 ++-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |8 +++
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |   96 
+++--
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  148 

 osaf/services/saf/cpsv/cpd/cpd_red.c |   30 --
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 
+
 10 files changed, 344 insertions(+), 35 deletions(-)


Testing Commands:
-
Following old test steps
For in-service update:
Start SC-1 and PL-3 in old version
Start SC-2 and PL-4 in new version
Run ckpttest on each node

Testing, Expected Results:
--
All test cases passed

Conditions of Submission:
-
ACK from maintainer

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 

[devel] [PATCH 0 of 8] Review Request for CKPT: Support DNs longer than 255 bytes [#1574]

2016-08-02 Thread Hoang Vo
Summary: CKPT: Support DNs longer than 255 bytes [#1574]
Review request for Trac Ticket(s): 1574
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
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 4d12e373df37e584ef89ab2de425da2aca605234
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpd: Add support for extended SaNameT [#1574]

changeset fff91d9209edc72d57fdaf2b7eae4f139f6e882b
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpnd: Add support for extended SaNameT v1 [#1574]

changeset 1514ff6d5f37070c5faa776409f3455d257e188d
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpa: Add support for extended SaNameT v1 [#1574]

changeset 0d2ab3645b20083a65838d666e3c0778e1e715ef
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpsv: Add new message to support extended SaNameT v1 [#1574] New 
messages
supporting extended SaNameT are introduce. Encoding and decoding 
funtions
for them are also included.

changeset 13de643d5e887f68178651ba9610c486dbfde82b
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpd: Add new mbcsv messages supporting extended SaNameT v1 [#1574] New 
MBCSV
messages supporting extended SaNameT and their encoding/decoding 
functions
are included.

changeset de69ca58258b72dc4a97f48ca2e68e9b023d0e5f
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and 
CPA
v1 [#1574]

changeset 9d469821de69d8b5252010bf3b5d04ab84b00ba9
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

ckpt: Add new test cases to verify long DN feature on CPSV v1 [#1574]

changeset 3f57a04ecd76a5449add80ea5898cc441d968103
Author: Hoang Vo <hoang.m...@dektech.com.au>
Date:   Tue, 02 Aug 2016 15:16:03 +0700

imported patch 1574_cpnd_support_recover_shm_version_0_v3.patch


Complete diffstat:
--
 osaf/libs/agents/saf/cpa/Makefile.am  |1 +
 osaf/libs/agents/saf/cpa/cpa_api.c|   68 +++---
 osaf/libs/agents/saf/cpa/cpa_db.c |2 +
 osaf/libs/agents/saf/cpa/cpa_mds.c|8 +-
 osaf/libs/agents/saf/cpa/cpa_proc.c   |2 +-
 osaf/libs/common/cpsv/cpsv_evt.c  |  505 
+--
 osaf/libs/common/cpsv/include/cpa.h   |1 +
 osaf/libs/common/cpsv/include/cpa_cb.h|2 +-
 osaf/libs/common/cpsv/include/cpa_proc.h  |2 +-
 osaf/libs/common/cpsv/include/cpd.h   |1 +
 osaf/libs/common/cpsv/include/cpd_cb.h|   17 +-
 osaf/libs/common/cpsv/include/cpd_imm.h   |4 +-
 osaf/libs/common/cpsv/include/cpd_mem.h   |   25 +++-
 osaf/libs/common/cpsv/include/cpd_proc.h  |2 +-
 osaf/libs/common/cpsv/include/cpnd.h  |1 +
 osaf/libs/common/cpsv/include/cpnd_cb.h   |5 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |3 +-
 osaf/libs/common/cpsv/include/cpsv_evt.h  |   24 +++
 osaf/libs/common/cpsv/include/cpsv_shm.h  |   24 +++-
 osaf/services/saf/cpsv/cpd/Makefile.am|1 +
 osaf/services/saf/cpsv/cpd/cpd_amf.c  |7 +-
 osaf/services/saf/cpsv/cpd/cpd_db.c   |   95 +++---
 osaf/services/saf/cpsv/cpd/cpd_evt.c  |  107 +++-
 osaf/services/saf/cpsv/cpd/cpd_imm.c  |  268 
++
 osaf/services/saf/cpsv/cpd/cpd_main.c |7 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c|   31 -
 osaf/services/saf/cpsv/cpd/cpd_mds.c  |   86 -
 osaf/services/saf/cpsv/cpd/cpd_proc.c |  184 +++--
 osaf/services/saf/cpsv/cpd/cpd_red.c  |6 +-
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c|   57 +++-
 osaf/services/saf/cpsv/cpnd/Makefile.am   |1 +
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |6 +-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  101 +++
 osaf/services/saf/cpsv/cpnd/cpnd_main.c   |7 +
 osaf/services/saf/cpsv/cpnd/cpnd_mds.c|   86 -
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |   92 +

[devel] [PATCH 6 of 8] cpsv: Apply new messages supporting extended SaNameT to CPD, CPND, and CPA v1 [#1574]

2016-08-02 Thread Hoang Vo
 osaf/libs/agents/saf/cpa/cpa_api.c  |  30 --
 osaf/libs/agents/saf/cpa/cpa_mds.c  |   6 -
 osaf/libs/common/cpsv/cpsv_evt.c|   1 +
 osaf/services/saf/cpsv/cpd/cpd_evt.c|  10 ++--
 osaf/services/saf/cpsv/cpd/cpd_mds.c|   2 +
 osaf/services/saf/cpsv/cpd/cpd_proc.c   |   6 -
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c  |  36 +---
 osaf/services/saf/cpsv/cpnd/cpnd_mds.c  |   2 +
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c |  10 ++--
 9 files changed, 84 insertions(+), 19 deletions(-)


diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -880,6 +880,10 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
@@ -981,7 +985,11 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
/* Populate & Send the Open Event to CPND */
memset(, 0, sizeof(CPSV_EVT));
evt.type = CPSV_EVT_TYPE_CPND;
-   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN;
+   if (osaf_extended_name_length(checkpointName) <= 
SA_MAX_UNEXTENDED_NAME_LENGTH) {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN;
+   } else {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN_2;
+   }
evt.info.cpnd.info.openReq.client_hdl = ckptHandle;
evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl;
 
@@ -1192,6 +1200,10 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
@@ -1277,7 +1289,11 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
/* Populate & Send the Open Event to CPND */
memset(, 0, sizeof(CPSV_EVT));
evt.type = CPSV_EVT_TYPE_CPND;
-   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN;
+   if (osaf_extended_name_length(checkpointName) <= 
SA_MAX_UNEXTENDED_NAME_LENGTH) {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN;
+   } else {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_OPEN_2;
+   }
evt.info.cpnd.info.openReq.client_hdl = ckptHandle;
evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl;
 
@@ -1597,6 +1613,10 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp
}
 
ckpt_name = osaf_extended_name_borrow(checkpointName);
+   if (strlen(ckpt_name) >= kOsafMaxDnLength) {
+   TRACE_LEAVE2("API return code = %u", SA_AIS_ERR_INVALID_PARAM);
+   return SA_AIS_ERR_INVALID_PARAM;
+   }
 
/* retrieve CPA CB */
m_CPA_RETRIEVE_CB(cb);
@@ -1635,7 +1655,11 @@ SaAisErrorT saCkptCheckpointUnlink(SaCkp
/* Populate evt.info.cpnd.info.unlinkReq & Call MDS sync Send */
memset(, 0, sizeof(CPSV_EVT));
evt.type = CPSV_EVT_TYPE_CPND;
-   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_UNLINK;
+   if (osaf_extended_name_length(checkpointName) <= 
SA_MAX_UNEXTENDED_NAME_LENGTH) {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_UNLINK;
+   } else {
+   evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_UNLINK_2;
+   }
 
osaf_extended_name_lend(ckpt_name, 
_name);
 
diff --git a/osaf/libs/agents/saf/cpa/cpa_mds.c 
b/osaf/libs/agents/saf/cpa/cpa_mds.c
--- a/osaf/libs/agents/saf/cpa/cpa_mds.c
+++ b/osaf/libs/agents/saf/cpa/cpa_mds.c
@@ -515,9 +515,13 @@ static uint32_t cpa_mds_svc_evt(CPA_CB *
   /* Populate & Send the Open Event to CPND */
   memset(, 0, sizeof(CPSV_EVT));
   evt.type = CPSV_EVT_TYPE_CPND;
-  evt.info.cpnd.type = CPND_EVT_A2ND_CKPT_LIST_UPDATE;
   evt.info.cpnd.info.ckptListUpdate.client_hdl = 
lc_node->cl_hdl; 
   osaf_extended_name_lend(lc_node->ckpt_name, 
_name);
+   if 
(osaf_extended_name_length(_name) <= 
SA_MAX_UNEXTENDED_NAME_LENGTH) {
+   evt.info.cpnd.type = 
CPND_EVT_A2ND_CKPT_LIST_UPDATE;
+   } else {
+   evt.info.cpnd.type = 
CPND_EVT_A2ND_CKPT_LIST_UPDATE_2;
+   }
 
   proc_rc = cpa_mds_msg_send(cb->cpa_mds_hdl, 

[devel] [PATCH 3 of 8] cpa: Add support for extended SaNameT v1 [#1574]

2016-08-02 Thread Hoang Vo
 osaf/libs/agents/saf/cpa/Makefile.am |   1 +
 osaf/libs/agents/saf/cpa/cpa_api.c   |  36 
 osaf/libs/agents/saf/cpa/cpa_db.c|   2 +
 osaf/libs/agents/saf/cpa/cpa_mds.c   |   2 +-
 osaf/libs/agents/saf/cpa/cpa_proc.c  |   2 +-
 osaf/libs/common/cpsv/include/cpa.h  |   1 +
 osaf/libs/common/cpsv/include/cpa_cb.h   |   2 +-
 osaf/libs/common/cpsv/include/cpa_proc.h |   2 +-
 8 files changed, 26 insertions(+), 22 deletions(-)


diff --git a/osaf/libs/agents/saf/cpa/Makefile.am 
b/osaf/libs/agents/saf/cpa/Makefile.am
--- a/osaf/libs/agents/saf/cpa/Makefile.am
+++ b/osaf/libs/agents/saf/cpa/Makefile.am
@@ -22,6 +22,7 @@ noinst_LTLIBRARIES = libcpa.la
 
 libcpa_la_CPPFLAGS = \
-DNCS_CPA=1 \
+   -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/osaf/libs/common/cpsv/include
 
diff --git a/osaf/libs/agents/saf/cpa/cpa_api.c 
b/osaf/libs/agents/saf/cpa/cpa_api.c
--- a/osaf/libs/agents/saf/cpa/cpa_api.c
+++ b/osaf/libs/agents/saf/cpa/cpa_api.c
@@ -870,19 +870,20 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
bool locked = false;
uint32_t time_out=0;
CPA_GLOBAL_CKPT_NODE *gc_node = NULL;
+   SaConstStringT ckpt_name = NULL;

TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);
-   if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
(checkpointName->length == 0)) {
+   if ((checkpointName == NULL) || (checkpointHandle == NULL) || 
(osaf_extended_name_length(checkpointName) == 0)) {
TRACE_4("Cpa CkptOpen Api failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
TRACE_LEAVE2("API return code = %u", rc);
return SA_AIS_ERR_INVALID_PARAM;
}
 
-   m_CPSV_SET_SANAMET(checkpointName);
+   ckpt_name = osaf_extended_name_borrow(checkpointName);
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
-if (strncmp((const char *)checkpointName->value, "safCkpt=", 8) != 0) {
+if (strncmp(ckpt_name, "safCkpt=", 8) != 0) {
 TRACE_4("Cpa CkptOpen:DN failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);
TRACE_LEAVE2("API return code = %u", rc);
 return SA_AIS_ERR_INVALID_PARAM;
@@ -909,7 +910,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
 

/* Draft Validations */
-   rc = cpa_open_attr_validate(checkpointCreationAttributes, 
checkpointOpenFlags, checkpointName);
+   rc = cpa_open_attr_validate(checkpointCreationAttributes, 
checkpointOpenFlags);
if (rc != SA_AIS_OK) {
/* No need to log, already logged inside the 
cpa_open_attr_validate */
goto done;
@@ -965,7 +966,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
lc_node->cl_hdl = ckptHandle;
lc_node->open_flags = checkpointOpenFlags;
 
-   lc_node->ckpt_name = *checkpointName;
+   lc_node->ckpt_name = strdup(ckpt_name);
 
/* Add CPA_LOCAL_CKPT_NODE to lcl_ckpt_hdl_tree */
proc_rc = cpa_lcl_ckpt_node_add(>lcl_ckpt_tree, lc_node);
@@ -984,7 +985,7 @@ SaAisErrorT saCkptCheckpointOpen(SaCkptH
evt.info.cpnd.info.openReq.client_hdl = ckptHandle;
evt.info.cpnd.info.openReq.lcl_ckpt_hdl = lc_node->lcl_ckpt_hdl;
 
-   evt.info.cpnd.info.openReq.ckpt_name = *checkpointName;
+   osaf_extended_name_lend(ckpt_name, 
_name);
 
if (checkpointCreationAttributes) {
evt.info.cpnd.info.openReq.ckpt_attrib = 
*checkpointCreationAttributes;
@@ -1128,6 +1129,7 @@ gl_node_add_fail:
 
  lc_node_add_fail:
if (lc_node != NULL) {
+   free((void *)lc_node->ckpt_name);
m_MMGR_FREE_CPA_LOCAL_CKPT_NODE(lc_node);
}
 
@@ -1179,6 +1181,7 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
CPA_LOCAL_CKPT_NODE *lc_node = NULL;
CPA_CLIENT_NODE *cl_node = NULL;
uint32_t proc_rc = NCSCC_RC_SUCCESS;
+   SaConstStringT ckpt_name = NULL;

TRACE_ENTER2("SaCkptCheckpointHandleT passed is %llx",ckptHandle);

@@ -1188,19 +1191,17 @@ SaAisErrorT saCkptCheckpointOpenAsync(Sa
return SA_AIS_ERR_INVALID_PARAM;
}
 
-   /* Draft Validations */
-
-   m_CPSV_SET_SANAMET(checkpointName);
+   ckpt_name = osaf_extended_name_borrow(checkpointName);
 
/* SA_AIS_ERR_INVALID_PARAM, bullet 4 in SAI-AIS-CKPT-B.02.02 
Section 3.6.1 saCkptCheckpointOpen() and 
saCkptCheckpointOpenAsync(), Return Values */
-if (strncmp((const char *)checkpointName->value, "safCkpt=", 8) != 0) {
+if (strncmp(ckpt_name, "safCkpt=", 8) != 0) {
 TRACE_4("cpa CkptOpen:DN Api failed with return 
value:%d,ckptHandle:%llx", SA_AIS_ERR_INVALID_PARAM, ckptHandle);

[devel] [PATCH 1 of 8] cpd: Add support for extended SaNameT [#1574]

2016-08-02 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpd.h  |1 +
 osaf/libs/common/cpsv/include/cpd_cb.h   |   17 +-
 osaf/libs/common/cpsv/include/cpd_imm.h  |4 +-
 osaf/libs/common/cpsv/include/cpd_mem.h  |   25 ++-
 osaf/libs/common/cpsv/include/cpd_proc.h |2 +-
 osaf/services/saf/cpsv/cpd/Makefile.am   |1 +
 osaf/services/saf/cpsv/cpd/cpd_amf.c |7 +-
 osaf/services/saf/cpsv/cpd/cpd_db.c  |   95 +-
 osaf/services/saf/cpsv/cpd/cpd_evt.c |  103 +++
 osaf/services/saf/cpsv/cpd/cpd_imm.c |  268 +-
 osaf/services/saf/cpsv/cpd/cpd_main.c|7 +
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c   |9 +-
 osaf/services/saf/cpsv/cpd/cpd_proc.c|  178 ++--
 osaf/services/saf/cpsv/cpd/cpd_red.c |6 +-
 osaf/services/saf/cpsv/cpd/cpd_sbevt.c   |   57 ++---
 15 files changed, 474 insertions(+), 306 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpd.h 
b/osaf/libs/common/cpsv/include/cpd.h
--- a/osaf/libs/common/cpsv/include/cpd.h
+++ b/osaf/libs/common/cpsv/include/cpd.h
@@ -33,6 +33,7 @@
 #ifndef CPD_H
 #define CPD_H
 
+#include "osaf_extended_name.h"
 #include "cpsv.h"
 #include "ncssysf_def.h"
 #include "ncs_main_papi.h"
diff --git a/osaf/libs/common/cpsv/include/cpd_cb.h 
b/osaf/libs/common/cpsv/include/cpd_cb.h
--- a/osaf/libs/common/cpsv/include/cpd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpd_cb.h
@@ -78,7 +78,7 @@ typedef struct cpsv_node_ref_info {
 typedef struct cpd_ckpt_info_node {
NCS_PATRICIA_NODE patnode;
SaCkptCheckpointHandleT ckpt_id;
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
uint32_t dest_cnt;
CPD_NODE_REF_INFO *node_list;
bool is_unlink_set;
@@ -123,8 +123,7 @@ typedef struct cpd_cpnd_info_node {
uint32_t timer_state;
bool ckpt_cpnd_scxb_exist;
/* for imm */
-   SaNameT node_name;
-   SaNameT ckpt_name;
+   SaConstStringT node_name;
uint32_t rep_type;
 } CPD_CPND_INFO_NODE;
 
@@ -132,15 +131,15 @@ typedef struct cpd_cpnd_info_node {
 
 typedef struct cpd_ckpt_map_info {
NCS_PATRICIA_NODE patnode;
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
SaCkptCheckpointHandleT ckpt_id;
SaCkptCheckpointCreationAttributesT attributes;
SaVersionT client_version;
 } CPD_CKPT_MAP_INFO;
 
 typedef struct cpd_rep_key_info {
-   SaNameT ckpt_name;
-   SaNameT node_name;
+  SaConstStringT ckpt_name;
+  SaConstStringT node_name;
 } CPD_REP_KEY_INFO;
 
 typedef struct cpd_ckpt_reploc_info {
@@ -219,7 +218,7 @@ typedef struct cpd_cb_tag {
 #define CPD_CB_NULL  ((CPD_CB *)0)
 
 /* Function Declarations */
-CPD_CKPT_INFO_NODE *cpd_find_add_ckpt_name(CPD_CB *cpd_cb, SaNameT ckpt_name);
+CPD_CKPT_INFO_NODE *cpd_find_add_ckpt_name(CPD_CB *cpd_cb, SaConstStringT 
ckpt_name);
 
 void cpd_free_ckpt_node(CPD_CB *gld_cb, CPD_CKPT_INFO_NODE *ckpt_info);
 
@@ -248,9 +247,9 @@ void cpd_ckpt_reploc_tree_destroy(CPD_CB
 
 uint32_t cpd_ckpt_map_tree_init(CPD_CB *cb);
 uint32_t cpd_ckpt_map_node_get(NCS_PATRICIA_TREE *ckpt_map_tree,
-SaNameT *ckpt_name, CPD_CKPT_MAP_INFO 
**ckpt_map_node);
+SaConstStringT ckpt_name, 
CPD_CKPT_MAP_INFO **ckpt_map_node);
 void cpd_ckpt_map_node_getnext(NCS_PATRICIA_TREE *ckpt_map_tree,
-   SaNameT *ckpt_name, CPD_CKPT_MAP_INFO 
**ckpt_map_node);
+   SaConstStringT *ckpt_name, 
CPD_CKPT_MAP_INFO **ckpt_map_node);
 
 uint32_t cpd_ckpt_map_node_add(NCS_PATRICIA_TREE *ckpt_map_tree, 
CPD_CKPT_MAP_INFO *ckpt_map_node);
 uint32_t cpd_ckpt_map_node_delete(CPD_CB *cb, CPD_CKPT_MAP_INFO 
*ckpt_map_node);
diff --git a/osaf/libs/common/cpsv/include/cpd_imm.h 
b/osaf/libs/common/cpsv/include/cpd_imm.h
--- a/osaf/libs/common/cpsv/include/cpd_imm.h
+++ b/osaf/libs/common/cpsv/include/cpd_imm.h
@@ -4,7 +4,9 @@ extern SaAisErrorT cpd_imm_init(SaImmOiH
 extern void cpd_imm_reinit_bg(CPD_CB * cb);
 extern void cpd_imm_declare_implementer(SaImmOiHandleT* immOiHandle, 
SaSelectionObjectT* imm_sel_obj);
 extern SaAisErrorT create_runtime_ckpt_object(CPD_CKPT_INFO_NODE *ckpt_node, 
SaImmOiHandleT immOiHandle);
+extern SaAisErrorT delete_runtime_ckpt_object(CPD_CKPT_INFO_NODE *ckpt_node, 
SaImmOiHandleT immOiHandle);
 extern SaAisErrorT create_runtime_replica_object(CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node, SaImmOiHandleT immOiHandle);
-extern void cpd_create_association_class_dn(const SaNameT *child_dn, const 
SaNameT *parent_dn, const char *rdn_tag, SaNameT *dn);
+extern SaAisErrorT delete_runtime_replica_object(CPD_CKPT_REPLOC_INFO 
*ckpt_reploc_node, SaImmOiHandleT immOiHandle);
+extern void cpd_create_association_class_dn(const char *child_dn, const char 
*parent_dn, const char *rdn_tag, char **dn);
 extern SaAisErrorT cpd_clean_checkpoint_objects(CPD_CB *cb);
 extern SaUint32T cpd_get_scAbsenceAllowed_attr();
diff --git 

[devel] [PATCH 5 of 8] cpd: Add new mbcsv messages supporting extended SaNameT v1 [#1574]

2016-08-02 Thread Hoang Vo
 osaf/services/saf/cpsv/cpd/cpd_mbcsv.c |  22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)


New MBCSV messages supporting extended SaNameT and their encoding/decoding 
functions are included.

diff --git a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c 
b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
--- a/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
+++ b/osaf/services/saf/cpsv/cpd/cpd_mbcsv.c
@@ -23,6 +23,8 @@
 **/
 
 #include "cpd.h"
+extern uint32_t cpsv_encode_extended_name(NCS_UBAID *uba, SaNameT *name);
+extern uint32_t cpsv_decode_extended_name(NCS_UBAID *uba, SaNameT *name);
 
 
/**
  * Name   : cpd_mbcsv_async_update
@@ -385,6 +387,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
TRACE_4("edu exec async create failed");
rc = NCSCC_RC_FAILURE;
}
+
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_msg->info.ckpt_create.ckpt_name); 
+
break;
 
case CPD_A2S_MSG_CKPT_UNLINK:
@@ -395,6 +400,9 @@ uint32_t cpd_mbcsv_enc_async_update(CPD_
TRACE_4("edu exec async unlink failed");
rc = NCSCC_RC_FAILURE;
}
+
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_msg->info.ckpt_ulink.ckpt_name); 
+
break;
 
case CPD_A2S_MSG_CKPT_RDSET:
@@ -573,6 +581,8 @@ uint32_t cpd_mbcsv_enc_msg_resp(CPD_CB *
TRACE_LEAVE();
return rc;
}
+   
+   cpsv_encode_extended_name(>info.encode.io_uba, 
_create.ckpt_name);
 
if (ckpt_create.dest_list)
m_MMGR_FREE_CPSV_CPND_DEST_INFO(ckpt_create.dest_list);
@@ -783,6 +793,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
rc = NCSCC_RC_FAILURE;
goto end;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_create->ckpt_name);
+
cpd_msg->type = evt_type;
cpd_msg->info.ckpt_create = *ckpt_create;
rc = cpd_process_sb_msg(cb, cpd_msg);
@@ -808,6 +821,9 @@ uint32_t cpd_mbcsv_dec_async_update(CPD_
rc = NCSCC_RC_FAILURE;
goto end;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_unlink->ckpt_name);
+
cpd_msg->type = evt_type;
cpd_msg->info.ckpt_ulink = *ckpt_unlink;
rc = cpd_process_sb_msg(cb, cpd_msg);
@@ -998,6 +1014,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB 
TRACE_LEAVE();
return rc;
}
+
+   cpsv_decode_extended_name(>info.decode.i_uba, 
_data->ckpt_name);
+
mbcsv_msg.info.ckpt_create = *ckpt_data;
proc_rc = cpd_sb_proc_ckpt_create(cb, _msg);
if (proc_rc != NCSCC_RC_SUCCESS) {
@@ -1007,6 +1026,9 @@ uint32_t cpd_mbcsv_dec_sync_resp(CPD_CB 
if (ckpt_data->dest_list)
m_MMGR_FREE_CPSV_SYS_MEMORY(ckpt_data->dest_list);
 
+   if (osaf_is_an_extended_name(_data->ckpt_name))
+   free((void 
*)osaf_extended_name_borrow(_data->ckpt_name));
+
memset(ckpt_data, 0, sizeof(CPD_A2S_CKPT_CREATE));
memset(_msg, 0, sizeof(CPD_MBCSV_MSG));
}

--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 4 of 8] cpsv: Add new message to support extended SaNameT v1 [#1574]

2016-08-02 Thread Hoang Vo
 osaf/libs/common/cpsv/cpsv_evt.c |  504 ++-
 osaf/libs/common/cpsv/include/cpsv_evt.h |   24 +
 osaf/services/saf/cpsv/cpd/cpd_mds.c |   84 -
 osaf/services/saf/cpsv/cpnd/cpnd_mds.c   |   84 -
 4 files changed, 668 insertions(+), 28 deletions(-)


New messages supporting extended SaNameT are introduce. Encoding and decoding 
funtions for them are also included.

diff --git a/osaf/libs/common/cpsv/cpsv_evt.c b/osaf/libs/common/cpsv/cpsv_evt.c
--- a/osaf/libs/common/cpsv/cpsv_evt.c
+++ b/osaf/libs/common/cpsv/cpsv_evt.c
@@ -30,11 +30,14 @@
 
 #include "cpsv.h"
 #include "cpa_tmr.h"
+#include "osaf_extended_name.h"
 
 FUNC_DECLARATION(CPSV_CKPT_DATA);
 static SaCkptSectionIdT *cpsv_evt_dec_sec_id(NCS_UBAID *i_ub, uint32_t svc_id);
 static uint32_t cpsv_evt_enc_sec_id(NCS_UBAID *o_ub, SaCkptSectionIdT *sec_id);
 static void cpsv_convert_sec_id_to_string(char *sec_id_str, SaCkptSectionIdT 
*section_id);
+static uint32_t cpsv_encode_extended_name_flat(NCS_UBAID *uba, SaNameT *name);
+static uint32_t cpsv_decode_extended_name_flat(NCS_UBAID *uba, SaNameT *name);
 
 const char *cpa_evt_str[] = {
"STRING_0",
@@ -258,6 +261,13 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
info->client_hdl, info->ckpt_name.value);
break;
}
+   case CPND_EVT_A2ND_CKPT_OPEN_2:
+   {
+   CPSV_A2ND_OPEN_REQ *info = >info.cpnd.info.openReq;
+   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_OPEN_2(hdl=%llu, %s)",
+   info->client_hdl, 
osaf_extended_name_borrow(>ckpt_name));
+   break;
+   }
case CPND_EVT_A2ND_CKPT_CLOSE:
{
CPSV_A2ND_CKPT_CLOSE *info = 
>info.cpnd.info.closeReq;
@@ -271,6 +281,12 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_UNLINK(%s)", info->ckpt_name.value);
break;
}
+   case CPND_EVT_A2ND_CKPT_UNLINK_2:
+   {
+   CPSV_A2ND_CKPT_UNLINK *info = 
>info.cpnd.info.ulinkReq;
+   snprintf(o_evt_str, len, 
"CPND_EVT_A2ND_CKPT_UNLINK_2(%s)", osaf_extended_name_borrow(>ckpt_name));
+   break;
+   }
case CPND_EVT_A2ND_CKPT_RDSET:
{
CPSV_A2ND_RDSET *info = >info.cpnd.info.rdsetReq;
@@ -513,12 +529,33 @@ char* cpsv_evt_str(CPSV_EVT *evt, char *
case CPND_EVT_D2ND_CKPT_CREATE:
{
CPSV_D2ND_CKPT_CREATE *info = 
>info.cpnd.info.ckpt_create;
-   snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_CREATE(%s, create_rep=%s, active=0x%X)",
-   info->ckpt_info.ckpt_id, info->ckpt_name.value,
+   snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_CREATE(%s, create_rep=%s, is_act=%s, active=0x%X, 
dest_cnt=%d)",
+   info->ckpt_info.ckpt_id, 
osaf_extended_name_borrow(>ckpt_name),
info->ckpt_info.ckpt_rep_create ? "true" : 
"false",
-   
m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest));
+   info->ckpt_info.is_active_exists ? "true" : 
"false",
+   
m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest),
+   info->ckpt_info.dest_cnt);
break;
}
+   case CPND_EVT_D2ND_CKPT_CREATE_2:
+   {
+   CPSV_D2ND_CKPT_CREATE *info = 
>info.cpnd.info.ckpt_create;
+   snprintf(o_evt_str, len, "[%llu] 
CPND_EVT_D2ND_CKPT_CREATE_2(%s, create_rep=%s, is_act=%s, active=0x%X, 
dest_cnt=%d)",
+   info->ckpt_info.ckpt_id, 
osaf_extended_name_borrow(>ckpt_name),
+   info->ckpt_info.ckpt_rep_create ? "true" : 
"false",
+   info->ckpt_info.is_active_exists ? "true" : 
"false",
+   
m_NCS_NODE_ID_FROM_MDS_DEST(info->ckpt_info.active_dest),
+   info->ckpt_info.dest_cnt);
+
+   SaCkptCheckpointCreationAttributesT *attr = 
>ckpt_info.attributes;
+   TRACE("mSecS=%lld, flags=%d, mSec=%d, mSecIdS=%lld, 
ret=%lld, ckptS=%lld", attr->maxSectionSize, 
+   attr->creationFlags, attr->maxSections, 
attr->maxSectionIdSize, attr->retentionDuration,
+   attr->checkpointSize);
+   for (int i = 0; i < info->ckpt_info.dest_cnt; i++)
+   TRACE("dest[%d] = 0x%" PRIX64 " ", i, 
info->ckpt_info.dest_list[i].dest);
+   break;
+

[devel] [PATCH 8 of 8] imported patch 1574_cpnd_support_recover_shm_version_0_v3.patch

2016-08-02 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpsv_shm.h |   18 +
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c  |1 -
 osaf/services/saf/cpsv/cpnd/cpnd_res.c   |  821 +++---
 3 files changed, 633 insertions(+), 207 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -74,6 +74,24 @@ typedef struct ckpt_info {
int32_t next;
 } CKPT_INFO;
 
+typedef struct ckpt_info_v0 {
+   SaNameT ckpt_name;
+   SaCkptCheckpointHandleT ckpt_id;
+   uint32_t maxSections;
+   SaSizeT maxSecSize;
+   NODE_ID node_id;
+   int32_t offset;
+   uint32_t client_bitmap;
+   int32_t is_valid;
+   uint32_t bm_offset;
+   bool is_unlink;
+   bool is_close;
+   bool cpnd_rep_create;
+   bool is_first;
+   SaTimeT close_time;
+   int32_t next;
+} CKPT_INFO_V0;
+
 typedef struct client_info {
SaCkptHandleT ckpt_app_hdl;
uint32_t ckpt_open_ref_cnt;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_proc.c
@@ -1813,7 +1813,6 @@ uint32_t cpnd_ckpt_hdr_update(CPND_CKPT_
memset(_req, '\0', sizeof(write_req));
memset(_hdr, '\0', sizeof(CPSV_CKPT_HDR));
ckpt_hdr.ckpt_id = cp_node->ckpt_id;
-   strncpy(ckpt_hdr.ckpt_name, cp_node->ckpt_name, kOsafMaxDnLength);
ckpt_hdr.create_attrib = cp_node->create_attrib;
ckpt_hdr.open_flags = cp_node->open_flags;
ckpt_hdr.is_unlink = cp_node->is_unlink;
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_res.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_res.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_res.c
@@ -40,6 +40,8 @@
 
 #define m_CPND_CKPTINFO_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO))
 
+#define m_CPND_CKPTINFO_V0_READ(ckpt_info,addr,offset) 
memcpy(_info,addr+offset,sizeof(CKPT_INFO_V0))
+
 #define m_CPND_CKPTINFO_UPDATE(addr,ckpt_info,offset) 
memcpy(addr+offset,_info,sizeof(CKPT_INFO))
 
 #define m_CPND_CKPTHDR_UPDATE(ckpt_hdr,offset)  
memcpy(offset,_hdr,sizeof(CKPT_HDR))
@@ -48,6 +50,13 @@ static uint32_t cpnd_res_ckpt_sec_add(CP
 static bool cpnd_find_exact_ckptinfo(CPND_CB *cb, CKPT_INFO *ckpt_info, 
uint32_t bitmap_offset,
 uint32_t *offset, uint32_t 
*prev_offset);
 static void cpnd_clear_ckpt_info(CPND_CB *cb, CPND_CKPT_NODE *cp_node, 
uint32_t curr_offset, uint32_t prev_offset);
+static uint32_t cpnd_restore_client_info(CPND_CB *cb, uint8_t *cli_addr);
+static uint32_t cpnd_restore_ckpt_info_v1(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
+static uint32_t cpnd_restore_ckpt_info_v0(CPND_CB *cb, uint8_t *ckpt_addr, 
SaClmNodeIdT nodeid);
+static void cpnd_destroy_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_OPEN_INFO 
*open_req);
+static void *cpnd_create_shm_cpnd_cp_info(NCS_OS_POSIX_SHM_REQ_INFO *req_info);
+static void cpnd_update_shm_cpnd_cp_info(CPND_CB *cb);
+static void cpnd_convert_cp_info_v0(CKPT_INFO_V0 *cp_info_v0, CKPT_INFO 
*cp_info);
 
 
/***
 *
  * Name   : cpnd_client_extract_bits
@@ -315,24 +324,10 @@ void cpnd_restart_update_timer(CPND_CB *
 
 void *cpnd_restart_shm_create(NCS_OS_POSIX_SHM_REQ_INFO *cpnd_open_req, 
CPND_CB *cb, SaClmNodeIdT nodeid)
 {
-   uint32_t counter = 0, count, num_bitset = 0, n_clients, rc = 
NCSCC_RC_SUCCESS, bit_position;
-   uint64_t i_offset;
-   int32_t next_offset;
-   CPND_CKPT_CLIENT_NODE *cl_node = NULL;
-   CPND_CKPT_NODE *cp_node = NULL;
-   CLIENT_INFO cl_info;
-   CLIENT_HDR cli_hdr;
-   CKPT_INFO cp_info, tmp_cp_info;
-   SaCkptHandleT client_hdl;
+   uint32_t rc = NCSCC_RC_SUCCESS;
char *buf = NULL, *buffer = NULL;
uint8_t size = 0, total_length;
GBL_SHM_PTR gbl_shm_addr = {0, 0, 0, 0, 0};
-   memset(_info, '\0', sizeof(CKPT_INFO));
-   NCS_OS_POSIX_SHM_REQ_INFO ckpt_rep_open;
-   SaTimeT presentTime, timeout = 0;
-   int64_t now, diff_time, giga_sec;
-   uint32_t max_client_hdl = 0;
-   SaTimeT tmpTime = 0;
CPND_SHM_VERSION cpnd_shm_version;
 
TRACE_ENTER();
@@ -371,18 +366,15 @@ void *cpnd_restart_shm_create(NCS_OS_POS
 
if (rc == NCSCC_RC_FAILURE) {   /* INITIALLY IT FAILS SO CREATE A 
SHARED MEMORY */
TRACE_1("cpnd comming up first time");
-   cpnd_open_req->info.open.i_flags = O_CREAT | O_RDWR;
-   rc = ncs_os_posix_shm(cpnd_open_req);
-   if (NCSCC_RC_FAILURE == rc) {
+
+   if (NULL == cpnd_create_shm_cpnd_cp_info(cpnd_open_req)) {
LOG_ER("cpnd open request fail for RDWR mode %s",buf);

[devel] [PATCH 2 of 8] cpnd: Add support for extended SaNameT v1 [#1574]

2016-08-02 Thread Hoang Vo
 osaf/libs/common/cpsv/include/cpnd.h  |   1 +
 osaf/libs/common/cpsv/include/cpnd_cb.h   |   5 +-
 osaf/libs/common/cpsv/include/cpnd_init.h |   3 +-
 osaf/libs/common/cpsv/include/cpsv_shm.h  |   6 +-
 osaf/services/saf/cpsv/cpnd/Makefile.am   |   1 +
 osaf/services/saf/cpsv/cpnd/cpnd_db.c |   6 +-
 osaf/services/saf/cpsv/cpnd/cpnd_evt.c|  71 ++
 osaf/services/saf/cpsv/cpnd/cpnd_main.c   |   7 ++
 osaf/services/saf/cpsv/cpnd/cpnd_proc.c   |  83 ++
 osaf/services/saf/cpsv/cpnd/cpnd_res.c|  20 +++---
 10 files changed, 143 insertions(+), 60 deletions(-)


diff --git a/osaf/libs/common/cpsv/include/cpnd.h 
b/osaf/libs/common/cpsv/include/cpnd.h
--- a/osaf/libs/common/cpsv/include/cpnd.h
+++ b/osaf/libs/common/cpsv/include/cpnd.h
@@ -34,6 +34,7 @@
 #define CPND_H
 
 #include 
+#include "osaf_extended_name.h"
 #include "ncssysf_def.h"
 #include "ncs_main_papi.h"
 #include "ncssysf_tsk.h"
diff --git a/osaf/libs/common/cpsv/include/cpnd_cb.h 
b/osaf/libs/common/cpsv/include/cpnd_cb.h
--- a/osaf/libs/common/cpsv/include/cpnd_cb.h
+++ b/osaf/libs/common/cpsv/include/cpnd_cb.h
@@ -34,6 +34,9 @@ extern uint32_t gl_cpnd_cb_hdl;
 #define m_CPND_GIVEUP_CPND_CBncshm_give_hdl(gl_cpnd_cb_hdl)
 
 #define CPND_MAX_REPLICAS 1000
+#define CPND_MAX_REPLICA_NAME_LENGTH 255
+#define CPND_REP_NAME_MAX_CKPT_NAME_LENGTH (CPND_MAX_REPLICA_NAME_LENGTH - 32)
+
 #define CPSV_GEN_SECTION_ID_SIZE 4
 #define CPSV_WAIT_TIME  1000
 
@@ -169,7 +172,7 @@ typedef struct cpnd_all_repl_write_evt_n
 typedef struct cpnd_ckpt_node {
NCS_PATRICIA_NODE patnode;
SaCkptCheckpointHandleT ckpt_id;/* index for identifying the 
checkpoint */
-   SaNameT ckpt_name;
+   SaConstStringT ckpt_name;
SaCkptCheckpointCreationAttributesT create_attrib;
SaCkptCheckpointOpenFlagsT open_flags;
uint32_t ckpt_lcl_ref_cnt;
diff --git a/osaf/libs/common/cpsv/include/cpnd_init.h 
b/osaf/libs/common/cpsv/include/cpnd_init.h
--- a/osaf/libs/common/cpsv/include/cpnd_init.h
+++ b/osaf/libs/common/cpsv/include/cpnd_init.h
@@ -130,6 +130,7 @@ uint32_t cpnd_all_repl_rsp_expiry(CPND_C
 uint32_t cpnd_open_active_sync_expiry(CPND_CB *cb, CPND_TMR_INFO *tmr_info);
 void cpnd_proc_free_read_data(CPSV_EVT *evt);
 SaUint32T cpnd_get_scAbsenceAllowed_attr();
+SaUint32T cpnd_get_longDnsAllowed_attr();
 /* End cpnd_proc.c */
 
 /* File : ---  cpnd_amf.c */
@@ -163,7 +164,7 @@ void cpnd_evt_node_get(CPND_CB *cb, SaCk
 void cpnd_evt_node_getnext(CPND_CB *cb, SaCkptCheckpointHandleT lcl_ckpt_id, 
CPSV_CPND_ALL_REPL_EVT_NODE **evt_node);
 uint32_t cpnd_evt_node_add(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
 uint32_t cpnd_evt_node_del(CPND_CB *cb, CPSV_CPND_ALL_REPL_EVT_NODE *evt_node);
-CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaNameT 
ckpt_name);
+CPND_CKPT_NODE *cpnd_ckpt_node_find_by_name(CPND_CB *cpnd_cb, SaConstStringT 
ckpt_name);
 CPND_CKPT_SECTION_INFO *cpnd_ckpt_sec_add(CPND_CKPT_NODE *cp_node, 
SaCkptSectionIdT *id, SaTimeT exp_time,
  uint32_t gen_flag);
 void cpnd_evt_backup_queue_add(CPND_CKPT_NODE *cp_node, CPND_EVT *evt);
diff --git a/osaf/libs/common/cpsv/include/cpsv_shm.h 
b/osaf/libs/common/cpsv/include/cpsv_shm.h
--- a/osaf/libs/common/cpsv/include/cpsv_shm.h
+++ b/osaf/libs/common/cpsv/include/cpsv_shm.h
@@ -18,6 +18,8 @@
 #ifndef CPSV_SHM_H
 #define CPSV_SHM_H
 
+#include "osaf_extended_name.h"
+
 #define MAX_CLIENTS 1000
 #define MAX_CKPTS  2000
 #define MAX_SIZE  30
@@ -29,7 +31,7 @@
 
 typedef struct cpsv_ckpt_hdr {
SaCkptCheckpointHandleT ckpt_id;/* Index for identifying the 
checkpoint */
-   SaNameT ckpt_name;
+   char ckpt_name[kOsafMaxDnLength];
SaCkptCheckpointCreationAttributesT create_attrib;
SaCkptCheckpointOpenFlagsT open_flags;
uint32_t ckpt_lcl_ref_cnt;
@@ -55,7 +57,7 @@ typedef struct cpsv_sect_hdr {
 } CPSV_SECT_HDR;
 
 typedef struct ckpt_info {
-   SaNameT ckpt_name;
+   char ckpt_name[kOsafMaxDnLength];
SaCkptCheckpointHandleT ckpt_id;
uint32_t maxSections;
SaSizeT maxSecSize;
diff --git a/osaf/services/saf/cpsv/cpnd/Makefile.am 
b/osaf/services/saf/cpsv/cpnd/Makefile.am
--- a/osaf/services/saf/cpsv/cpnd/Makefile.am
+++ b/osaf/services/saf/cpsv/cpnd/Makefile.am
@@ -26,6 +26,7 @@ osaf_execbin_PROGRAMS = osafckptnd
 osafckptnd_CPPFLAGS = \
-DSA_CLM_B01=1 \
-DNCS_CPND=1  \
+   -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-I$(top_srcdir)/osaf/libs/common/immsv/include \
-I$(top_srcdir)/osaf/libs/common/cpsv/include
diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_db.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_db.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_db.c
@@ -158,6 +158,8 @@ void cpnd_ckpt_node_destroy(CPND_CB *cb,
 
cpnd_ckpt_sec_map_destroy(_node->replica_info);
 
+   free((void