Re: [devel] [PATCH 1/1] saflogger: correct wait time of saflogger in resilience [#3198]

2020-07-12 Thread Vu Minh Nguyen
Ack with comments.

Regards, Vu


From: Thien Minh Huynh 
Sent: Friday, July 10, 2020 8:53 AM
To: Thuan Tran ; Thang Duc Nguyen 
; Vu Minh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net ; 
Thien Minh Huynh 
Subject: [PATCH 1/1] saflogger: correct wait time of saflogger in resilience 
[#3198]

When system running in resilience, if timeout of saflogger is
configured larger than logResilienceTimeout.The saflogger will
be loop forever.
[Vu] my suggestion:
When log resilient mode is enabled and timeout of saflogger is
configured larger than logResilienceTimeout , the saflogger will
be blocked forever until the underlying filesystem is responsive.

The fix is adding a time tracker between start poll and receive
SA_AIS_ERR_TRY_AGAIN, that to correct the wait time.
---
 src/log/tools/saf_logger.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/log/tools/saf_logger.c b/src/log/tools/saf_logger.c
index e9f7e9b36..ac7f832b3 100644
--- a/src/log/tools/saf_logger.c
+++ b/src/log/tools/saf_logger.c
@@ -149,6 +149,9 @@ static SaAisErrorT write_log_record(SaLogHandleT logHandle,
 struct pollfd fds[1];
 int ret;
 unsigned int wait_time = 0;
+   int64_t poll_timeout = g_timeout * 1000;
+   int64_t start_time = 0;
+   int64_t last_time = 0;
[Vu] Append suffixes of time unit after those time variables. e.g.
 int64_t poll_timeout_ms = g_timeout * 1000;

 i++;

@@ -176,8 +179,13 @@ retry:
 fds[0].fd = (int)selectionObject;
 fds[0].events = POLLIN;

+   poll_timeout -= (last_time - start_time);
+   if (poll_timeout < 0)
+   poll_timeout = 0;
+   start_time = get_current_SaTime() / 100;

+
 poll_retry:
-   ret = poll(fds, 1, g_timeout*1000);
+   ret = poll(fds, 1, poll_timeout);

 if (ret == -1 && errno == EINTR)
 goto poll_retry;
@@ -188,6 +196,10 @@ poll_retry:
 }

 if (ret == 0) {
+   if (poll_timeout < g_timeout * 1000) {
[Vu] 'g_timeout*1000' is calculated twice, consider creating a common variable.
e.g. max_poll_timeout_ms = g_timeout*1000;

+   wait_time += poll_timeout * 1000;
+   goto retry_timeout;
[Vu]
'Go to retry_timeout' is confusing me. How about the if .. else?
e.g.
if (ret == 0 && poll_timeout == g_timeout*1000) {
// poll timeout
} else if (ret == 0) {
// has re-tried sometimes but still gets failed
}

+   }
 fprintf(stderr,
 "poll timeout, message %u was most likely lost\n", i);
 return SA_AIS_ERR_BAD_OPERATION;
@@ -209,7 +221,8 @@ poll_retry:
 if (cb_error == SA_AIS_ERR_TRY_AGAIN &&
 wait_time < g_timeout*ONE_SECOND_TO_NS) {
 usleep(HUNDRED_MS);
-   wait_time += HUNDRED_MS;
+   last_time = get_current_SaTime() / 100;
+   wait_time += (last_time - start_time) * 1000;
[Vu] It may be better to name these constant variables to descriptive names
e.g.:
US_TO_NS = 1000 * 1000;
SECOND_TO_MS = 1000;


 goto retry;
 }

@@ -219,6 +232,7 @@ poll_retry:
 goto retry;
 }

+retry_timeout:
 if (cb_error != SA_AIS_OK) {
 if (wait_time)
 fprintf(stderr, "Waited for %u seconds.\n",
--
2.17.1


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


Re: [devel] [PATCH 1/1] lgs: correct inform failure to AMF [#3197]

2020-07-06 Thread Vu Minh Nguyen
Hi Thang,

I think you need to update the README for this change too.

Regards, Vu

From: thang.d.nguyen 
Sent: Thursday, July 2, 2020 2:26 PM
To: Thuan Tran ; Thien Minh Huynh 
; Minh Hon Chau 
Cc: opensaf-devel@lists.sourceforge.net 
Subject: [devel] [PATCH 1/1] lgs: correct inform failure to AMF [#3197]

Should not invoke saAmfComponentErrorReport() to AMF
before exit with failure.
In case invoking, AMF don't know how to handle it.
And logd does not start again.
---
 src/log/logd/lgs_mbcsv.cc| 16 
 src/log/logd/lgs_oi_admin.cc |  7 +++
 src/log/logd/lgs_util.cc |  4 +---
 src/log/logd/lgs_util.h  |  2 +-
 4 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index 2d1271c1c..a38f7a5d1 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -1825,7 +1825,7 @@ static uint32_t ckpt_decode_cold_sync(lgs_cb_t *cb, 
NCS_MBCSV_CB_ARG *cbk_arg) {
 done:
   if (rc != NCSCC_RC_SUCCESS) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Cold sync failed", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Cold sync failed");
   }
   TRACE_LEAVE();
   return rc;
@@ -1934,7 +1934,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
   if ((client = lgs_client_new(param->mds_dest, param->client_id,
param->stream_list)) == NULL) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Could not create new client");
   } else {
 client->client_ver = param->client_ver;
   }
@@ -1942,7 +1942,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
   /* Client with ID already exist, check other attributes */
   if (client->mds_dest != param->mds_dest) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Client attributes differ");
   }
 }
   } else if (lgs_is_peer_v6()) {
@@ -1957,7 +1957,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
   if ((client = lgs_client_new(param->mds_dest, param->client_id,
param->stream_list)) == NULL) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Could not create new client");
   } else {
 client->client_ver = param->client_ver;
   }
@@ -1965,7 +1965,7 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t *cb, 
void *data) {
   /* Client with ID already exist, check other attributes */
   if (client->mds_dest != param->mds_dest) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Client attributes differ");
   }
 }
   } else {
@@ -1980,13 +1980,13 @@ static uint32_t ckpt_proc_initialize_client(lgs_cb_t 
*cb, void *data) {
   if ((client = lgs_client_new(param->mds_dest, param->client_id,
param->stream_list)) == NULL) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Could not create new client", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Could not create new client");
   }
 } else {
   /* Client with ID already exist, check other attributes */
   if (client->mds_dest != param->mds_dest) {
 /* Do not allow standby to get out of sync */
-lgs_exit("Client attributes differ", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Client attributes differ");
   }
 }
   }
@@ -2488,7 +2488,7 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t *cb, void *data) {
 /* Do not allow standby to get out of sync */
 LOG_ER("%s - Failed to add stream '%s' to client %u", __FUNCTION__,
param->logStreamName, param->clientId);
-lgs_exit("Could not add stream to client", SA_AMF_COMPONENT_RESTART);
+lgs_exit("Could not add stream to client");
   }

   /* Stream is opened  on standby. Remove from rtobj list if exist */
diff --git a/src/log/logd/lgs_oi_admin.cc b/src/log/logd/lgs_oi_admin.cc
index 8b899219e..afbf3c5eb 100644
--- a/src/log/logd/lgs_oi_admin.cc
+++ b/src/log/logd/lgs_oi_admin.cc
@@ -343,11 +343,11 @@ static void createLogServerOi() {
  (ais_rc != SA_AIS_OK)) {
 LOG_WA("%s: Fail, OI creation timeout", __FUNCTION__);
 // The legacy behavior is to exit log service in this case
-lgs_exit("createLogServerOi() failed", SA_AMF_COMPONENT_RESTART);
+lgs_exit("createLogServerOi() failed");
   } else if (ais_rc != SA_AIS_OK) {
 LOG_WA("%s: Fail, OI creation error", __FUNCTION__);
 // The legacy behavior is to exit log service in this case
-lgs_exit("createLogServerOi() failed", 

Re: [devel] [PATCH 1/1] imm: imm_list tool add new option --delimiter [#3155]

2020-03-01 Thread Vu Minh Nguyen
Hi Phuc,

Ack with minor comments below. Thanks!

Regards, Vu


From: phuc.h.chau 
Sent: Monday, March 2, 2020 9:14 AM
To: Thang Duc Nguyen 
Cc: opensaf-devel@lists.sourceforge.net 
Subject: [devel] [PATCH 1/1] imm: imm_list tool add new option --delimiter 
[#3155]

Make delimiter of multiple attribute value from immlist configurable
Update usage --pretty-print does not work  with option -a and -c
---
 src/imm/tools/imm_list.c | 48 +++-
 1 file changed, 35 insertions(+), 13 deletions(-)

diff --git a/src/imm/tools/imm_list.c b/src/imm/tools/imm_list.c
index d1dc422..1ea31d9 100644
--- a/src/imm/tools/imm_list.c
+++ b/src/imm/tools/imm_list.c
@@ -72,6 +72,11 @@ static void usage(const char *progname)
 printf("\t-h, --help - display this help and exit\n");
 printf(
 "\t-p, --pretty-print= - select pretty print, default 
yes\n");
+   printf(
+   "\t\t--pretty-print does not work with the options -a and -c\n");
+   printf(
+   "\t-d,--delimiter= - use one  to separate values of\n");
+   printf("\t\tmultiple attribute\n");
[Vu] Use this short expression:  '... separate multiple attribute values by 
'
 printf("\t-t, --timeout \n");
 printf("\t\tutility timeout in seconds\n");

@@ -79,6 +84,7 @@ static void usage(const char *progname)
 printf("\timmlist -a saAmfApplicationAdminState safApp=OpenSAF\n");
 printf("\timmlist safApp=myApp1 safApp=myApp2\n");
 printf("\timmlist --pretty-print=no -a saAmfAppType safApp=OpenSAF\n");
+   printf("\timmlist -d \"|\" safApp=OpenSAF\n");
[Vu] The example should show the most common usage (delimiter with the option 
-a). So, use this valid expression and keep it on a single line:
printf("\timmlist -d '|' -a SaAmfNodeGroup 
safAmfNodeGroup=AllNodes,safAmfCluster=myAmfCluster\n");
  }

 static void print_attr_value_raw(SaImmValueTypeT attrValueType,
@@ -141,19 +147,19 @@ static void print_attr_value(SaImmValueTypeT 
attrValueType,
 {
 switch (attrValueType) {
 case SA_IMM_ATTR_SAINT32T:
-   printf("%d (0x%x) ", *((SaInt32T *)attrValue),
+   printf("%d (0x%x)", *((SaInt32T *)attrValue),
*((SaInt32T *)attrValue));
 break;
 case SA_IMM_ATTR_SAUINT32T:
-   printf("%u (0x%x) ", *((SaUint32T *)attrValue),
+   printf("%u (0x%x)", *((SaUint32T *)attrValue),
*((SaUint32T *)attrValue));
 break;
 case SA_IMM_ATTR_SAINT64T:
-   printf("%lld (0x%llx) ", *((SaInt64T *)attrValue),
+   printf("%lld (0x%llx)", *((SaInt64T *)attrValue),
*((SaInt64T *)attrValue));
 break;
 case SA_IMM_ATTR_SAUINT64T:
-   printf("%llu (0x%llx) ", *((SaUint64T *)attrValue),
+   printf("%llu (0x%llx)", *((SaUint64T *)attrValue),
*((SaUint64T *)attrValue));
 break;
 case SA_IMM_ATTR_SATIMET: {
@@ -163,24 +169,24 @@ static void print_attr_value(SaImmValueTypeT 
attrValueType,

 ctime_r(, buf);
 buf[strlen(buf) - 1] = '\0'; /* Remove new line */
-   printf("%llu (0x%llx, %s) ", *((SaTimeT *)attrValue),
+   printf("%llu (0x%llx, %s)", *((SaTimeT *)attrValue),
*((SaTimeT *)attrValue), buf);
 break;
 }
 case SA_IMM_ATTR_SAFLOATT:
-   printf("%.8g ", *((SaFloatT *)attrValue));
+   printf("%.8g", *((SaFloatT *)attrValue));
 break;
 case SA_IMM_ATTR_SADOUBLET:
-   printf("%.17g ", *((SaDoubleT *)attrValue));
+   printf("%.17g", *((SaDoubleT *)attrValue));
 break;
 case SA_IMM_ATTR_SANAMET: {
 SaNameT *myNameT = (SaNameT *)attrValue;
-   printf("%s (%zu) ", saAisNameBorrow(myNameT),
+   printf("%s (%zu)", saAisNameBorrow(myNameT),
strlen(saAisNameBorrow(myNameT)));
 break;
 }
 case SA_IMM_ATTR_SASTRINGT:
-   printf("%s ", *((char **)attrValue));
+   printf("%s", *((char **)attrValue));
 break;
 case SA_IMM_ATTR_SAANYT: {
 SaAnyT *anyp = (SaAnyT *)attrValue;
@@ -404,6 +410,7 @@ static void display_class_definition(const SaImmClassNameT 
className,
 static void display_object(const char *name,
SaImmAccessorHandleT accessorHandle,
int pretty_print,
+  char delimiter,
const SaImmAttrNameT *attributeNames)
 {
 int i = 0, j;
@@ -436,9 +443,12 @@ static void display_object(const char *name,
 printf("\n%-50s %-12s ", attr->attrName,

Re: [devel] [PATCH 1/1] imm: imm_list tool add new option --delimiter [#3155]

2020-02-28 Thread Vu Minh Nguyen
Hi Phuc,

See my comments inline.

Regards, Vu


From: Phuc Hoang Chau 
Sent: Friday, February 28, 2020 2:01 PM
To: Vu Minh Nguyen ; Thuan Tran 

Cc: opensaf-devel@lists.sourceforge.net ; 
Phuc Hoang Chau 
Subject: [PATCH 1/1] imm: imm_list tool add new option --delimiter [#3155]

Make delimiter of multiple attribute value from immlist configurable
Update option --pretty-print will not support print with option --atribute
[Vu] Update the usage saying --pretty-print=yes does not work with the options 
-a and -c
---
 src/imm/tools/imm_list.c | 78 +++-
 1 file changed, 64 insertions(+), 14 deletions(-)

diff --git a/src/imm/tools/imm_list.c b/src/imm/tools/imm_list.c
index d1dc422..09222de 100644
--- a/src/imm/tools/imm_list.c
+++ b/src/imm/tools/imm_list.c
@@ -72,13 +72,18 @@ static void usage(const char *progname)
 printf("\t-h, --help - display this help and exit\n");
 printf(
 "\t-p, --pretty-print= - select pretty print, default 
yes\n");
+   printf(
+   "\tdo not support pretty print with option -a, --attribute=NAME\n");
[Vu] "\t--pretty-print does not work with the options -a and -c\n");
+   printf(
+   "\t-d, --delimiter= - format multi attribute value\n");
[Vu] "\t-d,--delimiter= - use  to separate values of multiple 
attribute\n"
 printf("\t-t, --timeout \n");
 printf("\t\tutility timeout in seconds\n");

 printf("\nEXAMPLE\n");
 printf("\timmlist -a saAmfApplicationAdminState safApp=OpenSAF\n");
 printf("\timmlist safApp=myApp1 safApp=myApp2\n");
-   printf("\timmlist --pretty-print=no -a saAmfAppType safApp=OpenSAF\n");
+   printf("\timmlist --pretty-print=no safApp=OpenSAF\n");
[Vu] Keep the original line.
+   printf("\timmlist -d '|' safApp=OpenSAF\n");
 }

 static void print_attr_value_raw(SaImmValueTypeT attrValueType,
@@ -141,19 +146,19 @@ static void print_attr_value(SaImmValueTypeT 
attrValueType,
 {
 switch (attrValueType) {
 case SA_IMM_ATTR_SAINT32T:
-   printf("%d (0x%x) ", *((SaInt32T *)attrValue),
+  printf("%d (0x%x)", *((SaInt32T *)attrValue),
*((SaInt32T *)attrValue));
 break;
 case SA_IMM_ATTR_SAUINT32T:
-   printf("%u (0x%x) ", *((SaUint32T *)attrValue),
+   printf("%u (0x%x)", *((SaUint32T *)attrValue),
*((SaUint32T *)attrValue));
 break;
 case SA_IMM_ATTR_SAINT64T:
-   printf("%lld (0x%llx) ", *((SaInt64T *)attrValue),
+   printf("%lld (0x%llx)", *((SaInt64T *)attrValue),
*((SaInt64T *)attrValue));
 break;
 case SA_IMM_ATTR_SAUINT64T:
-   printf("%llu (0x%llx) ", *((SaUint64T *)attrValue),
+   printf("%llu (0x%llx)", *((SaUint64T *)attrValue),
*((SaUint64T *)attrValue));
 break;
 case SA_IMM_ATTR_SATIMET: {
@@ -163,24 +168,24 @@ static void print_attr_value(SaImmValueTypeT 
attrValueType,

 ctime_r(, buf);
 buf[strlen(buf) - 1] = '\0'; /* Remove new line */
-   printf("%llu (0x%llx, %s) ", *((SaTimeT *)attrValue),
+   printf("%llu (0x%llx, %s)", *((SaTimeT *)attrValue),
*((SaTimeT *)attrValue), buf);
 break;
 }
 case SA_IMM_ATTR_SAFLOATT:
-   printf("%.8g ", *((SaFloatT *)attrValue));
+   printf("%.8g", *((SaFloatT *)attrValue));
 break;
 case SA_IMM_ATTR_SADOUBLET:
-   printf("%.17g ", *((SaDoubleT *)attrValue));
+   printf("%.17g", *((SaDoubleT *)attrValue));
 break;
 case SA_IMM_ATTR_SANAMET: {
 SaNameT *myNameT = (SaNameT *)attrValue;
-   printf("%s (%zu) ", saAisNameBorrow(myNameT),
+   printf("%s (%zu)", saAisNameBorrow(myNameT),
strlen(saAisNameBorrow(myNameT)));
 break;
 }
 case SA_IMM_ATTR_SASTRINGT:
-   printf("%s ", *((char **)attrValue));
+   printf("%s", *((char **)attrValue));
 break;
 case SA_IMM_ATTR_SAANYT: {
 SaAnyT *anyp = (SaAnyT *)attrValue;
@@ -404,6 +409,8 @@ static void display_class_definition(const SaImmClassNameT 
className,
 static void display_object(const char *name,
SaImmAccessorHandleT accessorHandle,
int pretty_print,
+ 

Re: [devel] [PATCH 1/1] log: standby node is rebooted when nfs is unresponsive [#3161]

2020-02-27 Thread Vu Minh Nguyen
Hi Thien,

Ack.

Thanks, Vu

From: Thien Minh Huynh 
Sent: Friday, February 28, 2020 10:17 AM
To: Vu Minh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net ; 
Thien Minh Huynh 
Subject: [PATCH 1/1] log: standby node is rebooted when nfs is unresponsive 
[#3161]

Adding 3 checkpoint messages: `CkptPushAsync`, `CkptPopAsync`
and `CkptPopAndWriteAsync` into `lgsv_ckpt_msg_v9_t`

Rename file lgs_mbcsv_cache.cc,h to lgs_mbcsv_v8.cc,h
---
 src/log/Makefile.am   |  4 ++--
 src/log/logd/lgs_cache.cc |  2 +-
 src/log/logd/lgs_cache.h  |  2 +-
 src/log/logd/lgs_mbcsv.cc |  2 +-
 .../{lgs_mbcsv_cache.cc => lgs_mbcsv_v8.cc}   |  2 +-
 .../{lgs_mbcsv_cache.h => lgs_mbcsv_v8.h} |  6 +++---
 src/log/logd/lgs_mbcsv_v9.cc  | 19 +++
 src/log/logd/lgs_mbcsv_v9.h   |  4 
 8 files changed, 32 insertions(+), 9 deletions(-)
 rename src/log/logd/{lgs_mbcsv_cache.cc => lgs_mbcsv_v8.cc} (99%)
 rename src/log/logd/{lgs_mbcsv_cache.h => lgs_mbcsv_v8.h} (96%)

diff --git a/src/log/Makefile.am b/src/log/Makefile.am
index 2dad3cfb1..df061e6eb 100644
--- a/src/log/Makefile.am
+++ b/src/log/Makefile.am
@@ -98,7 +98,7 @@ noinst_HEADERS += \
 src/log/logd/lgs_common.h \
 src/log/logd/lgs_amf.h \
 src/log/logd/lgs_cache.h \
-   src/log/logd/lgs_mbcsv_cache.h
+   src/log/logd/lgs_mbcsv_v8.h


 bin_PROGRAMS += bin/saflogger
@@ -162,7 +162,7 @@ bin_osaflogd_SOURCES = \
 src/log/logd/lgs_nildest.cc \
 src/log/logd/lgs_unixsock_dest.cc \
 src/log/logd/lgs_cache.cc \
-   src/log/logd/lgs_mbcsv_cache.cc
+   src/log/logd/lgs_mbcsv_v8.cc

 bin_osaflogd_LDADD = \
 lib/libosaf_common.la \
diff --git a/src/log/logd/lgs_cache.cc b/src/log/logd/lgs_cache.cc
index 81f64225d..d6a282e48 100644
--- a/src/log/logd/lgs_cache.cc
+++ b/src/log/logd/lgs_cache.cc
@@ -18,7 +18,7 @@
 #include "log/logd/lgs_cache.h"

 #include "log/logd/lgs_dest.h"
-#include "log/logd/lgs_mbcsv_cache.h"
+#include "log/logd/lgs_mbcsv_v8.h"
 #include "log/logd/lgs_evt.h"
 #include "log/logd/lgs_evt.h"
 #include "log/logd/lgs_mbcsv.h"
diff --git a/src/log/logd/lgs_cache.h b/src/log/logd/lgs_cache.h
index 9d2d29726..a5d6181fb 100644
--- a/src/log/logd/lgs_cache.h
+++ b/src/log/logd/lgs_cache.h
@@ -26,7 +26,7 @@
 #include 

 #include "log/logd/lgs.h"
-#include "log/logd/lgs_mbcsv_cache.h"
+#include "log/logd/lgs_mbcsv_v8.h"
 #include "base/macros.h"

 // This atomic variable stores the readiness status of file hdle thread.
diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
index 7150e74dd..6ec004f0a 100644
--- a/src/log/logd/lgs_mbcsv.cc
+++ b/src/log/logd/lgs_mbcsv.cc
@@ -24,12 +24,12 @@
 #include "osaf/immutil/immutil.h"
 #include "log/logd/lgs_dest.h"
 #include "log/logd/lgs_mbcsv_v9.h"
+#include "log/logd/lgs_mbcsv_v8.h"
 #include "log/logd/lgs_mbcsv_v6.h"
 #include "log/logd/lgs_mbcsv_v5.h"
 #include "log/logd/lgs_mbcsv_v3.h"
 #include "log/logd/lgs_mbcsv_v2.h"
 #include "log/logd/lgs_mbcsv_v1.h"
-#include "log/logd/lgs_mbcsv_cache.h"
 #include "log/logd/lgs_recov.h"
 #include "log/logd/lgs_cache.h"
 /*
diff --git a/src/log/logd/lgs_mbcsv_cache.cc b/src/log/logd/lgs_mbcsv_v8.cc
similarity index 99%
rename from src/log/logd/lgs_mbcsv_cache.cc
rename to src/log/logd/lgs_mbcsv_v8.cc
index b190c5bea..289a4f610 100644
--- a/src/log/logd/lgs_mbcsv_cache.cc
+++ b/src/log/logd/lgs_mbcsv_v8.cc
@@ -15,7 +15,7 @@
  *
  */

-#include "log/logd/lgs_mbcsv_cache.h"
+#include "log/logd/lgs_mbcsv_v8.h"
 #include "log/logd/lgs_cache.h"

 uint32_t EncodeDecodePushAsync(EDU_HDL* edu_hdl, EDU_TKN* edu_tkn,
diff --git a/src/log/logd/lgs_mbcsv_cache.h b/src/log/logd/lgs_mbcsv_v8.h
similarity index 96%
rename from src/log/logd/lgs_mbcsv_cache.h
rename to src/log/logd/lgs_mbcsv_v8.h
index a6f5f440b..b07222962 100644
--- a/src/log/logd/lgs_mbcsv_cache.h
+++ b/src/log/logd/lgs_mbcsv_v8.h
@@ -15,8 +15,8 @@
  *
  */

-#ifndef LOG_LOGD_LGS_MBCSV_CACHE_H_
-#define LOG_LOGD_LGS_MBCSV_CACHE_H_
+#ifndef LOG_LOGD_LGS_MBCSV_V8_H_
+#define LOG_LOGD_LGS_MBCSV_V8_H_

 #include "log/logd/lgs_mbcsv_v2.h"
 #include "log/logd/lgs_mbcsv_v3.h"
@@ -107,4 +107,4 @@ void Dump(const CkptPushAsync* data);
 extern uint32_t test_counter;
 #endif

-#endif  // LOG_LOGD_LGS_MBCSV_CACHE_H_
+#endif  // LOG_LOGD_LGS_MBCSV_V8_H_
diff --git a/src/log/logd/lgs_mbcsv_v9.cc b/src/log/logd/lgs_mbcsv_v9.cc
index 9829ecb31..b1e2d637e 100644
--- a/src/log/logd/lgs_mbcsv_v9.cc
+++ b/src/log/logd/lgs_mbcsv_v9.cc
@@ -218,6 +218,25 @@ uint32_t edp_ed_ckpt_msg_v9(EDU_HDL *edu_hdl, EDU_TKN 
*edu_tkn, NCSCONTEXT pt

Re: [devel] [PATCH 1/1] imm: fix non-local user cannot access IMM when accessControlMode is in ENFORCED [#3043]

2020-02-23 Thread Vu Minh Nguyen
Hi Thien,

Ack with comments inline. Thanks.

Regards, Vu


From: Thien Minh Huynh 
Sent: Friday, February 21, 2020 5:09 PM
To: Thuan Tran ; Vu Minh Nguyen 

Cc: opensaf-devel@lists.sourceforge.net ; 
Thien Minh Huynh 
Subject: [PATCH 1/1] imm: fix non-local user cannot access IMM when 
accessControlMode is in ENFORCED [#3043]

---
 src/base/osaf_secutil.c   | 78 +++
 src/base/osaf_secutil.h   |  9 +
 src/imm/immnd/immnd_evt.c |  4 +-
 3 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/src/base/osaf_secutil.c b/src/base/osaf_secutil.c
index 0e175c915..a899c1a7f 100644
--- a/src/base/osaf_secutil.c
+++ b/src/base/osaf_secutil.c
@@ -42,6 +42,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include "base/osaf_poll.h"

 #include "base/logtrace.h"
@@ -184,6 +187,60 @@ static void *auth_server_main(void *_fd)
 return 0;
 }

+/**
+ * Get all supplementary groups via process ID from /proc//status
+ * @param pid: this param to get all information of process
+ * @return a string containing all group id separated by a space
+ *
+ * NOTE: The caller has to free the allocated memory returned by this function.
+ */
+static char *get_supplementary_group_list(pid_t pid)
+{
+   char process_info_path[255];
+   size_t line_buf_size = 0;
+   char *line_buf = NULL;
+   char *group_list = NULL;
[Vu] Narrow down the scope of these `life_buf` and `group_list` variable by 
putting them prior to `getline` below.
+   FILE *fd = NULL;
+
+   sprintf(process_info_path, "/proc/%d/status", pid);
+   while (true) {
+   fd = fopen(process_info_path, "r");
+   if (fd != NULL)
+   break;
+
+   if (errno != EINTR) {
+   LOG_ER("%s fopen Fail %s", __func__, strerror(errno));
+   goto done;
[Vu] Should `return NULL` here, otherwise getting undefined behavior on 
fclose(NULL).
+   }
+   }
+
+   while (getline(_buf, _buf_size, fd) != -1) {
+   const char *groups = "Groups:";
+   size_t groups_len = strlen(groups);
+   if (strncmp(line_buf, groups, groups_len) != 0)
+   continue;
+
+   // No suplementary groups.
+   if (line_buf[groups_len + 1] == '\0')
+   break;
+
+   // Exclude 'Groups:' string and a following tab
+   size_t len = strlen(line_buf) - groups_len - 1;
+   assert(len && "Invalid sumplementary group list");
+   group_list = (char *)malloc(len);
+   strcpy(group_list, line_buf + groups_len + 1);
+
+   // Remove a character 'new line' end of a string
+   group_list[len - 1] = '\0';
+   break;
+   }
+
+done:
[Vu] Remove this label.

+   free(line_buf);
+   fclose(fd);
+   return group_list;
+}
+
 /*** public interface follows*** */

 int osaf_auth_server_create(const char *pathname,
@@ -305,6 +362,27 @@ bool osaf_user_is_member_of_group(uid_t uid, const char 
*groupname)
 return false;
 }

+bool osaf_pid_is_member_of_group(pid_t pid, const char *groupname)
[Vu] Rename this function to `osaf_pid_has_supplementary_group()
+{
+   struct group *gr = getgrnam(groupname);
+   if (!gr)
[Vu] Use `if (gr == NULL)` to keep consistent with the rest
+   return false;
+
+   gid_t gid = gr->gr_gid;
+   char *group_list = get_supplementary_group_list(pid);
+   if (group_list == NULL)
+   return false;
+
+   const char *delimiter = " ";
+   char *pch = strtok(group_list, delimiter);
+   while (pch != NULL && (gid_t)atoi(pch) != gid) {
+   pch = strtok(NULL, delimiter);
+   }
+
+   free(group_list);
+   return pch != NULL;
+}
+
 /* used in libraries, do not log. Only trace */
 int osaf_auth_server_connect(const char *path, const void *req_buf,
  size_t req_size, void *resp_buf, size_t resp_size,
diff --git a/src/base/osaf_secutil.h b/src/base/osaf_secutil.h
index a2389241c..b0b5485f4 100644
--- a/src/base/osaf_secutil.h
+++ b/src/base/osaf_secutil.h
@@ -88,6 +88,15 @@ int osaf_auth_server_create(const char *_pathname,
  */
 bool osaf_user_is_member_of_group(uid_t uid, const char *groupname);

+/**
+ * Checks if user represented by pid is member of group
[Vu] Checks if the `groupname` belongs to supplementary group of the process PID
+ *
+ * @param pid
+ * @param groupname
+ * @return true if member
[Vu] @return true if `groupname` is one of the process ID's supplementary 
groups.
+ */
+bool osaf_pid_is_member_of_group(pid_t pid, const char *groupname);
+
 /**
  * Get list of groups that a user belong to
  * There already is a function in L

[devel] [PATCH 1/1] log: fix memory leak that was introduced in 3116 [#3138]

2020-01-09 Thread Vu Minh Nguyen
---
 src/log/logd/lgs_evt.cc | 3 +++
 src/log/logd/lgs_mbcsv_cache.cc | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/log/logd/lgs_evt.cc b/src/log/logd/lgs_evt.cc
index 7501a282b..f169ea1e9 100644
--- a/src/log/logd/lgs_evt.cc
+++ b/src/log/logd/lgs_evt.cc
@@ -1348,6 +1348,7 @@ static uint32_t proc_write_log_async_msg(lgs_cb_t *cb, 
lgsv_lgs_evt_t *evt) {
stream->fixedLogRecordSize, buf_size, logOutputString,
++stream->logRecordId, node_name)) == 0) {
 AckToWriteAsync(param, evt->fr_dest, SA_AIS_ERR_INVALID_PARAM);
+free(logOutputString);
 return NCSCC_RC_SUCCESS;
   }
 
@@ -1356,6 +1357,8 @@ static uint32_t proc_write_log_async_msg(lgs_cb_t *cb, 
lgsv_lgs_evt_t *evt) {
   evt->fr_dest, node_name);
   auto data = std::make_shared(info, logOutputString, n);
   Cache::instance()->Write(data);
+
+  lgs_free_write_log(param);
   return NCSCC_RC_SUCCESS;
 }
 
diff --git a/src/log/logd/lgs_mbcsv_cache.cc b/src/log/logd/lgs_mbcsv_cache.cc
index cde26432a..b190c5bea 100644
--- a/src/log/logd/lgs_mbcsv_cache.cc
+++ b/src/log/logd/lgs_mbcsv_cache.cc
@@ -230,6 +230,8 @@ uint32_t ckpt_proc_pop_write_async(lgs_cb_t* cb, void* 
data) {
   if (top->seq_id_ != seq_id) {
 LOG_ER("Out of sync! Expected seq: (%" PRIu64 "), Got: (%" PRIu64 ")",
seq_id, top->seq_id_);
+lgs_free_edu_mem(param->log_record);
+lgs_free_edu_mem(param->log_file);
 return NCSCC_RC_FAILURE;
   }
 
-- 
2.17.1



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


[devel] [PATCH 0/1] Review Request for log: fix memory leak that was introduced in 3116 [#3138]

2020-01-09 Thread Vu Minh Nguyen
Summary: log: fix memory leak that was introduced in 3116 [#3138]
Review request for Ticket(s): 3138
Peer Reviewer(s): Minh, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3138
Base revision: 6057c64887b7545077abfc29f1124fe2f7f64f29
Personal repository: git://git.code.sf.net/u/winhvu/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 740100f2ebfb5458a8052dea29b5583b3dc8df5a
Author: Vu Minh Nguyen 
Date:   Thu, 9 Jan 2020 17:06:05 +0700

log: fix memory leak that was introduced in 3116 [#3138]



Complete diffstat:
--
 src/log/logd/lgs_evt.cc | 3 +++
 src/log/logd/lgs_mbcsv_cache.cc | 2 ++
 2 files changed, 5 insertions(+)


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


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


Conditions of Submission:
-
Ack by reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 0/1] Review Request for log: fix segmentation fault in log agent [#3137] V2

2020-01-05 Thread Vu Minh Nguyen
Summary: log: fix segmentation fault in log agent [#3137]
Review request for Ticket(s): 3137
Peer Reviewer(s): Minh, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3137
Base revision: 2d863a08213b59eba559eaae6f460b5b68754dbe
Personal repository: git://git.code.sf.net/u/winhvu/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 d3b3bd1fb4bb3afe5d8252641bc68029f91b69b3
Author: Vu Minh Nguyen 
Date:   Mon, 6 Jan 2020 11:38:27 +0700

log: fix segmentation fault in log agent [#3137]

log agent did not protect the resource `unacked_invocations_ list` from
accessing by multiple threads, so caused segmentation fault.

This patch introduces a mutex in order to synchronize the access to that
common resource.



Complete diffstat:
--
 src/log/agent/lga_client.cc |  2 +-
 src/log/agent/lga_client.h  | 16 +++-
 2 files changed, 16 insertions(+), 2 deletions(-)


Testing Commands:
-
This bug is non-reproducible.


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


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] log: fix segmentation fault in log agent [#3137]

2020-01-05 Thread Vu Minh Nguyen
log agent did not protect the resource `unacked_invocations_ list` from
accessing by multiple threads, so caused segmentation fault.

This patch introduces a mutex in order to synchronize the access to that
common resource.
---
 src/log/agent/lga_client.cc |  2 +-
 src/log/agent/lga_client.h  | 16 +++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/log/agent/lga_client.cc b/src/log/agent/lga_client.cc
index cdc54904a..2eb37a0f7 100644
--- a/src/log/agent/lga_client.cc
+++ b/src/log/agent/lga_client.cc
@@ -86,7 +86,7 @@ LogClient::~LogClient() {
   }
 
   stream_list_.clear();
-  unacked_invocations_.clear();
+  CleanUnackedList();
 
   // Free the client handle allocated to this log client
   if (handle_ != 0) {
diff --git a/src/log/agent/lga_client.h b/src/log/agent/lga_client.h
index f5fa6faa4..e6e2c911e 100644
--- a/src/log/agent/lga_client.h
+++ b/src/log/agent/lga_client.h
@@ -174,13 +174,18 @@ class LogClient {
   // get acknowledgement from it.
   void KeepTrack(SaInvocationT inv, uint32_t ack_flags) {
 if (ack_flags != SA_LOG_RECORD_WRITE_ACK) return;
+base::Lock scope_lock{mutex_unacked_list_};
 unacked_invocations_.push_back(inv);
   }
 
   // Got an acknowledgment, so remove from the track list.
-  void RemoveTrack(SaInvocationT inv) { unacked_invocations_.remove(inv); }
+  void RemoveTrack(SaInvocationT inv) {
+base::Lock scope_lock{mutex_unacked_list_};
+unacked_invocations_.remove(inv);
+  }
 
   void NotifyClientAboutLostInvocations() {
+base::Lock scope_lock{mutex_unacked_list_};
 for (const auto& i : unacked_invocations_) {
   TRACE("The write async with this invocation %lld has been lost", i);
   // the below memory will be freed by lga_msg_destroy(cbk_msg)
@@ -232,6 +237,11 @@ class LogClient {
   // Invoke the registered callback
   void InvokeCallback(const lgsv_msg_t* msg);
 
+  void CleanUnackedList() {
+base::Lock scope_lock{mutex_unacked_list_};
+unacked_invocations_.clear();
+  }
+
   // Delete all messages from the mailbox
   static bool ClearMailBox(NCSCONTEXT, NCSCONTEXT);
 
@@ -290,6 +300,10 @@ class LogClient {
   // If cluster goes to headless, log agent will inform to log client with
   // SA_AIS_ERR_TRY_AGAIN code for these invocations.
   std::list unacked_invocations_{};
+
+  // To protect the `unacked_invocations_` list.
+  base::Mutex mutex_unacked_list_{};
+
   // LOG handle (derived from hdl-mngr)
   SaLogHandleT handle_;
 
-- 
2.17.1



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


[devel] [PATCH 0/1] Review Request for log: fix segmentation fault in log agent [#3137]

2020-01-05 Thread Vu Minh Nguyen
Summary: log: fix segmentation fault in log agent [#3137]
Review request for Ticket(s): 3137
Peer Reviewer(s): Gary, Minh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3137
Base revision: 2d863a08213b59eba559eaae6f460b5b68754dbe
Personal repository: git://git.code.sf.net/u/winhvu/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 184d67c1e6b896d69f9bd2cd353ae02699bcae55
Author: Vu Minh Nguyen 
Date:   Mon, 6 Jan 2020 10:12:56 +0700

log: fix segmentation fault in log agent [#3137]

log agent did not protect the resource `unacked_invocations_ list` from
accessing by multiple threads, so caused segmentation fault.

This patch introduces a mutex in order to synchronize the access to that
common resource.



Complete diffstat:
--
 src/log/agent/lga_client.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)


Testing Commands:
-
The issue is non-reproducible.


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


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] log: fix segmentation fault in log agent [#3137]

2020-01-05 Thread Vu Minh Nguyen
log agent did not protect the resource `unacked_invocations_ list` from
accessing by multiple threads, so caused segmentation fault.

This patch introduces a mutex in order to synchronize the access to that
common resource.
---
 src/log/agent/lga_client.h | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/log/agent/lga_client.h b/src/log/agent/lga_client.h
index f5fa6faa4..c999d148e 100644
--- a/src/log/agent/lga_client.h
+++ b/src/log/agent/lga_client.h
@@ -174,11 +174,15 @@ class LogClient {
   // get acknowledgement from it.
   void KeepTrack(SaInvocationT inv, uint32_t ack_flags) {
 if (ack_flags != SA_LOG_RECORD_WRITE_ACK) return;
+base::Lock scope_lock{mutex_unacked_list_};
 unacked_invocations_.push_back(inv);
   }
 
   // Got an acknowledgment, so remove from the track list.
-  void RemoveTrack(SaInvocationT inv) { unacked_invocations_.remove(inv); }
+  void RemoveTrack(SaInvocationT inv) {
+base::Lock scope_lock{mutex_unacked_list_};
+unacked_invocations_.remove(inv);
+  }
 
   void NotifyClientAboutLostInvocations() {
 for (const auto& i : unacked_invocations_) {
@@ -196,6 +200,8 @@ class LogClient {
 
   SendMsgToMbx(msg, MDS_SEND_PRIORITY_HIGH);
 }
+
+base::Lock scope_lock{mutex_unacked_list_};
 unacked_invocations_.clear();
   }
 
@@ -290,6 +296,10 @@ class LogClient {
   // If cluster goes to headless, log agent will inform to log client with
   // SA_AIS_ERR_TRY_AGAIN code for these invocations.
   std::list unacked_invocations_{};
+
+  // To protect the `unacked_invocations_` list.
+  base::Mutex mutex_unacked_list_{};
+
   // LOG handle (derived from hdl-mngr)
   SaLogHandleT handle_;
 
-- 
2.17.1



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


[devel] [PATCH 1/5] log: improve the resilience of log service [#3116]

2019-11-28 Thread Vu Minh Nguyen
In order to improve resilience of OpenSAF LOG service when underlying
file system is unresponsive, a queue is introduced to hold async
write request up to an configurable time that is around 15 - 30 seconds.

The readiness of the I/O thread will periodically check, and if it turns
to ready state, the front element will go first. Returns SA_AIS_ERR_TRY_AGAIN
to client if the element stays in the queue longer than the setting time.

The queue capacity and the resilient time are configurable via the attributes:
`logMaxPendingWriteRequests` and `logResilienceTimeout`.

In default, this feature is disabled to keep log server backward compatible.
---
 src/log/Makefile.am  |  21 +-
 src/log/config/logsv_classes.xml |  43 ++-
 src/log/logd/lgs_cache.cc| 469 +++
 src/log/logd/lgs_cache.h | 287 +++
 src/log/logd/lgs_config.cc   |  78 -
 src/log/logd/lgs_config.h|  10 +-
 src/log/logd/lgs_evt.cc  | 161 +++
 src/log/logd/lgs_evt.h   |  10 +
 src/log/logd/lgs_file.cc |   8 +-
 src/log/logd/lgs_filehdl.cc  |  58 ++--
 src/log/logd/lgs_imm.cc  |  40 ++-
 src/log/logd/lgs_main.cc |  24 +-
 src/log/logd/lgs_mbcsv.cc| 447 +++--
 src/log/logd/lgs_mbcsv.h |  19 +-
 src/log/logd/lgs_mbcsv_cache.cc  | 372 
 src/log/logd/lgs_mbcsv_cache.h   | 110 
 src/log/logd/lgs_mbcsv_v1.cc |   1 +
 src/log/logd/lgs_mbcsv_v2.cc |   2 +
 18 files changed, 1889 insertions(+), 271 deletions(-)
 create mode 100644 src/log/logd/lgs_cache.cc
 create mode 100644 src/log/logd/lgs_cache.h
 create mode 100644 src/log/logd/lgs_mbcsv_cache.cc
 create mode 100644 src/log/logd/lgs_mbcsv_cache.h

diff --git a/src/log/Makefile.am b/src/log/Makefile.am
index f63a4a053..3367ef4f6 100644
--- a/src/log/Makefile.am
+++ b/src/log/Makefile.am
@@ -95,7 +95,9 @@ noinst_HEADERS += \
src/log/logd/lgs_nildest.h \
src/log/logd/lgs_unixsock_dest.h \
src/log/logd/lgs_common.h \
-   src/log/logd/lgs_amf.h
+   src/log/logd/lgs_amf.h \
+   src/log/logd/lgs_cache.h \
+   src/log/logd/lgs_mbcsv_cache.h
 
 
 bin_PROGRAMS += bin/saflogger
@@ -123,6 +125,15 @@ bin_osaflogd_CPPFLAGS = \
-DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS)
 
+# Enable this flag to simulate the case that file system is unresponsive
+# during write log record. Mainly for testing the following enhancement:
+# log: improve the resilience of log service [#3116].
+# When enabled, log handle thread will be suspended 17 seconds every 02 write
+# requests and only take affect if the `logMaxPendingWriteRequests` is set
+# to an non-zero value.
+bin_osaflogd_CPPFLAGS += -DSIMULATE_NFS_UNRESPONSE
+
+
 bin_osaflogd_SOURCES = \
src/log/logd/lgs_amf.cc \
src/log/logd/lgs_clm.cc \
@@ -147,7 +158,9 @@ bin_osaflogd_SOURCES = \
src/log/logd/lgs_util.cc \
src/log/logd/lgs_dest.cc \
src/log/logd/lgs_nildest.cc \
-   src/log/logd/lgs_unixsock_dest.cc
+   src/log/logd/lgs_unixsock_dest.cc \
+   src/log/logd/lgs_cache.cc \
+   src/log/logd/lgs_mbcsv_cache.cc
 
 bin_osaflogd_LDADD = \
lib/libosaf_common.la \
@@ -183,6 +196,10 @@ bin_logtest_CPPFLAGS = \
-DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS)
 
+# Enable this flag to add test cases for following enhancement:
+# log: improve the resilience of log service [#3116].
+bin_logtest_CPPFLAGS += -DSIMULATE_NFS_UNRESPONSE
+
 bin_logtest_SOURCES = \
src/log/apitest/logtest.c \
src/log/apitest/logutil.c \
diff --git a/src/log/config/logsv_classes.xml b/src/log/config/logsv_classes.xml
index 9359823ff..084e8915d 100644
--- a/src/log/config/logsv_classes.xml
+++ b/src/log/config/logsv_classes.xml
@@ -195,7 +195,7 @@ to ensure that default global values in the implementation 
are also changed acco
SA_UINT32_T
SA_CONFIG
SA_WRITABLE
-1024
+   1024


logStreamFileFormat
@@ -208,42 +208,42 @@ to ensure that default global values in the 
implementation are also changed acco
SA_UINT32_T
SA_CONFIG
SA_WRITABLE
-0
+   0


logStreamSystemLowLimit
SA_UINT32_T
SA_CONFIG
SA_WRITABLE
-0
+   0


logStreamAppHighLimit
SA_UINT32_T
SA_CONFIG
SA_WRITABLE
-0
+   0


logStreamAppLowLimit
SA_UINT32_T

[devel] [PATCH 5/5] log: add test cases of improving the log resilience [#3116]

2019-11-28 Thread Vu Minh Nguyen
Adding 08 new test cases into 02 suites:
1) Suite 20 with 07 test cases, including:
- Test changing queue size & resilient timeout;
- Test if a write async is dropped if its timeout setting is overdue,
also verify if log server has kept the request in proper time.
- Test if getting write callback right away if the cache is full.
- Test if the cache is fully and correctly synced with standby.

2) Suite 21 with one test case:
Test if LOG agent notifies all lost invocation to log client.

As the suite 21 requires manual interaction, it is put into
'extended' tests. Only run with option '-e'.
---
 src/log/Makefile.am   |   3 +-
 src/log/apitest/logtest.c |   7 +
 src/log/apitest/logtest.h |   7 +-
 src/log/apitest/logutil.c |  14 +-
 src/log/apitest/tet_log_runtime_cfgobj.c  |   2 +-
 .../apitest/tet_saLogWriteLogAsync_cache.c| 648 ++
 6 files changed, 667 insertions(+), 14 deletions(-)
 create mode 100644 src/log/apitest/tet_saLogWriteLogAsync_cache.c

diff --git a/src/log/Makefile.am b/src/log/Makefile.am
index 3367ef4f6..3ec03c097 100644
--- a/src/log/Makefile.am
+++ b/src/log/Makefile.am
@@ -224,7 +224,8 @@ bin_logtest_SOURCES = \
src/log/apitest/tet_log_longDN.c \
src/log/apitest/tet_Log_clm.c \
src/log/apitest/tet_cfg_destination.c \
-   src/log/apitest/tet_multiple_thread.c
+   src/log/apitest/tet_multiple_thread.c \
+   src/log/apitest/tet_saLogWriteLogAsync_cache.c
 
 bin_logtest_LDADD = \
lib/libapitest.la \
diff --git a/src/log/apitest/logtest.c b/src/log/apitest/logtest.c
index aabd1e578..149d27d93 100644
--- a/src/log/apitest/logtest.c
+++ b/src/log/apitest/logtest.c
@@ -96,6 +96,7 @@ SaLogCallbacksT logCallbacks = {NULL, NULL, NULL};
 SaInvocationT invocation = 0;
 SaSelectionObjectT selectionObject;
 char log_root_path[PATH_MAX];
+SaLogAckFlagsT ack_flags = 0;
 
 void init_logrootpath(void)
 {
@@ -465,6 +466,9 @@ int main(int argc, char **argv)
add_suite_14();
add_suite_15();
add_suite_16();
+#ifdef SIMULATE_NFS_UNRESPONSE
+   add_suite_21();
+#endif
test_list();
exit(0);
case 'e':
@@ -493,6 +497,9 @@ int main(int argc, char **argv)
add_suite_14();
add_suite_15();
add_suite_16();
+#ifdef SIMULATE_NFS_UNRESPONSE
+   add_suite_21();
+#endif
break;
case 'v':
if (silent_flg == true) {
diff --git a/src/log/apitest/logtest.h b/src/log/apitest/logtest.h
index 68f9df608..e04492086 100644
--- a/src/log/apitest/logtest.h
+++ b/src/log/apitest/logtest.h
@@ -76,7 +76,7 @@ extern SaSelectionObjectT selectionObject;
 extern SaNameT logSvcUsrName;
 extern SaLogRecordT genLogRecord;
 extern char log_root_path[];
-
+extern SaLogAckFlagsT ack_flags;
 const static SaVersionT kLogVersion = {'A', 0x02, 0x03};
 const static SaVersionT kImmVersion = {'A', 02, 11};
 
@@ -105,6 +105,11 @@ void add_suite_12(void);
 void add_suite_14();
 void add_suite_15();
 void add_suite_16();
+
+#ifdef SIMULATE_NFS_UNRESPONSE
+void add_suite_21();
+#endif
+
 int get_active_sc(void);
 int get_attr_value(SaNameT *inObjName, char *inAttr, void *outValue);
 
diff --git a/src/log/apitest/logutil.c b/src/log/apitest/logutil.c
index 59d255515..d3e0c6297 100644
--- a/src/log/apitest/logutil.c
+++ b/src/log/apitest/logutil.c
@@ -52,15 +52,7 @@ void cond_check(void)
 int systemCall(const char *command)
 {
int rc = system(command);
-   if (rc == -1) {
-   fprintf(stderr, "system() retuned -1 Failed \n");
-   } else {
-   rc = WEXITSTATUS(rc);
-   if (rc != 0)
-   fprintf(stderr, " Failed in command: %s \n", command);
-   }
-
-   return rc;
+   return WEXITSTATUS(rc);
 }
 
 /*
@@ -144,8 +136,8 @@ logAppStreamOpen(const SaNameT *logStreamName,
  */
 SaAisErrorT logWriteAsync(const SaLogRecordT *logRecord)
 {
-   SaAisErrorT rc =
-   saLogWriteLogAsync(logStreamHandle, invocation, 0, logRecord);
+   SaAisErrorT rc = saLogWriteLogAsync(logStreamHandle, invocation,
+   ack_flags, logRecord);
unsigned int nTries = 1;
while (rc == SA_AIS_ERR_TRY_AGAIN && nTries < logProfile.nTries) {
usleep(logProfile.retryInterval * 1000);
diff --git a/src/log/apitest/tet_log_runtime_cfgobj.c 
b/src/log/apitest/tet_log_runtime_cfgobj.c
index ae83e655e..98aab7f5f 100644
--- a/src/log/apitest/tet_log_runtime_cfgobj.c
+++ b/src/log/apitest/tet_log_runtime_cfgobj.c
@@ -84,7 +84,7 @@ void log_rt_cf_obj_compare(void)
 * 1 more attribute than the configuration object
 */
r_cnt--;
-   if (c_cnt != r_cnt) {
+   if (c_cnt 

[devel] [PATCH 2/5] log: notify all lost log records when cluster goes to headless [#3116]

2019-11-28 Thread Vu Minh Nguyen
This change introduces a light list keeping all invocations that not yet
get the acknowledgement from log server. If the server is disappeared
in case of headless, log agent will notify all lost invocations to log client
with error code SA_AIS_ERR_TRY_AGAIN.
---
 src/log/agent/lga_agent.cc  |  2 ++
 src/log/agent/lga_client.cc |  8 +++-
 src/log/agent/lga_client.h  | 34 ++
 3 files changed, 43 insertions(+), 1 deletion(-)

diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
index 1000bb3fd..0049323c8 100644
--- a/src/log/agent/lga_agent.cc
+++ b/src/log/agent/lga_agent.cc
@@ -1296,6 +1296,8 @@ SaAisErrorT 
LogAgent::saLogWriteLogAsync(SaLogStreamHandleT logStreamHandle,
   if (NCSCC_RC_SUCCESS !=
   lga_mds_msg_async_send(, MDS_SEND_PRIORITY_MEDIUM)) {
 ais_rc = SA_AIS_ERR_TRY_AGAIN;
+  } else {
+client->KeepTrack(invocation, ackFlags);
   }
 
   return ais_rc;
diff --git a/src/log/agent/lga_client.cc b/src/log/agent/lga_client.cc
index 386c84929..cdc54904a 100644
--- a/src/log/agent/lga_client.cc
+++ b/src/log/agent/lga_client.cc
@@ -84,7 +84,9 @@ LogClient::~LogClient() {
   for (auto& stream : stream_list_) {
 if (stream != nullptr) delete stream;
   }
+
   stream_list_.clear();
+  unacked_invocations_.clear();
 
   // Free the client handle allocated to this log client
   if (handle_ != 0) {
@@ -129,9 +131,11 @@ void LogClient::InvokeCallback(const lgsv_msg_t* msg) {
   // Invoke the corresponding callback
   switch (cbk_info->type) {
 case LGSV_WRITE_LOG_CALLBACK_IND: {
-  if (callbacks_.saLogWriteLogCallback)
+  if (callbacks_.saLogWriteLogCallback) {
+RemoveTrack(cbk_info->inv);
 callbacks_.saLogWriteLogCallback(cbk_info->inv,
  cbk_info->write_cbk.error);
+  }
 } break;
 
 case LGSV_SEVERITY_FILTER_CALLBACK: {
@@ -395,6 +399,8 @@ void LogClient::NoLogServer() {
 // When LOG server restart from headless, Log agent will do recover them.
 stream->SetRecoveryFlag(false);
   }
+
+  NotifyClientAboutLostInvocations();
 }
 
 uint32_t LogClient::SendMsgToMbx(lgsv_msg_t* msg, MDS_SEND_PRIORITY_TYPE prio) 
{
diff --git a/src/log/agent/lga_client.h b/src/log/agent/lga_client.h
index d7060cc13..f5fa6faa4 100644
--- a/src/log/agent/lga_client.h
+++ b/src/log/agent/lga_client.h
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "base/mutex.h"
@@ -169,6 +170,35 @@ class LogClient {
 return ref_counter_object_.RestoreRefCounter(caller, value, updated);
   }
 
+  // Track the number of write requests sent to log server but not yet
+  // get acknowledgement from it.
+  void KeepTrack(SaInvocationT inv, uint32_t ack_flags) {
+if (ack_flags != SA_LOG_RECORD_WRITE_ACK) return;
+unacked_invocations_.push_back(inv);
+  }
+
+  // Got an acknowledgment, so remove from the track list.
+  void RemoveTrack(SaInvocationT inv) { unacked_invocations_.remove(inv); }
+
+  void NotifyClientAboutLostInvocations() {
+for (const auto& i : unacked_invocations_) {
+  TRACE("The write async with this invocation %lld has been lost", i);
+  // the below memory will be freed by lga_msg_destroy(cbk_msg)
+  // after done processing with this msg from the mailbox.
+  lgsv_msg_t* msg = static_cast(malloc(sizeof(lgsv_msg_t)));
+  assert(msg && "Failed to allocate memory for lgsv_msg_t");
+  memset(msg, 0, sizeof(lgsv_msg_t));
+  msg->type = LGSV_LGS_CBK_MSG;
+  msg->info.cbk_info.type = LGSV_WRITE_LOG_CALLBACK_IND;
+  msg->info.cbk_info.lgs_client_id = client_id_;
+  msg->info.cbk_info.write_cbk.error = SA_AIS_ERR_TRY_AGAIN;
+  msg->info.cbk_info.inv = i;
+
+  SendMsgToMbx(msg, MDS_SEND_PRIORITY_HIGH);
+}
+unacked_invocations_.clear();
+  }
+
   // true if the client is successfully done recovery.
   // or the client has just borned.
   // Introduce this method to avoid locking the successful recovered client
@@ -256,6 +286,10 @@ class LogClient {
   // Hold all log streams belong to @this client
   std::vector stream_list_;
 
+  // Hold all invocations that not yet get acknowledgement from log server.
+  // If cluster goes to headless, log agent will inform to log client with
+  // SA_AIS_ERR_TRY_AGAIN code for these invocations.
+  std::list unacked_invocations_{};
   // LOG handle (derived from hdl-mngr)
   SaLogHandleT handle_;
 
-- 
2.17.1



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


[devel] [PATCH 4/5] log: update README file for improvement of log resilience [#3116]

2019-11-28 Thread Vu Minh Nguyen
---
 src/log/README | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/src/log/README b/src/log/README
index b83d472e4..ab96a8157 100644
--- a/src/log/README
+++ b/src/log/README
@@ -764,3 +764,41 @@ on AMF role is unnecessary delay the CLM state of a Node
 (CLM state will available as soon as CLM started), so LGS is a taking
 AVD Up event as trigger to do CLM initialize.
  
+
+4. Improve the resilience of OpenSAF LOG service (#3116)
+-
+When the file system is unresponsive, log client gets try-again from write
+callback very shortly after I/O timeout reaches the setting; the value of I/O
+timeout is configurable via the attribute logFileIoTimeout within this valid
+range [500ms – 5000ms]. This is legacy behavior.
+
+This ticket improves the resilience of LOG service, so that log service can
+cache async write requests up to an configurable time that is around 15-30
+seconds before returning status to log client via write async callback.
+
+The cache size is configurable via a new attribute 
`logMaxPendingWriteRequests`.
+Default value is zero (0) - means this feature is disabled. The valid range is
+[current queue size - 1000]. To know what is the current size of the queue,
+fetching the value of pure runtime attribute `logCurrentPendingWriteRequests`
+of `OpenSafLogCurrentConfig` class. When the cache size reaches the limit,
+all coming requests will get acknowledgement right away with
+SA_AIS_ERR_TRY_AGAIN.
+
+The resilient timeout can also be configurable via a new attribute
+`logResilienceTimeout`. The valid range is [15-30] seconds. When a pending 
write
+async can be dropped and removed from the queue in cases:
+a) Stays in the queue longer than the given resilient timeout.
+b) The targeting stream has been closed.
+
+The queue is always kept in sync with standby.
+
+Besides, log agent has a light list keeping track all invocations which not yet
+get acknowledgements from log server. If cluster goes to headless; in other
+words, log server is disappeared and all cached data has been lost,
+log agent (library) will notify all lost invocations to log client via write
+async callback with SA_AIS_ERR_TRY_AGAIN error code.
+
+To test this feature, a gcc flag is added during compile time to simulate
+the case the underlying file system is unresponsive, and it only takes
+affect when the cache size is given to an non-zero value. With that,
+the I/O thread will sleep *16 seconds* every 02 write requests.
\ No newline at end of file
-- 
2.17.1



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


[devel] [PATCH 0/5] Review Request for log: improve the resilience of log service [#3116]

2019-11-28 Thread Vu Minh Nguyen
Summary: log: improve the resilience of log service [#3116]
Review request for Ticket(s): 3116
Peer Reviewer(s): Lennart, Gary, Minh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3116
Base revision: 8e07c19aed63c249f4e7fa8470270d2de1a56046
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 2643f8f829bb7ba638193df19cc6f20f86acb497
Author: Vu Minh Nguyen 
Date:   Thu, 28 Nov 2019 15:19:58 +0700

log: add test cases of improving the log resilience [#3116]

Adding 08 new test cases into 02 suites:
1) Suite 20 with 07 test cases, including:
- Test changing queue size & resilient timeout;
- Test if a write async is dropped if its timeout setting is overdue,
also verify if log server has kept the request in proper time.
- Test if getting write callback right away if the cache is full.
- Test if the cache is fully and correctly synced with standby.

2) Suite 21 with one test case:
Test if LOG agent notifies all lost invocation to log client.

As the suite 21 requires manual interaction, it is put into
'extended' tests. Only run with option '-e'.



revision 2a714a95f9f714684840047ae1e02d7c11bca32f
Author: Vu Minh Nguyen 
Date:   Thu, 28 Nov 2019 15:19:58 +0700

log: update README file for improvement of log resilience [#3116]



revision a103db0f56db32a1abe6f43eda7f06d48b54d469
Author: Vu Minh Nguyen 
Date:   Thu, 28 Nov 2019 15:19:58 +0700

saflogger: make timeout waiting for getting acknowledgment configurable [#3116]

Introducing a new option `-t second` or `--timeout=second` to let user input
his desired timeout of waiting for write async acknowledgment.

Default timeout is 20 seconds to keep saflogger backward compatible.



revision 54d46abd5c433ee884294ada6b277b04042f444f
Author: Vu Minh Nguyen 
Date:   Thu, 28 Nov 2019 15:19:58 +0700

log: notify all lost log records when cluster goes to headless [#3116]

This change introduces a light list keeping all invocations that not yet
get the acknowledgement from log server. If the server is disappeared
in case of headless, log agent will notify all lost invocations to log client
with error code SA_AIS_ERR_TRY_AGAIN.



revision 6260044621a2ecfad70bd5eeece3e811dc032188
Author: Vu Minh Nguyen 
Date:   Thu, 28 Nov 2019 15:19:58 +0700

log: improve the resilience of log service [#3116]

In order to improve resilience of OpenSAF LOG service when underlying
file system is unresponsive, a queue is introduced to hold async
write request up to an configurable time that is around 15 - 30 seconds.

The readiness of the I/O thread will periodically check, and if it turns
to ready state, the front element will go first. Returns SA_AIS_ERR_TRY_AGAIN
to client if the element stays in the queue longer than the setting time.

The queue capacity and the resilient time are configurable via the attributes:
`logMaxPendingWriteRequests` and `logResilienceTimeout`.

In default, this feature is disabled to keep log server backward compatible.



Added Files:

 src/log/apitest/tet_saLogWriteLogAsync_cache.c
 src/log/logd/lgs_cache.cc
 src/log/logd/lgs_cache.h
 src/log/logd/lgs_mbcsv_cache.cc
 src/log/logd/lgs_mbcsv_cache.h


Complete diffstat:
--
 src/log/Makefile.am|  24 +-
 src/log/README |  38 ++
 src/log/agent/lga_agent.cc |   2 +
 src/log/agent/lga_client.cc|   8 +-
 src/log/agent/lga_client.h |  34 ++
 src/log/apitest/logtest.c  |   7 +
 src/log/apitest/logtest.h  |   7 +-
 src/log/apitest/logutil.c  |  14 +-
 src/log/apitest/tet_log_runtime_cfgobj.c   |   2 +-
 src/log/apitest/tet_saLogWriteLogAsync_cache.c | 648 +
 src/log/config/logsv_classes.xml   |  43 +-
 src/log/logd/lgs_cache.cc  | 469 ++
 src/log/logd/lgs_cache.h   | 287 +++
 src/log/logd/lgs_config.cc |  78 ++-
 src/log/logd/lgs_config.h  |  10 +-
 src/log/logd/lgs_evt.cc| 161 ++
 src/log/logd/lgs_evt.h |  10 +
 src/log/logd/lgs_file.cc   |   8 +-
 src/log/logd/lgs_filehdl.cc|  58 +--
 src/log/l

[devel] [PATCH 0/1] Review Request for nid: fix unable to start UML cluster with tipc transport [#3122]

2019-11-24 Thread Vu Minh Nguyen
Summary: nid: fix unable to start UML cluster with tipc transport [#3122]
Review request for Ticket(s): 3122
Peer Reviewer(s): Thuan, Thien
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3122
Base revision: c6c7e77292d622ee042476bb0815feae51dd0cba
Personal repository: git://git.code.sf.net/u/winhvu/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts y
 SAF servicesn
 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 c9e55e13f42a571a109c3d5e0484c58d3791dadb
Author: Vu Minh Nguyen 
Date:   Mon, 25 Nov 2019 13:41:43 +0700

nid: fix unable to start UML cluster with tipc transport [#3122]



Complete diffstat:
--
 src/nid/configure_tipc.in | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)


Testing Commands:
-
Build UML cluster with tipc transport mode


Testing, Expected Results:
--
Cluster starts up normally


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] nid: fix unable to start UML cluster with tipc transport [#3122]

2019-11-24 Thread Vu Minh Nguyen
---
 src/nid/configure_tipc.in | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/nid/configure_tipc.in b/src/nid/configure_tipc.in
index a63c97046..43ddb06e1 100644
--- a/src/nid/configure_tipc.in
+++ b/src/nid/configure_tipc.in
@@ -221,11 +221,13 @@ function tipc_duplicate_node_detect ()
 function tipc_configure ()
 {
 echo "Inserting TIPC mdoule..."
-
-if ! test -f "$TIPC_MODULE"  ; then
-  modprobe tipc
+
+# Prefer using modprobe to insmod as modprobe takes care of
+# loading all dependencies if any. If any dependent module
+# has not yet loaded, insmod will get failed.
+if modprobe tipc ; then
   RM_TIPC_MODULE="modprobe -r tipc"
-else 
+else
   insmod "$TIPC_MODULE"
   RM_TIPC_MODULE="rmmod $TIPC_MODULE"
 fi
-- 
2.17.1



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


[devel] [PATCH 1/1] dtm: flush logtrace asap when logtrace owner is terminated [#3106]

2019-10-25 Thread Vu Minh Nguyen
To avoid the risk of losing traces, logtrace server should flush traces
as soon as possible when logtrace owner is terminated.

This patch also refactors LogServer::Run().
---
 src/dtm/transport/log_server.cc | 123 
 src/dtm/transport/log_server.h  |   7 ++
 2 files changed, 83 insertions(+), 47 deletions(-)

diff --git a/src/dtm/transport/log_server.cc b/src/dtm/transport/log_server.cc
index 201ed2695..fe27cb691 100644
--- a/src/dtm/transport/log_server.cc
+++ b/src/dtm/transport/log_server.cc
@@ -31,6 +31,15 @@
 
 const Osaflog::ClientAddressConstantPrefix LogServer::address_header_{};
 
+static bool is_pid_alive(const std::string& pid) {
+  struct stat sts;
+  const std::string proc_pid = "/proc/" + pid;
+  if (stat(proc_pid.c_str(), ) == -1 && errno == ENOENT) {
+return false;
+  }
+  return true;
+}
+
 LogServer::LogServer(int term_fd)
 : term_fd_{term_fd},
   max_backups_{9},
@@ -46,64 +55,84 @@ LogServer::LogServer(int term_fd)
 LogServer::~LogServer() {
   for (const auto& s : log_streams_) delete s.second;
   log_streams_.clear();
+  stream_pid_map_.clear();
 }
 
 void LogServer::Run() {
   struct pollfd pfd[2] = {{term_fd_, POLLIN, 0}, {log_socket_.fd(), POLLIN, 
0}};
   do {
-for (int i = 0; i < 256; ++i) {
-  char* buffer = current_stream_->current_buffer_position();
-  struct sockaddr_un src_addr;
-  socklen_t addrlen = sizeof(src_addr);
-  ssize_t result = log_socket_.RecvFrom(buffer, LogWriter::kMaxMessageSize,
-_addr, );
-  if (result < 0) break;
-  if (result == 0 || buffer[0] != '?') {
-while (result != 0 && buffer[result - 1] == '\n') --result;
-if (static_cast(result) != LogWriter::kMaxMessageSize) {
-  buffer[result++] = '\n';
-} else {
-  buffer[result - 1] = '\n';
-}
-size_t msg_id_size;
-const char* msg_id = Osaflog::GetField(buffer, result, 5, 
_id_size);
-if (msg_id == nullptr) continue;
-LogStream* stream = GetStream(msg_id, msg_id_size);
-if (stream == nullptr) continue;
-if (stream != current_stream_) {
-  memcpy(stream->current_buffer_position(), buffer, result);
-  current_stream_ = stream;
-}
-current_stream_->Write(result);
-  } else {
-ExecuteCommand(buffer, result, src_addr, addrlen);
-  }
-}
-
+ProcessRecvData();
 CloseIdleStreams();
+PeriodicFlush();
+pfd[1].fd = log_socket_.fd();
+// Use fixed timeout (30ms) in poll so that it can help to detect
+// log stream owner terminated as soon as possible.
+osaf_ppoll(pfd, 2, ::kThirtyMilliseconds, nullptr);
+  } while ((pfd[0].revents & POLLIN) == 0);
+}
 
-struct timespec current = base::ReadMonotonicClock();
-struct timespec last_flush = current;
-bool empty = true;
-for (const auto& s : log_streams_) {
-  LogStream* stream = s.second;
-  struct timespec flush = stream->last_flush();
-  if ((current - flush) >= base::kFifteenSeconds) {
-stream->Flush();
+void LogServer::ProcessRecvData() {
+  for (int i = 0; i < 256; ++i) {
+char* buffer = current_stream_->current_buffer_position();
+struct sockaddr_un src_addr;
+socklen_t addrlen = sizeof(src_addr);
+ssize_t result = log_socket_.RecvFrom(buffer, LogWriter::kMaxMessageSize,
+  _addr, );
+if (result < 0) break;
+if (result == 0 || buffer[0] != '?') {
+  while (result != 0 && buffer[result - 1] == '\n') --result;
+  if (static_cast(result) != LogWriter::kMaxMessageSize) {
+buffer[result++] = '\n';
   } else {
-if (flush < last_flush) last_flush = flush;
+buffer[result - 1] = '\n';
   }
-  if (!stream->empty()) empty = false;
+  size_t msg_id_size;
+  const char* msg_id = Osaflog::GetField(buffer, result, 5, _id_size);
+  if (msg_id == nullptr) continue;
+  LogStream* stream = GetStream(msg_id, msg_id_size);
+  if (stream == nullptr) continue;
+  stream_pid_map_[stream->name()] = ExtractPid(buffer, result);
+  if (stream != current_stream_) {
+memcpy(stream->current_buffer_position(), buffer, result);
+current_stream_ = stream;
+  }
+  current_stream_->Write(result);
+} else {
+  ExecuteCommand(buffer, result, src_addr, addrlen);
+}
+  }
+}
+
+void LogServer::PeriodicFlush() {
+  struct timespec current = base::ReadMonotonicClock();
+  for (const auto& s : log_streams_) {
+LogStream* stream = s.second;
+struct timespec flush = stream->last_flush();
+bool is_owner_alive = is_stream_owner_alive(stream->name());
+if (((current - flush) >= base::kFifteenSeconds) || !is_owner_alive) {
+  stream->Flush();
 }
-struct timespec timeout = (last_flush + base::kFifteenSeconds) - current;
-struct timespec* poll_timeout = 
-if (empty && log_streams_.size() > 1) {
- 

[devel] [PATCH 0/1] Review Request for dtm: flush logtrace asap when logtrace owner is terminated [#3106]

2019-10-25 Thread Vu Minh Nguyen
Summary: dtm: flush logtrace asap when logtrace owner is terminated [#3106]
Review request for Ticket(s): 3106
Peer Reviewer(s): Minh, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3106
Base revision: 5fe2c27d116770696710468c0ef3c88cf342a894
Personal repository: git://git.code.sf.net/u/winhvu/review


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

revision c0017b9a45f49468a60fc493eae2d62c60b3958a
Author: Vu Minh Nguyen 
Date:   Fri, 25 Oct 2019 15:19:59 +0700

dtm: flush logtrace asap when logtrace owner is terminated [#3106]

To avoid the risk of losing traces, logtrace server should flush traces
as soon as possible when logtrace owner is terminated.

This patch also refactors LogServer::Run().



Complete diffstat:
--
 src/dtm/transport/log_server.cc | 123 +---
 src/dtm/transport/log_server.h  |   7 +++
 2 files changed, 83 insertions(+), 47 deletions(-)


Testing Commands:
-
- Enable trace e.g. pkill -USR2 osafimmnd
- Flush the trace e.g. osaflog --flush osafimmnd
- Open the trace file e.g. tail -f /var/log/opensaf/osafimmnd
- Terminate logtrace owner e.g. pkill osafimmnd

Testing, Expected Results:
--
Check if the trace is flushed almost immediately 
after killing logtrace owner process.


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 0/1] Review Request for dtm: rotate logtraces on demand [#3086]

2019-10-04 Thread Vu Minh Nguyen
Summary: dtm: rotate logtraces on demand [#3086]
Review request for Ticket(s): 3086
Peer Reviewer(s): Minh, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3086
Base revision: 05064a1cfd0aeaf824dce7602d535654b3457e30
Personal repository: git://git.code.sf.net/u/winhvu/review


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

revision ccddf032be710dadf0e3218a99b74112ab2f7eb5
Author: Vu Minh Nguyen 
Date:   Fri, 4 Oct 2019 17:24:04 +0700

dtm: rotate logtraces on demand [#3086]

Introducing a new option '--rotate' to rotate given logtrace stream(s).

This patch also cleans the code of LogServer::ExecuteCommand().



Complete diffstat:
--
 src/base/log_writer.h   |   2 +-
 src/dtm/tools/osaflog.cc|  25 ++--
 src/dtm/transport/log_server.cc | 125 ++--
 src/dtm/transport/log_server.h  |  11 +++-
 4 files changed, 115 insertions(+), 48 deletions(-)


Testing Commands:
-
Call `osaflog --rotate mds.log`


Testing, Expected Results:
--
Check if mds.log is renamed to mds.log.1 in /var/log/opensaf


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] dtm: rotate logtraces on demand [#3086]

2019-10-04 Thread Vu Minh Nguyen
Introducing a new option '--rotate' to rotate given logtrace stream(s).

This patch also cleans the code of LogServer::ExecuteCommand().
---
 src/base/log_writer.h   |   2 +-
 src/dtm/tools/osaflog.cc|  25 ++-
 src/dtm/transport/log_server.cc | 125 +---
 src/dtm/transport/log_server.h  |  11 ++-
 4 files changed, 115 insertions(+), 48 deletions(-)

diff --git a/src/base/log_writer.h b/src/base/log_writer.h
index 0a03e9253..ab2bf32ae 100644
--- a/src/base/log_writer.h
+++ b/src/base/log_writer.h
@@ -45,13 +45,13 @@ class LogWriter {
   void Write(size_t size);
   void Write(const char* bytes, size_t size);
   void Flush();
+  void RotateLog();
   void SetLogFile(const std::string& log_file) { log_file_ = log_file; }
 
  private:
   constexpr static const size_t kBufferSize = 128 * size_t{1024};
   void Open();
   void Close();
-  void RotateLog();
 
   std::string log_file(size_t backup) const;
 
diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc
index 4e0956aa2..f6fa16801 100644
--- a/src/dtm/tools/osaflog.cc
+++ b/src/dtm/tools/osaflog.cc
@@ -54,6 +54,7 @@ base::UnixServerSocket* CreateSocket();
 uint64_t Random64Bits(uint64_t seed);
 bool PrettyPrint(const std::string& log_stream);
 bool Delete(const std::string& log_stream);
+bool Rotate(const std::string& log_stream);
 std::list OpenLogFiles(const std::string& log_stream);
 std::string PathName(const std::string& log_stream, int suffix);
 uint64_t GetInode(int fd);
@@ -70,6 +71,7 @@ int main(int argc, char** argv) {
   {"flush", no_argument, 0, 'f'},
   {"print", no_argument, nullptr, 'p'},
   {"delete", no_argument, nullptr, 'd'},
+  {"rotate", no_argument, nullptr, 'r'},
   {"extract-trace", required_argument, 0, 'e'},
   {"max-idle", required_argument, 0, 'i'},
   {0, 0, 0, 0}};
@@ -83,12 +85,14 @@ int main(int argc, char** argv) {
   bool flush_result =  true;
   bool print_result =  true;
   bool delete_result =  true;
+  bool rotate_result = true;
   bool max_file_size_result = true;
   bool number_of_backups_result = true;
   bool max_idle_result = true;
   bool flush_set = false;
   bool pretty_print_set = false;
   bool delete_set = false;
+  bool rotate_set = false;
   bool max_file_size_set = false;
   bool max_backups_set = false;
   bool max_idle_set = false;
@@ -101,7 +105,7 @@ int main(int argc, char** argv) {
 exit(EXIT_FAILURE);
   }
 
-  while ((option = getopt_long(argc, argv, "m:b:p:f:e:",
+  while ((option = getopt_long(argc, argv, "m:b:p:f:e:i:r",
long_options, _index)) != -1) {
 switch (option) {
   case 'p':
@@ -114,6 +118,9 @@ int main(int argc, char** argv) {
   case 'f':
 flush_set = true;
 break;
+  case 'r':
+rotate_set = true;
+break;
   case 'm':
 max_file_size = base::StrToUint64(optarg,
   _file_size_set);
@@ -164,12 +171,12 @@ int main(int argc, char** argv) {
 
   if (thread_trace) exit(ExtractTrace(input_core, output_trace));
 
-  if (argc > optind && !pretty_print_set && !delete_set) {
+  if (argc > optind && !pretty_print_set && !delete_set && !rotate_set) {
 pretty_print_set = true;
 flush_set = true;
   }
 
-  if ((argc <= optind && (pretty_print_set || delete_set)) ||
+  if ((argc <= optind && (pretty_print_set || delete_set || rotate_set)) ||
   (pretty_print_set && delete_set)) {
  PrintUsage(argv[0]);
  exit(EXIT_FAILURE);
@@ -188,6 +195,11 @@ int main(int argc, char** argv) {
   delete_result = Delete(argv[optind++]);
 }
   }
+  if (rotate_set == true) {
+while (rotate_result && optind < argc) {
+  rotate_result = Rotate(argv[optind++]);
+}
+  }
   if (max_backups_set == true) {
  number_of_backups_result = NoOfBackupFiles(max_backups);
   }
@@ -197,7 +209,7 @@ int main(int argc, char** argv) {
   if (max_idle_set == true) {
 max_idle_result = SetMaxIdleTime(max_idle);
   }
-  if (flush_result && print_result && max_file_size_result &&
+  if (flush_result && print_result && max_file_size_result && rotate_result &&
   delete_result && number_of_backups_result && max_idle_result)
  exit(EXIT_SUCCESS);
   exit(EXIT_FAILURE);
@@ -224,6 +236,7 @@ void PrintUsage(const char* program_name) {
   "--delete  Delete the specified LOGSTREAM(s) by\n"
   "  removing allocated resources in the log\n"
   "  server. Does not delete log files from 
disk.\n"
+  "--rotate  Rotate the specified LOGSTREAM(s).\n"
   "--max-file-size=SIZE  Set the maximum size of the log file to\n"
   "  SIZE bytes. The log file will be rotated\n"
  

[devel] [PATCH 1/1] dtm: close unused log streams [#2642]

2019-09-23 Thread Vu Minh Nguyen
Providing a new option '--max-idle' to configure the maximum idle time
of logtrace streams. If a stream has not been used for such time, logtrace
server will close the stream from its database.

This patch also corrects wrong indentation in osaflog.cc file.
---
 src/dtm/Makefile  |   2 +-
 src/dtm/common/osaflog_protocol.h |   2 +
 src/dtm/tools/Makefile|  18 
 src/dtm/tools/osaflog.cc  | 132 ++
 src/dtm/transport/log_server.cc   |  57 -
 src/dtm/transport/log_server.h|   7 +-
 src/dtm/transport/transportd.conf |   6 ++
 7 files changed, 168 insertions(+), 56 deletions(-)
 create mode 100644 src/dtm/tools/Makefile

diff --git a/src/dtm/Makefile b/src/dtm/Makefile
index 533b0f273..fb0221075 100644
--- a/src/dtm/Makefile
+++ b/src/dtm/Makefile
@@ -15,7 +15,7 @@
 #
 
 all:
-   $(MAKE) -C ../.. bin/osafdtmd bin/osaftransportd
+   $(MAKE) -C ../.. bin/osafdtmd bin/osaftransportd bin/osaflog
 
 check:
$(MAKE) -C ../.. bin/transport_test
diff --git a/src/dtm/common/osaflog_protocol.h 
b/src/dtm/common/osaflog_protocol.h
index 61e9f6f39..d35e5f345 100644
--- a/src/dtm/common/osaflog_protocol.h
+++ b/src/dtm/common/osaflog_protocol.h
@@ -27,6 +27,8 @@ namespace Osaflog {
 static constexpr const char* kServerSocketPath =
 PKGLOCALSTATEDIR "/osaf_log.sock";
 
+static constexpr const uint64_t kOneDayInMinute = 24*60;
+
 struct __attribute__((__packed__)) ClientAddressConstantPrefix {
   sa_family_t family = AF_UNIX;
   char abstract = '\0';
diff --git a/src/dtm/tools/Makefile b/src/dtm/tools/Makefile
new file mode 100644
index 0..8c48b70a5
--- /dev/null
+++ b/src/dtm/tools/Makefile
@@ -0,0 +1,18 @@
+#  -*- OpenSAF  -*-
+#
+# (C) Copyright 2019 The OpenSAF Foundation
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+# under the GNU Lesser General Public License Version 2.1, February 1999.
+# The complete license can be accessed from the following location:
+# http://opensource.org/licenses/lgpl-license.php
+# See the Copying file included with the OpenSAF distribution for full
+# licensing terms.
+#
+# Author(s): Ericsson AB
+#
+
+all:
+   $(MAKE) -C ../../.. bin/osaflog
diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc
index 64be253e9..abbf0b164 100644
--- a/src/dtm/tools/osaflog.cc
+++ b/src/dtm/tools/osaflog.cc
@@ -47,6 +47,7 @@ namespace {
 void PrintUsage(const char* program_name);
 bool SendCommand(const std::string& command);
 bool MaxTraceFileSize(uint64_t max_file_size);
+bool SetMaxIdleTime(uint64_t max_idle);
 bool NoOfBackupFiles(uint64_t number_of_backups);
 bool Flush();
 base::UnixServerSocket* CreateSocket();
@@ -70,10 +71,12 @@ int main(int argc, char** argv) {
   {"print", no_argument, nullptr, 'p'},
   {"delete", no_argument, nullptr, 'd'},
   {"extract-trace", required_argument, 0, 'e'},
+  {"max-idle", required_argument, 0, 'i'},
   {0, 0, 0, 0}};
 
   uint64_t max_file_size = 0;
   uint64_t max_backups = 0;
+  uint64_t max_idle = 0;
   int option = 0;
 
   int long_index = 0;
@@ -82,71 +85,81 @@ int main(int argc, char** argv) {
   bool delete_result =  true;
   bool max_file_size_result = true;
   bool number_of_backups_result = true;
+  bool max_idle_result = true;
   bool flush_set = false;
   bool pretty_print_set = false;
   bool delete_set = false;
   bool max_file_size_set = false;
   bool max_backups_set = false;
+  bool max_idle_set = false;
   bool thread_trace = false;
   std::string input_core = "";
   std::string output_trace = "";
 
   if (argc == 1) {
- PrintUsage(argv[0]);
- exit(EXIT_FAILURE);
+PrintUsage(argv[0]);
+exit(EXIT_FAILURE);
   }
 
   while ((option = getopt_long(argc, argv, "m:b:p:f:e:",
-   long_options, _index)) != -1) {
-switch (option) {
- case 'p':
-   pretty_print_set = true;
-   flush_set = true;
- break;
- case 'd':
-   delete_set = true;
- break;
- case 'f':
-   flush_set = true;
- break;
- case 'm':
-   max_file_size = base::StrToUint64(optarg,
- _file_size_set);
-   if (!max_file_size_set || max_file_size > SIZE_MAX) {
- fprintf(stderr, "Illegal max-file-size argument\n");
- exit(EXIT_FAILURE);
-   }
- break;
- case 'b':
-   max_backups = base::StrToUint64(optarg, _backups_set);
-   if 

[devel] [PATCH 0/1] Review Request for dtm: close unused log streams [#2642]

2019-09-23 Thread Vu Minh Nguyen
Summary: dtm: close unused log streams [#2642]
Review request for Ticket(s): 2642
Peer Reviewer(s): Anders, Gary, Minh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2642
Base revision: 7d6bf312c4a965e12b99c7a784a8e81cc7618a03
Personal repository: git://git.code.sf.net/u/winhvu/review


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

revision 7fe52542e82d4e9de969011d48f1c1805cb44f68
Author: Vu Minh Nguyen 
Date:   Tue, 24 Sep 2019 09:47:45 +0700

dtm: close unused log streams [#2642]

Providing a new option '--max-idle' to configure the maximum idle time
of logtrace streams. If a stream has not been used for such time, logtrace
server will close the stream from its database.

This patch also corrects wrong indentation in osaflog.cc file.



Added Files:

 src/dtm/tools/Makefile


Complete diffstat:
--
 src/dtm/Makefile  |   2 +-
 src/dtm/common/osaflog_protocol.h |   2 +
 src/dtm/tools/Makefile|  18 ++
 src/dtm/tools/osaflog.cc  | 132 +++---
 src/dtm/transport/log_server.cc   |  57 +++-
 src/dtm/transport/log_server.h|   7 +-
 src/dtm/transport/transportd.conf |   6 ++
 7 files changed, 168 insertions(+), 56 deletions(-)


Testing Commands:
-
- Enable trace of a service. e.g. pkill -USR2 osafimmnd
- Set a value to maximum idle time. e.g. osaflog --max-idle=1
- Disable trace e.g. pkill -USR2 osafimmnd
- Delete the logtrace stream using `osaflog --delete osafimmnd`


Testing, Expected Results:
--
Expect to get the printout `ERROR: osaftransportd replied 'Stream not found'`


Conditions of Submission:
-
Ack from peer reviewers



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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



___
Opensaf-dev

[devel] [PATCH 0/1] Review Request for scripts: use tipc instead of obsolute tipc-config in opensaf_reboot [#3066]

2019-08-08 Thread Vu Minh Nguyen
Summary: scripts: use tipc instead of obsolute tipc-config in opensaf_reboot 
[#3066]
Review request for Ticket(s): 3066
Peer Reviewer(s): Anders, Gary, Thang
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3066
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/winhvu/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   n
 Other   y

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 7b839ea48b0c48802a13ce2713b4b1daf9e274c0
Author: Vu Minh Nguyen 
Date:   Thu, 8 Aug 2019 11:45:41 +0700

scripts: use tipc instead of obsolute tipc-config in opensaf_reboot [#3066]



Complete diffstat:
--
 scripts/opensaf_reboot  | 11 ++-
 src/nid/configure_tipc.in   |  1 -
 tools/cluster_sim_uml/build_uml |  4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)


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


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


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] nid: use the tipc command instead of tipc-config [#2104]

2019-07-31 Thread Vu Minh Nguyen
The tipc-config command is obsolete and no longer being maintained. We should
switch to using the "tipc" command instead
---
 Makefile.am   |  3 ++-
 opensaf.spec.in   |  1 +
 .../archive/scripts => scripts}/tipc-config   | 15 --
 src/nid/configure_tipc.in | 16 ++-
 src/nid/opensafd.in   | 20 +++
 tools/cluster_sim_uml/build_uml   |  2 +-
 6 files changed, 35 insertions(+), 22 deletions(-)
 rename {tools/cluster_sim_uml/archive/scripts => scripts}/tipc-config (83%)

diff --git a/Makefile.am b/Makefile.am
index b3d6553c1..6d86ec180 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,7 +159,8 @@ dist_osaf_execbin_SCRIPTS += \
$(top_srcdir)/scripts/opensaf_reboot \
$(top_srcdir)/scripts/opensaf_sc_active \
$(top_srcdir)/scripts/opensaf_scale_out \
-   $(top_srcdir)/scripts/plm_scale_out
+   $(top_srcdir)/scripts/plm_scale_out \
+   $(top_srcdir)/scripts/tipc-config
 
 include $(top_srcdir)/src/ais/Makefile.am
 include $(top_srcdir)/src/base/Makefile.am
diff --git a/opensaf.spec.in b/opensaf.spec.in
index 0effd59cd..37be5de6d 100644
--- a/opensaf.spec.in
+++ b/opensaf.spec.in
@@ -950,6 +950,7 @@ fi
 %{_pkglibdir}/plm_scale_out
 %{_pkglibdir}/opensaf_sc_active
 %{_pkglibdir}/configure_tipc
+%{_pkglibdir}/tipc-config
 
 
 %files amf-libs
diff --git a/tools/cluster_sim_uml/archive/scripts/tipc-config 
b/scripts/tipc-config
similarity index 83%
rename from tools/cluster_sim_uml/archive/scripts/tipc-config
rename to scripts/tipc-config
index f9fd47937..34eb9a539 100755
--- a/tools/cluster_sim_uml/archive/scripts/tipc-config
+++ b/scripts/tipc-config
@@ -1,4 +1,4 @@
-#!/bin/ash
+#!/bin/bash
 #
 #  -*- OpenSAF  -*-
 #
@@ -39,7 +39,18 @@ fi
 while [ $# -gt 0 ]; do
 case "$1" in
-addr)
-   echo "node address: $(/sbin/tipc node get address)"
+   addr=$(/sbin/tipc node get address)
+   hex_pattern="^[0-9a-fA-F]+$"
+   if [[ $addr =~ $hex_pattern ]]; then
+   dec_addr=$((16#$addr))
+   # the algorithm is based on /usr/include/linux/tipc.h
+   # to form tipc node address into 'Z.C.N' format.
+   tipc_zone=$((dec_addr >> 24))
+   tipc_cluster=$(((dec_addr >> 12) & 0xfff))
+   tipc_node=$((dec_addr & 0xfff))
+   addr="<$tipc_zone.$tipc_cluster.$tipc_node>"
+   fi
+   echo "node address: $addr"
;;
-a=*)
/sbin/tipc node set address "$(echo "$1" | cut -d= -f2)"
diff --git a/src/nid/configure_tipc.in b/src/nid/configure_tipc.in
index 33621a0ef..5d0bf6efb 100644
--- a/src/nid/configure_tipc.in
+++ b/src/nid/configure_tipc.in
@@ -78,12 +78,13 @@ if ! [ -x "${tipc}" ] && ! [ -x "${tipc_config}" ]; then
 exit 1
 fi
 
+# Prefer using `tipc` over the obsoleted `tipc-config`
+if [ -x "${tipc}" ]; then
+tipc_config="${pkglibdir}"/tipc-config
+fi
+
 if [ "$MANAGE_TIPC" != "yes" ] && ! [ -s "$pkglocalstatedir/node_id" ]; then
-if [ -x "${tipc}" ]; then
-   addr=$(tipc node get address | cut -d'<' -f2 | cut -d'>' -f1)
-else
-   addr=$(tipc-config -addr | cut -d'<' -f2 | cut -d'>' -f1)
-fi
+   addr=$(${tipc-config} -addr | cut -d'<' -f2 | cut -d'>' -f1)
 addr=$(echo "$addr" | cut -d. -f3)
 CHASSIS_ID=2
 SLOT_ID=$((addr & 255))
@@ -98,11 +99,6 @@ fi
 ETH_NAME=$2
 TIPC_NETID=$3
 
-if ! [ -x "${tipc_config}" ]; then
-echo "error: tipc-config is not available"
-exit 1
-fi
-
 # Get the Chassis Id and Slot Id from @sysconfdir@/@PACKAGE_NAME@/chassis_id 
and @sysconfdir@/@PACKAGE_NAME@/slot_id
 if ! test -f "$CHASSIS_ID_FILE"; then
echo "$CHASSIS_ID_FILE doesnt exists, exiting " 
diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index 94888039a..f85cf5b0c 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -50,7 +50,7 @@ osafcshash=@INTERNAL_VERSION_ID@
 unload_tipc() {
 
# Unload TIPC if already loaded
-   if [ $MANAGE_TIPC = "yes" ] && grep tipc /proc/modules >/dev/null 2>&1; 
then
+   if [ "$MANAGE_TIPC" = "yes" ] && grep tipc /proc/modules >/dev/null 
2>&1; then
modprobe -r tipc >/dev/null 2>&1
if [ $? -eq 1 ]; then
logger -t $osafprog "warning: TIPC module unloading 
failed"
@@ -59,13 +59,17 @@ unload_tipc() {
 }
 
 check_tipc() {
-   # Exit if tipc-config is not installed
-   if [ "$MANAGE_TIPC" = "yes" ] && [ ! -x /sbin/tipc-config ]; then
-   which tipc-config >/dev/null 2>&1
-   if [ $? -eq 1 ] ; then
-   logger -s -t $osafprog "Can't find tipc-config in the 
PATH, exiting."
-   exit 5
-   fi
+
+   if [ "$MANAGE_TIPC" != "yes" ]; then
+   return 0
+   

[devel] [PATCH 0/1] Review Request for nid: use the tipc command instead of tipc-config [#2104] V2

2019-07-31 Thread Vu Minh Nguyen
Summary: nid: use the tipc command instead of tipc-config [#2104]
Review request for Ticket(s): 2104
Peer Reviewer(s): Anders, Gary, Quyen
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2104
Base revision: c13b49a0b42050afc901a55ea051209971a8d1cd
Personal repository: git://git.code.sf.net/u/winhvu/review


Impacted area   Impact y/n

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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 78619e9f226b8cf20e11c837332c0c582ffbd0ad
Author: Vu Minh Nguyen 
Date:   Thu, 1 Aug 2019 09:41:18 +0700

nid: use the tipc command instead of tipc-config [#2104]

The tipc-config command is obsolete and no longer being maintained. We should
switch to using the "tipc" command instead



Complete diffstat:
--
 Makefile.am  |  3 ++-
 opensaf.spec.in  |  1 +
 .../archive/scripts => scripts}/tipc-config  | 15 +--
 src/nid/configure_tipc.in| 16 ++--
 src/nid/opensafd.in  | 20 
 tools/cluster_sim_uml/build_uml  |  2 +-
 6 files changed, 35 insertions(+), 22 deletions(-)


Testing Commands:
-
Uninstall tipc-config tool if any, then build cluster with tipc mode


Testing, Expected Results:
--
Cluster starts up successfully with tipc mode


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 0/1] Review Request for nid: use the tipc command instead of tipc-config [#2104]

2019-07-14 Thread Vu Minh Nguyen
Summary: nid: use the tipc command instead of tipc-config [#2104]
Review request for Ticket(s): 2104
Peer Reviewer(s): Anders, Gary, Quyen
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2104
Base revision: ec296cbb38761831929a97a8d94d177130f656c9
Personal repository: git://git.code.sf.net/u/winhvu/review


Impacted area   Impact y/n

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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 011c1cc1dbb12840fdaec159dc15a0b46e7d26e2
Author: Vu Minh Nguyen 
Date:   Mon, 15 Jul 2019 09:40:51 +0700

nid: use the tipc command instead of tipc-config [#2104]

The tipc-config command is obsolete and no longer being maintained. We should
switch to using the "tipc" command instead



Complete diffstat:
--
 Makefile.am  |  3 ++-
 opensaf.spec.in  |  1 +
 .../archive/scripts => scripts}/tipc-config  |  2 +-
 src/nid/configure_tipc.in|  6 +++---
 src/nid/opensafd.in  | 20 
 tools/cluster_sim_uml/build_uml  |  2 +-
 6 files changed, 20 insertions(+), 14 deletions(-)


Testing Commands:
-
Build UML with tipc transport


Testing, Expected Results:
--
OpenSAF cluster starts successfully


Conditions of Submission:
-
Ack from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] nid: use the tipc command instead of tipc-config [#2104]

2019-07-14 Thread Vu Minh Nguyen
The tipc-config command is obsolete and no longer being maintained. We should
switch to using the "tipc" command instead
---
 Makefile.am   |  3 ++-
 opensaf.spec.in   |  1 +
 .../archive/scripts => scripts}/tipc-config   |  2 +-
 src/nid/configure_tipc.in |  6 +++---
 src/nid/opensafd.in   | 20 +++
 tools/cluster_sim_uml/build_uml   |  2 +-
 6 files changed, 20 insertions(+), 14 deletions(-)
 rename {tools/cluster_sim_uml/archive/scripts => scripts}/tipc-config (99%)

diff --git a/Makefile.am b/Makefile.am
index b3d6553c1..6d86ec180 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -159,7 +159,8 @@ dist_osaf_execbin_SCRIPTS += \
$(top_srcdir)/scripts/opensaf_reboot \
$(top_srcdir)/scripts/opensaf_sc_active \
$(top_srcdir)/scripts/opensaf_scale_out \
-   $(top_srcdir)/scripts/plm_scale_out
+   $(top_srcdir)/scripts/plm_scale_out \
+   $(top_srcdir)/scripts/tipc-config
 
 include $(top_srcdir)/src/ais/Makefile.am
 include $(top_srcdir)/src/base/Makefile.am
diff --git a/opensaf.spec.in b/opensaf.spec.in
index 0effd59cd..37be5de6d 100644
--- a/opensaf.spec.in
+++ b/opensaf.spec.in
@@ -950,6 +950,7 @@ fi
 %{_pkglibdir}/plm_scale_out
 %{_pkglibdir}/opensaf_sc_active
 %{_pkglibdir}/configure_tipc
+%{_pkglibdir}/tipc-config
 
 
 %files amf-libs
diff --git a/tools/cluster_sim_uml/archive/scripts/tipc-config 
b/scripts/tipc-config
similarity index 99%
rename from tools/cluster_sim_uml/archive/scripts/tipc-config
rename to scripts/tipc-config
index f9fd47937..a5c9c4091 100755
--- a/tools/cluster_sim_uml/archive/scripts/tipc-config
+++ b/scripts/tipc-config
@@ -1,4 +1,4 @@
-#!/bin/ash
+#!/bin/bash
 #
 #  -*- OpenSAF  -*-
 #
diff --git a/src/nid/configure_tipc.in b/src/nid/configure_tipc.in
index 33621a0ef..2ba3483f3 100644
--- a/src/nid/configure_tipc.in
+++ b/src/nid/configure_tipc.in
@@ -98,9 +98,9 @@ fi
 ETH_NAME=$2
 TIPC_NETID=$3
 
-if ! [ -x "${tipc_config}" ]; then
-echo "error: tipc-config is not available"
-exit 1
+# Prefer using `tipc` instead of obsoleted `tipc-config`
+if [ -x "${tipc}" ]; then
+tipc_config="${pkglibdir}"/tipc-config
 fi
 
 # Get the Chassis Id and Slot Id from @sysconfdir@/@PACKAGE_NAME@/chassis_id 
and @sysconfdir@/@PACKAGE_NAME@/slot_id
diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index 94888039a..f85cf5b0c 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -50,7 +50,7 @@ osafcshash=@INTERNAL_VERSION_ID@
 unload_tipc() {
 
# Unload TIPC if already loaded
-   if [ $MANAGE_TIPC = "yes" ] && grep tipc /proc/modules >/dev/null 2>&1; 
then
+   if [ "$MANAGE_TIPC" = "yes" ] && grep tipc /proc/modules >/dev/null 
2>&1; then
modprobe -r tipc >/dev/null 2>&1
if [ $? -eq 1 ]; then
logger -t $osafprog "warning: TIPC module unloading 
failed"
@@ -59,13 +59,17 @@ unload_tipc() {
 }
 
 check_tipc() {
-   # Exit if tipc-config is not installed
-   if [ "$MANAGE_TIPC" = "yes" ] && [ ! -x /sbin/tipc-config ]; then
-   which tipc-config >/dev/null 2>&1
-   if [ $? -eq 1 ] ; then
-   logger -s -t $osafprog "Can't find tipc-config in the 
PATH, exiting."
-   exit 5
-   fi
+
+   if [ "$MANAGE_TIPC" != "yes" ]; then
+   return 0
+   fi
+
+   tipc=$(which tipc 2> /dev/null)
+   tipc_config=$(which tipc-config 2> /dev/null)
+
+   if ! [ -x "${tipc}" ] && ! [ -x "${tipc_config}" ]; then
+   logger -s -t $osafprog "error: neither tipc nor tipc-config is 
available"
+   exit 1
fi
 
unload_tipc
diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml
index ce9e8a9f5..8e48bb5a5 100755
--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -225,7 +225,7 @@ cmd_create_rootfs()
 
 install -m 755 $archive/scripts/*.rc etc/init.d
 cp $scripts/profile etc
-cp $scripts/reboot $scripts/shutdown $scripts/tipc-config usr/sbin
+cp $scripts/reboot $scripts/shutdown $opensaf_home/scripts/tipc-config 
usr/sbin
 mkdir -p root/www/cgi-bin
 cp $scripts/rshd root/www/cgi-bin
 cp $scripts/rsh $scripts/rcp $scripts/sudo usr/bin
-- 
2.17.1



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


Re: [devel] [PATCH 1/1] imm: immnd respawns if it exits during startup [#3053]

2019-06-19 Thread Vu Minh Nguyen
Ack with a minor comment.

Regards, Vu

> -Original Message-
> From: thang.d.nguyen 
> Sent: Thursday, June 20, 2019 10:42 AM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com;
> lennart.l...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; thang.d.nguyen
> 
> Subject: [PATCH 1/1] imm: immnd respawns if it exits during startup
[#3053]
> 
> During start up, the immnd was exited due to sync interrupted.
> It should send the  error respond to nid.
> ---
>  src/imm/immnd/immnd_evt.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/imm/immnd/immnd_evt.c b/src/imm/immnd/immnd_evt.c
> index adae1e1..3bd56fe 100644
> --- a/src/imm/immnd/immnd_evt.c
> +++ b/src/imm/immnd/immnd_evt.c
> @@ -12189,6 +12189,10 @@ static uint32_t
> immnd_evt_proc_mds_evt(IMMND_CB *cb, IMMND_EVT *evt)
>   cb->mIntroduced = 2;
>   LOG_WA("SC Absence IS allowed:%u IMMD service is
> DOWN",
>  cb->mScAbsenceAllowed);
> + if (cb->mState < IMM_SERVER_SYNC_SERVER) {
[Vu] Should printout a message before exiting such as. 
LOG_NO("SC absence interrupted sync of this IMMND - exiting...");
> + immnd_ackToNid(NCSCC_RC_FAILURE);
> + exit(1);
> + }
>   if (cb->mIsCoord) {
>   cb->mIsCoord = false;
> 
> --
> 2.7.4




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


Re: [devel] [PATCH 1/1] log: Delete the older file without closing current log file via admin operation [#3046]

2019-06-17 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Friday, June 14, 2019 10:21 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Delete the older file without closing current
log file
> via admin operation [#3046]
> 
> Improve the enhancement of ticket #3022, the user can rotate (delete)
older
> log
> files without closing current log file.
> 
> LOG add new parameter (numberOfFilesToRemove) to admin op command
> with id = 2.
>  - If parameter exists, LOGD remove number of older file base on parameter
> value
>  - If parameter is omitted, LOGD rotates log file normally. (closing
current log
> file, rotate log file if needed, create new log file)
> 
> This helps to avoid creating empty log file or small log file size
> ---
>  src/log/apitest/tet_LogOiOps.c | 272 +
> 
>  src/log/logd/lgs_filehdl.cc|   4 +-
>  src/log/logd/lgs_imm.cc| 104 
>  src/log/logd/lgs_stream.cc |  41 +--
>  src/log/logd/lgs_stream.h  |   3 +-
>  5 files changed, 305 insertions(+), 119 deletions(-)
> 
> diff --git a/src/log/apitest/tet_LogOiOps.c
b/src/log/apitest/tet_LogOiOps.c
> index 947e79664..25f53d3a2 100644
> --- a/src/log/apitest/tet_LogOiOps.c
> +++ b/src/log/apitest/tet_LogOiOps.c
> @@ -5521,95 +5521,201 @@ void admin_rotate_log_file(void)
>   }
>  }
> 
> +// Verify that log and cfg files are rotated when the number of log/cfg
files
> +// reach the "saLogStreamMaxFilesRotated" value (ticket #3045)
>  //
> -// Test case for verifying the admin operation rotates log file with
> -// parameter fails
> -// Steps:
> -// 1. Create configuration app stream
> -// 2. Verify command admin operation rotates log file with parameter
fails
> -// 3. Delete configuration app stream
> +// Step1: Create and delete the app stream with
> (saLogStreamMaxFilesRotated = 2)
> +// 4 times
> +// Step2: Verify that total is 4 cfg and log files (2 log files and 2 cfg
files)
> +void verRotatedLogCfgFile(void)
> +{
> + char command1[MAX_DATA], command2[MAX_DATA];
> + const char *object_dn =
> + "safLgStrCfg=verRotatedFile,safApp=safLogService";
> + const int max_file = 2;
> + char num_files_c[10];
> + uint32_t num_files = 0;
> +
> + // Command to create configuration application stream
> + sprintf(command1, "immcfg -c SaLogStreamConfig %s "
> +   "-a saLogStreamPathName=. "
> +   "-a saLogStreamFileName=verRotatedFile"
> +   " -a saLogStreamMaxFilesRotated=%d",
> +   object_dn, max_file);
> + // Command to delete configuration application stream
> + sprintf(command2, "immcfg -d %s", object_dn);
> +
> + // Create and delete the app stream 4 times.
> + // Log/cfg are created during creating stream.
> + for (int i = 0; i < max_file + 1; ++i) {
> + int rc = systemCall(command1);
> + if (rc == 0) {
> + osaf_nanosleep();
> + rc = systemCall(command2);
> + osaf_nanosleep();
> + }
> + if (rc != 0) {
> + rc_validate(rc, 0);
> + return;
> + }
> + }
> + // Command to count number of log/cfg files on disk
> + sprintf(command1, "find %s -type f -mmin -1 "
> +   "| egrep '%s.*\\.[log$\\|cfg$]' "
> +   "| wc -l | awk '{printf $1}'",
> +   log_root_path, "verRotatedFile");
> +
> + FILE *fp = popen(command1, "r");
> +
> + // Get number of cfg and log file
> + while (fgets(num_files_c, sizeof(num_files_c) - 1, fp) != NULL) {};
> + pclose(fp);
> +
> + // Verify cfg/log files are rotated by checking
> + // that there are totally 4 cfg and log files
> + num_files = atoi(num_files_c);
> + rc_validate(num_files, max_file * 2);
> +}
> +
> +// Verify that log file is rotated via admin operation with admin id = 2
> +// and no parameter
>  //
> -void admin_rotate_log_file_with_param(void)
> +// Step1: Create and delete the app stream with
> (saLogStreamMaxFilesRotated = 2)
> +// step2: Do admin operation 2 times to rotate log file.
> +//Two new log file are created
> +// step3: Verify log file is rotated via admin operation by checking that
> +//there are 2 log files on disk
> +void verRotatedLogCfgFile2(void)
>  {
> - int rc = 0;
> + int rc;
>   char command[MAX_DATA];
>   const char *object_dn =
> -
>   "safLgStrCfg=admin_rotate_file1,safApp=safLogService";
> + "safLgStrCfg=verRotatedFile2,safApp=safLogService";
> + char num_files_c[10];
> + uint32_t num_files = 0;
> 
> - // Create configuration application stream
> - sprintf(command, "immcfg -c SaLogStreamConfig 

Re: [devel] [PATCH 1/1] log: Delete the older file without closing current log file [#3046]

2019-06-05 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Monday, June 3, 2019 6:18 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Delete the older file without closing current
log file
> [#3046]
> 
> Improve the enhancement of ticket #3022, the user can rotate (delete)
older
> log
> files without closing current log file.
> 
> LOG add new parameter(optional) to admin op command with id = 2.
>  - If parameter exists, LOGD rotates log file without closing current log
file
>  - If parameter is omitted, LOGD rotates log file normally. (closing
current log
> file, rotate log file if needed, create new log file)
> 
> This helps to avoid creating empty log file or small log file size
> ---
>  src/log/logd/lgs_filehdl.cc | 11 ++--
>  src/log/logd/lgs_imm.cc | 69 --
> ---
>  src/log/logd/lgs_stream.cc  | 13 +
>  src/log/logd/lgs_stream.h   |  1 +
>  4 files changed, 66 insertions(+), 28 deletions(-)
> 
> diff --git a/src/log/logd/lgs_filehdl.cc b/src/log/logd/lgs_filehdl.cc
> index be2b95e1f..ad0e5b5c8 100644
> --- a/src/log/logd/lgs_filehdl.cc
> +++ b/src/log/logd/lgs_filehdl.cc
> @@ -695,7 +695,7 @@ done_free:
>free(namelist);
> 
>  done_exit:
> -  TRACE_LEAVE();
> +  TRACE_LEAVE2("rc = %d", rc);
>return rc;
>  }
> 
> @@ -790,7 +790,12 @@ int get_number_of_cfg_files_hdl(void *indata, void
> *outdata,
> _old_time)) {
>  old_ind = n;
>} else {
> -failed++; /* wrong format */
> +const std::string current_cfg_name =
> +std::string(params_in->file_name) + ".cfg";
> +if (strncmp(cfg_namelist[n]->d_name, current_cfg_name.c_str(),
> +current_cfg_name.size()) != 0) {
> +  failed++;  // wrong format
> +}
>}
>  }
> 
> @@ -828,7 +833,7 @@ done_log_free:
>}
> 
>  done_exit:
> -  TRACE_LEAVE();
> +  TRACE_LEAVE2("rc = %d", rc);
>return rc;
>  }
> 
> diff --git a/src/log/logd/lgs_imm.cc b/src/log/logd/lgs_imm.cc
> index 49bc686b6..612004cad 100644
> --- a/src/log/logd/lgs_imm.cc
> +++ b/src/log/logd/lgs_imm.cc
> @@ -84,9 +84,11 @@ static std::vector file_path_list;
>  static void lgs_admin_change_filter(
>  SaImmOiHandleT immOiHandle, SaInvocationT invocation,
>  SaConstStringT objectName, const SaImmAdminOperationParamsT_2
> *parameter);
> -static void lgs_admin_rotate_log_file(SaImmOiHandleT immOiHandle,
> -  SaInvocationT invocation,
> -  SaConstStringT objectName);
> +static void lgs_admin_rotate_log_file(
> +SaImmOiHandleT immOiHandle,
> +SaInvocationT invocation,
> +SaConstStringT objectName,
> +const SaImmAdminOperationParamsT_2 *parameter);
> 
>  static void report_oi_error(SaImmOiHandleT immOiHandle, SaImmOiCcbIdT
> ccbId,
>  const char *format, ...)
> @@ -396,12 +398,7 @@ static void adminOperationCallback(
>} else if (opId == SA_LOG_ADMIN_CHANGE_FILTER) {
>  lgs_admin_change_filter(immOiHandle, invocation, objName, param);
>} else if (opId == SA_LOG_ADMIN_ROTATE_FILE) {
> -if (param != nullptr) {
> -report_om_error(immOiHandle, invocation,
> -"Admin op rotate log file: parameters is not
empty");
> -} else {
> -  lgs_admin_rotate_log_file(immOiHandle, invocation, objName);
> -}
> +lgs_admin_rotate_log_file(immOiHandle, invocation, objName, param);
>} else {
>  report_om_error( immOiHandle, invocation, "Invalid operation ID");
>}
> @@ -3403,14 +3400,20 @@ static void lgs_admin_change_filter(
> 
>  /**
>   * Handle admin operation that rotates the log file
> + *  - If parameter exists, LOGD rotate log file without closing current
log file
> + *  - If parameter is omitted, LOGD rotate log file normally.
> + *(closing current log file, rotate log file if needed, create new
log file)
>   *
>   * @param immOiHandle
>   * @param invocation
>   * @param objectName
> + * @param parameter
>   */
> -static void lgs_admin_rotate_log_file(SaImmOiHandleT immOiHandle,
> -  SaInvocationT invocation,
> -  SaConstStringT objectName) {
> +static void lgs_admin_rotate_log_file(
> +SaImmOiHandleT immOiHandle,
> +SaInvocationT invocation,
> +SaConstStringT objectName,
> +const SaImmAdminOperationParamsT_2 *parameter) {
>TRACE_ENTER();
> 
>osafassert(objectName != nullptr);
> @@ -3424,13 +3427,41 @@ static void
> lgs_admin_rotate_log_file(SaImmOiHandleT immOiHandle,
>// Rotate log file.
>// Send the result "FAILED_OPERATION" to admin if the rotation fails
>SaAisErrorT result = SA_AIS_OK;
> -  int ret = log_rotation_act(stream);
> -  if (ret == 0)
> -// Checkpoint the stream to 

Re: [devel] [PATCH 1/1] log: fix to remove the cfg file when log file rotation [#3045]

2019-06-05 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Thursday, May 30, 2019 3:10 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: fix to remove the cfg file when log file
rotation
> [#3045]
> 
> If the date(include year, month and day) in oldest cfg file name and the
> date of created oldest log file is different, logd cannot find out the
> oldest cfg file. The oldest cfg file is never removed when log file
rotation.
> So number of cfg file is huge after time while the log file has already
been
> rotated.
> 
> Update to remove the cfg in this case.
> Also limit the number of cfg files should be removed if there are still
huge
> cfg files in disk to avoid hanging main thread
> ---
>  src/log/logd/lgs_filehdl.cc |  8 ++--
>  src/log/logd/lgs_stream.cc  | 96
---
> --
>  2 files changed, 47 insertions(+), 57 deletions(-)
> 
> diff --git a/src/log/logd/lgs_filehdl.cc b/src/log/logd/lgs_filehdl.cc
> index be2b95e1f..f31e45883 100644
> --- a/src/log/logd/lgs_filehdl.cc
> +++ b/src/log/logd/lgs_filehdl.cc
> @@ -794,10 +794,10 @@ int get_number_of_cfg_files_hdl(void *indata,
> void *outdata,
>}
>  }
> 
> -if ((old_ind != -1) && (cfg_old_date == log_old_date) &&
> -(cfg_old_time <= log_old_time)) {
> -  TRACE_1(" (cfg_old_date:%d == log_old_date:%d) &&"
> -  " (cfg_old_time:%d <= log_old_time:%d )",
> +if ((old_ind != -1) && (((cfg_old_date == log_old_date) &&
> +(cfg_old_time <= log_old_time)) || (cfg_old_date <
log_old_date))) {
[Vu] Can simplify these if by:
If (old_ind == -1) goto done_cfg_free;

bool is_cfg_outdate_1 = (cfg_old_date == log_old_date) && (cfg_old_time <=
log_old_time);
bool  is_cfg_outdate_2 = (cfg_old_date < log_old_date);
if (is_cfg_outdate_1 || is_cfg_outdate_2) {
> +  TRACE_1(" (cfg_old_date:%d - log_old_date:%d) -"
> +  " (cfg_old_time:%d - log_old_time:%d )",
>cfg_old_date, log_old_date, cfg_old_time, log_old_time);
>TRACE_1("oldest: %s", cfg_namelist[old_ind]->d_name);
>n = snprintf(oldest_file, max_outsize, "%s/%s", path.c_str(),
> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc
> index d31ae170b..cb9a935e7 100644
> --- a/src/log/logd/lgs_stream.cc
> +++ b/src/log/logd/lgs_stream.cc
> @@ -270,69 +270,59 @@ static int delete_config_file(log_stream_t
> *stream) {
> 
>  /**
>   * Remove oldest log file until there are 'maxFilesRotated' - 1 files
left
> + * The oldest cfg files are also removed
>   *
>   * @param stream
> - * @return -1 on error
> + * @return true/false
>   */
> -static int rotate_if_needed(log_stream_t *stream) {
> +static bool rotate_if_needed(log_stream_t *stream) {
>char oldest_log_file[PATH_MAX];
>char oldest_cfg_file[PATH_MAX];
> -  int rc = 0;
> -  int log_file_cnt, cfg_file_cnt;
> -  bool oldest_cfg = false;
> +  const int max_files_rotated =
static_cast(stream->maxFilesRotated);
> 
>TRACE_ENTER();
> 
> -  /* Rotate out log files from previous lifes */
> -  if ((log_file_cnt = get_number_of_log_files_h(stream, oldest_log_file))
==
> -  -1) {
> -rc = -1;
> -goto done;
> -  }
> -
> -  /* Rotate out cfg files from previous lifes */
> -  if (!((cfg_file_cnt = get_number_of_cfg_files_h(stream,
oldest_cfg_file)) ==
> --1)) {
> -oldest_cfg = true;
> -  }
> -
> -  TRACE("delete oldest_cfg_file: %s oldest_log_file %s", oldest_cfg_file,
> -oldest_log_file);
> -
> -  /*
> -  ** Remove until we have one less than allowed, we are just about to
> -  ** create a new one again.
> -  */
> -  while (log_file_cnt >= static_cast(stream->maxFilesRotated)) {
> -if ((rc = file_unlink_h(oldest_log_file)) == -1) {
> -  LOG_NO("Could not log delete: %s - %s", oldest_log_file,
> strerror(errno));
> -  goto done;
> +  // Get number of log files and the oldest log file
> +  int log_file_cnt = get_number_of_log_files_h(stream, oldest_log_file);
> +  while (log_file_cnt >= max_files_rotated) {
> +TRACE("Delete oldest_log_file %s", oldest_log_file);
> +if (file_unlink_h(oldest_log_file) == -1) {
> +  LOG_NO("Delete log file fail: %s - %s", oldest_log_file,
strerror(errno));
> +  return false;
>  }
> -
> -if (oldest_cfg == true) {
> -  oldest_cfg = false;
> -  if ((rc = file_unlink_h(oldest_cfg_file)) == -1) {
> -LOG_NO("Could not cfg  delete: %s - %s", oldest_cfg_file,
> -   strerror(errno));
> -goto done;
> -  }
> -}
> -
> -if ((log_file_cnt = get_number_of_log_files_h(stream,
oldest_log_file)) ==
> --1) {
> -  rc = -1;
> -  goto done;
> +log_file_cnt = get_number_of_log_files_h(stream, oldest_log_file);
> +  }
> +  if (log_file_cnt == -1) return false;
> +
> +  // Housekeeping for cfg files
> +  int number_deleted_files = 0;
> +  int 

Re: [devel] Review request imm: update PR documentation regarding unresponsive file system [#3024]

2019-05-08 Thread Vu Minh Nguyen
Hi all,

 

Any comments on this document update? I will push it on tomorrow if no
comments. Thanks.

 

Regards, Vu

 

From: Vu Minh Nguyen  
Sent: Monday, April 22, 2019 10:46 AM
To: 'hans.nordeb...@ericsson.com' ;
'lennart.l...@ericsson.com' ;
'gary@dektech.com.au' 
Cc: 'opensaf-devel@lists.sourceforge.net'

Subject: [devel] Review request imm: update PR documentation regarding
unresponsive file system [#3024]

 

Hi all,

 

This is IMM PR documentation update regarding the enhancement in the ticket
#3019 - imm: return try-again on write requests if FS is unresponsive.

 

To view all changes, open the doc with LibreOffice Writer then click
Edit/Trace Changes/Manage.

 

Please help to review it. Thanks.

 

Regards, Vu

 


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


Re: [devel] [PATCH 0/1] Review Request for mds: support multicast fragmented messages [#3033] V3

2019-04-25 Thread Vu Minh Nguyen
Hi Hans,

Probably you were looking at code that included this Thuan's patch.

In legacy code, only mdtm_sendto() is called inside the function 
mdtm_frag_and_send().

Regards, Vu

> -Original Message-
> From: Hans Nordebäck 
> Sent: Thursday, April 25, 2019 6:10 PM
> To: Vu Minh Nguyen ; Thuan Tran
> ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 0/1] Review Request for mds: support multicast
> fragmented messages [#3033] V3
> 
> 
> Hi Vu,
> It seems mdtm_mcast_sendto is used in mdtm_frag_and_send, at
> MDS_SENDTYPE_BCAST/BR Hans
> -Original Message-
> From: Vu Minh Nguyen 
> Sent: den 25 april 2019 12:20
> To: Hans Nordebäck ; Thuan Tran
> ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 0/1] Review Request for mds: support multicast
> fragmented messages [#3033] V3
> 
> Hi Hans,
> 
> See my responses inline.
> 
> Regards, Vu
> 
> > -Original Message-----
> > From: Hans Nordebäck 
> > Sent: Thursday, April 25, 2019 4:28 PM
> > To: Thuan Tran ; Vu Minh Nguyen
> > ; Minh Hon Chau
> 
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: Re: [PATCH 0/1] Review Request for mds: support multicast
> > fragmented messages [#3033] V3
> >
> > Hi Vu and Thuan,
> >
> > a few question, is the text in the ticket description correct? E.g it
> > says unicast is used if a multicast message is fragmented, (I think
> > multicast still is used
> >
> > to send the fragments), this is what you mean with 2 different channels?
> > (only one socket is used, BSRsock),
> [Vu] Yes. Unicast is used to send fragmented messages. Here is the current
> logic in case of sending a large package:
> Iterate over destinations { // mcm_pvt_process_svc_bcast_common() @
> mds_c_sndrcv.c
>   1) Fragment the package // mdtm_frag_and_send() @ mds_dt_tipc.c
>   2) Unicast to a specific adest  // mdtm_sendto() @
> mds_dt_tipc.c
>   4) Continue with next adest
> }
> 
> >
> > The problem stated is sending one large multicast message and then
> > several smaller multicast messages, have you checked the
> >
> > fragment re-assembly part of the common code?
> [Vu] Yes. At the receive side, if msg is fragmented, mds will not forward to
> upper layer until all fragmented msgs are collected.
> If the message is not fragmented, mds will transfer the msg to upper right
> away.
> 
> I checked with TIPC guys here, and he said that TIPC does not guarantee the
> order if we send msgs in different channels (unicast vs mcast).
> 
> >
> > /BR Hans
> >
> >
> > On 2019-04-24 13:06, thuan.tran wrote:
> > > Summary: mds: support multicast fragmented messages [#3033] Review
> > > request for Ticket(s): 3033 Peer Reviewer(s): Hans, Minh, Vu Pull
> > > request to: *** LIST THE PERSON WITH PUSH ACCESS HERE *** Affected
> > > branch(es): develop Development branch: ticket-3033 Base revision:
> > > 7916ac316e86478c621c8359cf2aca4886288a38
> > > Personal repository: git://git.code.sf.net/u/thuantr/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
> > >
> > > NOTE: Patch(es) contain lines longer than 80 characers
> > >
> > > Comments (indicate scope for each "y" above):
> > > -
> > > N/A
> > >
> > > revision 568f09774f936506f5e05e03813fa572af0fe0d3
> > > Author:   thuan.tran 
> > > Date: Wed, 24 Apr 2019 17:54:25 +0700
> > >
> > > mds: support multicast fragmented messages [#3033]
> > >
> > > - Sender may send broadcast big messages (> 65K) then small messages
> > > (<
> > 65K).
> > > Current MDS just loop via all destinations to unicast all fragmented
> > messages
> > > to one by one destinations. But sending multicast non-fragment
> > > messages
> > to all
> > > destinations. Therefor, receivers may get messages with incorrect
> > > order, non-fragment messages may come before fr

Re: [devel] [PATCH 0/1] Review Request for mds: support multicast fragmented messages [#3033] V3

2019-04-25 Thread Vu Minh Nguyen
Hi Hans,

See my responses inline.

Regards, Vu

> -Original Message-
> From: Hans Nordebäck 
> Sent: Thursday, April 25, 2019 4:28 PM
> To: Thuan Tran ; Vu Minh Nguyen
> ; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 0/1] Review Request for mds: support multicast
> fragmented messages [#3033] V3
> 
> Hi Vu and Thuan,
> 
> a few question, is the text in the ticket description correct? E.g it
> says unicast is used if a multicast message is fragmented, (I think
> multicast still is used
> 
> to send the fragments), this is what you mean with 2 different channels?
> (only one socket is used, BSRsock),
[Vu] Yes. Unicast is used to send fragmented messages. Here is the current 
logic in case of sending a large package:
Iterate over destinations { // mcm_pvt_process_svc_bcast_common() @ 
mds_c_sndrcv.c
1) Fragment the package // mdtm_frag_and_send() @ mds_dt_tipc.c
2) Unicast to a specific adest  // mdtm_sendto() @ mds_dt_tipc.c
4) Continue with next adest
}

> 
> The problem stated is sending one large multicast message and then
> several smaller multicast messages, have you checked the
> 
> fragment re-assembly part of the common code?
[Vu] Yes. At the receive side, if msg is fragmented, mds will not forward to 
upper layer until all fragmented msgs are collected.
If the message is not fragmented, mds will transfer the msg to upper right away.

I checked with TIPC guys here, and he said that TIPC does not guarantee the 
order if we send msgs in different channels (unicast vs mcast).

> 
> /BR Hans
> 
> 
> On 2019-04-24 13:06, thuan.tran wrote:
> > Summary: mds: support multicast fragmented messages [#3033]
> > Review request for Ticket(s): 3033
> > Peer Reviewer(s): Hans, Minh, Vu
> > Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
> > Affected branch(es): develop
> > Development branch: ticket-3033
> > Base revision: 7916ac316e86478c621c8359cf2aca4886288a38
> > Personal repository: git://git.code.sf.net/u/thuantr/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
> >
> > NOTE: Patch(es) contain lines longer than 80 characers
> >
> > Comments (indicate scope for each "y" above):
> > -
> > N/A
> >
> > revision 568f09774f936506f5e05e03813fa572af0fe0d3
> > Author: thuan.tran 
> > Date:   Wed, 24 Apr 2019 17:54:25 +0700
> >
> > mds: support multicast fragmented messages [#3033]
> >
> > - Sender may send broadcast big messages (> 65K) then small messages (<
> 65K).
> > Current MDS just loop via all destinations to unicast all fragmented
> messages
> > to one by one destinations. But sending multicast non-fragment messages
> to all
> > destinations. Therefor, receivers may get messages with incorrect order,
> > non-fragment messages may come before fragmented messages.
> > For example, it may lead to OUT OF ORDER for IMMNDs during IMMD sync.
> > - Solution: support send multicast each fragmented messages to avoid
> > disorder of arrived broadcast messages.
> >
> >
> >
> > Complete diffstat:
> > --
> >   src/mds/mds_c_sndrcv.c |   3 +-
> >   src/mds/mds_dt_tipc.c  | 104 +++-
> -
> >   2 files changed, 40 insertions(+), 67 deletions(-)
> >
> >
> > Testing Commands:
> > -
> > N/A
> >
> > Testing, Expected Results:
> > --
> > N/A
> >
> > Conditions of Submission:
> > -
> > N/A
> >
> > 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

Re: [devel] [PATCH 1/1] mds: support multicast fragmented messages [#3033]

2019-04-25 Thread Vu Minh Nguyen
Hi Thuan,

Ack with minor comments below.

Regards, Vu

> -Original Message-
> From: thuan.tran 
> Sent: Wednesday, April 24, 2019 6:06 PM
> To: 'Vu Minh Nguyen' ;
> hans.nordeb...@ericsson.com; Minh Hon Chau
> 
> Cc: opensaf-devel@lists.sourceforge.net; thuan.tran
> 
> Subject: [PATCH 1/1] mds: support multicast fragmented messages [#3033]
> 
> - Sender may send broadcast big messages (> 65K) then small messages (<
> 65K).
> Current MDS just loop via all destinations to unicast all fragmented
messages
> to one by one destinations. But sending multicast non-fragment messages to
> all
> destinations. Therefor, receivers may get messages with incorrect order,
> non-fragment messages may come before fragmented messages.
> For example, it may lead to OUT OF ORDER for IMMNDs during IMMD sync.
> - Solution: support send multicast each fragmented messages to avoid
> disorder of arrived broadcast messages.
> ---
>  src/mds/mds_c_sndrcv.c |   3 +-
>  src/mds/mds_dt_tipc.c  | 104
+++
> --
>  2 files changed, 40 insertions(+), 67 deletions(-)
> 
> diff --git a/src/mds/mds_c_sndrcv.c b/src/mds/mds_c_sndrcv.c
> index 703bc8e..7850ac7 100644
> --- a/src/mds/mds_c_sndrcv.c
> +++ b/src/mds/mds_c_sndrcv.c
> @@ -4496,8 +4496,7 @@ static uint32_t
> mcm_pvt_process_svc_bcast_common(
> info_result->key.vdest_id,
req, 0,
> info_result->key.adest, pri);
>   if ((svc_cb->subtn_info->prev_ver_sub_count == 0) &&
> - (tipc_mode_enabled) && (tipc_mcast_enabled) &&
> - (to_msg.bcast_buff_len < MDS_DIRECT_BUF_MAXSIZE)) {
> + (tipc_mode_enabled) && (tipc_mcast_enabled)) {
>   m_MDS_LOG_DBG(
>   "MDTM: Break while(1) prev_ver_sub_count: %d
> svc_id =%s(%d)  to_msg.bcast_buff_len: %d ",
>   svc_cb->subtn_info->prev_ver_sub_count,
> diff --git a/src/mds/mds_dt_tipc.c b/src/mds/mds_dt_tipc.c
> index a3abff5..d8f8c78 100644
> --- a/src/mds/mds_dt_tipc.c
> +++ b/src/mds/mds_dt_tipc.c
> @@ -2856,6 +2856,7 @@ uint32_t mdtm_frag_and_send(MDTM_SEND_REQ
> *req, uint32_t seq_num,
>   uint16_t frag_val = 0;
>   uint32_t sum_mds_hdr_plus_mdtm_hdr_plus_len;
>   int version = req->msg_arch_word & 0x7;
> + uint32_t ret = NCSCC_RC_SUCCESS;
> 
>   if (version > 1) {
>   sum_mds_hdr_plus_mdtm_hdr_plus_len =
> @@ -2914,95 +2915,66 @@ uint32_t
> mdtm_frag_and_send(MDTM_SEND_REQ *req, uint32_t seq_num,
>   frag_val = NO_FRAG_BIT | i;
>   }
>   {
> + uint32_t hdr_plus = (i == 1) ?
> + sum_mds_hdr_plus_mdtm_hdr_plus_len :
> MDTM_FRAG_HDR_PLUS_LEN_2;
>   uint8_t *body = NULL;
>   body = calloc(1, len_buf);
> + p8 = (uint8_t *)m_MMGR_DATA_AT_START(usrbuf,
> len_buf - hdr_plus,
> + (char *)(body + hdr_plus));
> + if (p8 != (body + hdr_plus))
> + memcpy((body + hdr_plus), p8, len_buf -
> hdr_plus);
>   if (i == 1) {
[Vu] is it better if we combine these 02 if into one, as:
If ((i === 1) && NCSCC_RC_SUCCESS != mdtm_add_mds_hdr(body, req)) {
// error handling.
}
> - p8 = (uint8_t *)m_MMGR_DATA_AT_START(
> - usrbuf,
> - (len_buf -
> -  sum_mds_hdr_plus_mdtm_hdr_plus_len),
> - (char
> -  *)(body +
> -
> sum_mds_hdr_plus_mdtm_hdr_plus_len));
> -
> - if (p8 !=
> - (body +
> sum_mds_hdr_plus_mdtm_hdr_plus_len))
> - memcpy(
> - (body +
> -
> sum_mds_hdr_plus_mdtm_hdr_plus_len),
> - p8,
> - (len_buf -
> -
> sum_mds_hdr_plus_mdtm_hdr_plus_len));
> -
>   if (NCSCC_RC_SUCCESS !=
>   mdtm_add_mds_hdr(body, req)) {
>   m_MDS_LOG_ERR(
>   "MDTM: frg MDS hdr addition
> failed\n");
> - free(body);
> - m_MMGR_FREE_BUFR_LIST(usrbuf);
> -   

Re: [devel] [PATCH 1/1] mds: support multicast fragmented messages [#3033]

2019-04-24 Thread Vu Minh Nguyen
Hi Thuan,

m_MMGR_REMOVE_FROM_START() is just removed n bytes from the start, not whole
memory chain.

You can refer to descriptions of these macros to see the differences b/w
them.

Regards, Vu

> -Original Message-
> From: Tran Thuan 
> Sent: Wednesday, April 24, 2019 2:17 PM
> To: 'Vu Minh Nguyen' ;
> hans.nordeb...@ericsson.com; 'Minh Hon Chau'  c...@users.sourceforge.net>
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1/1] mds: support multicast fragmented messages
> [#3033]
> 
> Hi bro.Vu,
> 
> I think it won't cause memleak since I break after
> m_MMGR_REMOVE_FROM_START()
> free(body)
> 
> Best Regards,
> ThuanTr
> 
> -Original Message-
> From: Vu Minh Nguyen 
> Sent: Wednesday, April 24, 2019 1:45 PM
> To: 'thuan.tran' ;
> hans.nordeb...@ericsson.com;
> 'Minh Hon Chau' 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1/1] mds: support multicast fragmented messages
> [#3033]
> 
> Hi Thuan,
> 
> Tested broadcasting with large packages (each 1M).
> 
> Ack with below comments.
> 
> Regards, Vu
> 
> > -Original Message-
> > From: thuan.tran 
> > Sent: Wednesday, April 24, 2019 12:00 PM
> > To: hans.nordeb...@ericsson.com; Vu Minh Nguyen
> > ; Minh Hon Chau  > c...@users.sourceforge.net>
> > Cc: opensaf-devel@lists.sourceforge.net; thuan.tran
> > 
> > Subject: [PATCH 1/1] mds: support multicast fragmented messages
> > [#3033]
> >
> > - Sender may send broadcast big messages (> 65K) then small messages
> > (< 65K).
> > Current MDS just loop via all destinations to unicast all fragmented
> messages
> > to one by one destinations. But sending multicast non-fragment
> > messages to all destinations. Therefor, receivers may get messages
> > with incorrect order, non-fragment messages may come before
> fragmented
> > messages.
> > For example, it may lead to OUT OF ORDER for IMMNDs during IMMD sync.
> > - Solution: support send multicast each fragmented messages to avoid
> > disorder of arrived broadcast messages.
> > ---
> >  src/mds/mds_c_sndrcv.c |  3 +--
> >  src/mds/mds_dt_tipc.c  | 55
> > --
> >  2 files changed, 45 insertions(+), 13 deletions(-)
> >
> > diff --git a/src/mds/mds_c_sndrcv.c b/src/mds/mds_c_sndrcv.c index
> > 703bc8e..7850ac7 100644
> > --- a/src/mds/mds_c_sndrcv.c
> > +++ b/src/mds/mds_c_sndrcv.c
> > @@ -4496,8 +4496,7 @@ static uint32_t
> > mcm_pvt_process_svc_bcast_common(
> >   info_result->key.vdest_id,
> req, 0,
> >   info_result->key.adest, pri);
> > if ((svc_cb->subtn_info->prev_ver_sub_count == 0) &&
> > -   (tipc_mode_enabled) && (tipc_mcast_enabled) &&
> > -   (to_msg.bcast_buff_len < MDS_DIRECT_BUF_MAXSIZE)) {
> > +   (tipc_mode_enabled) && (tipc_mcast_enabled)) {
> > m_MDS_LOG_DBG(
> > "MDTM: Break while(1) prev_ver_sub_count: %d
> svc_id =%s(%d)
> > to_msg.bcast_buff_len: %d ",
> > svc_cb->subtn_info->prev_ver_sub_count,
> > diff --git a/src/mds/mds_dt_tipc.c b/src/mds/mds_dt_tipc.c index
> > a3abff5..656f79c 100644
> > --- a/src/mds/mds_dt_tipc.c
> > +++ b/src/mds/mds_dt_tipc.c
> > @@ -2856,6 +2856,7 @@ uint32_t
> mdtm_frag_and_send(MDTM_SEND_REQ *req,
> > uint32_t seq_num,
> > uint16_t frag_val = 0;
> > uint32_t sum_mds_hdr_plus_mdtm_hdr_plus_len;
> > int version = req->msg_arch_word & 0x7;
> > +   uint32_t ret = NCSCC_RC_SUCCESS;
> >
> > if (version > 1) {
> > sum_mds_hdr_plus_mdtm_hdr_plus_len = @@ -2952,11
> +2953,23 @@
> 
> > uint32_t mdtm_frag_and_send(MDTM_SEND_REQ *req, uint32_t seq_num,
> > free(body);
> > return NCSCC_RC_FAILURE;
> > }
> > -   m_MDS_LOG_DBG(
> > -   "MDTM:Sending message with Service
> > Seqno=%d, Fragment Seqnum=%d, frag_num=%d, TO
> > Dest_Tipc_id=<0x%08x:%u>",
> > -   req->svc_seq_num, seq_num, frag_val,
> > -   id.node, id.ref);
> > -   mdtm_sendto(body, len_buf, id);
> > +   if (((req->snd_type == MDS_SENDTYPE_R

Re: [devel] [PATCH 1/1] mds: support multicast fragmented messages [#3033]

2019-04-24 Thread Vu Minh Nguyen
Hi Thuan,

Tested broadcasting with large packages (each 1M). 

Ack with below comments.

Regards, Vu

> -Original Message-
> From: thuan.tran 
> Sent: Wednesday, April 24, 2019 12:00 PM
> To: hans.nordeb...@ericsson.com; Vu Minh Nguyen
> ; Minh Hon Chau  c...@users.sourceforge.net>
> Cc: opensaf-devel@lists.sourceforge.net; thuan.tran
> 
> Subject: [PATCH 1/1] mds: support multicast fragmented messages [#3033]
> 
> - Sender may send broadcast big messages (> 65K) then small messages (<
> 65K).
> Current MDS just loop via all destinations to unicast all fragmented
messages
> to one by one destinations. But sending multicast non-fragment messages to
> all
> destinations. Therefor, receivers may get messages with incorrect order,
> non-fragment messages may come before fragmented messages.
> For example, it may lead to OUT OF ORDER for IMMNDs during IMMD sync.
> - Solution: support send multicast each fragmented messages to avoid
> disorder of arrived broadcast messages.
> ---
>  src/mds/mds_c_sndrcv.c |  3 +--
>  src/mds/mds_dt_tipc.c  | 55
> --
>  2 files changed, 45 insertions(+), 13 deletions(-)
> 
> diff --git a/src/mds/mds_c_sndrcv.c b/src/mds/mds_c_sndrcv.c
> index 703bc8e..7850ac7 100644
> --- a/src/mds/mds_c_sndrcv.c
> +++ b/src/mds/mds_c_sndrcv.c
> @@ -4496,8 +4496,7 @@ static uint32_t
> mcm_pvt_process_svc_bcast_common(
> info_result->key.vdest_id,
req, 0,
> info_result->key.adest, pri);
>   if ((svc_cb->subtn_info->prev_ver_sub_count == 0) &&
> - (tipc_mode_enabled) && (tipc_mcast_enabled) &&
> - (to_msg.bcast_buff_len < MDS_DIRECT_BUF_MAXSIZE)) {
> + (tipc_mode_enabled) && (tipc_mcast_enabled)) {
>   m_MDS_LOG_DBG(
>   "MDTM: Break while(1) prev_ver_sub_count: %d
> svc_id =%s(%d)  to_msg.bcast_buff_len: %d ",
>   svc_cb->subtn_info->prev_ver_sub_count,
> diff --git a/src/mds/mds_dt_tipc.c b/src/mds/mds_dt_tipc.c
> index a3abff5..656f79c 100644
> --- a/src/mds/mds_dt_tipc.c
> +++ b/src/mds/mds_dt_tipc.c
> @@ -2856,6 +2856,7 @@ uint32_t mdtm_frag_and_send(MDTM_SEND_REQ
> *req, uint32_t seq_num,
>   uint16_t frag_val = 0;
>   uint32_t sum_mds_hdr_plus_mdtm_hdr_plus_len;
>   int version = req->msg_arch_word & 0x7;
> + uint32_t ret = NCSCC_RC_SUCCESS;
> 
>   if (version > 1) {
>   sum_mds_hdr_plus_mdtm_hdr_plus_len =
> @@ -2952,11 +2953,23 @@ uint32_t
> mdtm_frag_and_send(MDTM_SEND_REQ *req, uint32_t seq_num,
>   free(body);
>   return NCSCC_RC_FAILURE;
>   }
> - m_MDS_LOG_DBG(
> - "MDTM:Sending message with Service
> Seqno=%d, Fragment Seqnum=%d, frag_num=%d, TO
> Dest_Tipc_id=<0x%08x:%u>",
> - req->svc_seq_num, seq_num, frag_val,
> - id.node, id.ref);
> - mdtm_sendto(body, len_buf, id);
> + if (((req->snd_type == MDS_SENDTYPE_RBCAST)
> ||
> +  (req->snd_type == MDS_SENDTYPE_BCAST))
> &&
> + (version > 0) && (tipc_mcast_enabled)) {
> + m_MDS_LOG_DBG(
> + "MDTM:Send Multicast message
with
> Service Seqno=%d, Fragment Seqnum=%d, frag_num=%d "
> + "From svc_id = %s(%d) TO svc_id
=
> %s(%d)",
> + req->svc_seq_num, seq_num,
> frag_val,
> + get_svc_names(req->src_svc_id),
req-
> >src_svc_id,
> + get_svc_names(req->dest_svc_id),
> req->dest_svc_id);
> + ret = mdtm_mcast_sendto(body,
> len_buf, req);
> + } else {
> + m_MDS_LOG_DBG(
> + "MDTM:Sending message with
Service
> Seqno=%d, Fragment Seqnum=%d, frag_num=%d, TO
> Dest_Tipc_id=<0x%08x:%u>",
> + req->svc_seq_num, seq_num,
> frag_val,
> + id.node, id.ref);
> + ret = mdtm_sendto(b

Re: [devel] [PATCH 1/1] log: Log enhance to rotate log file via admin operation [#3022]

2019-04-18 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Tuesday, April 16, 2019 3:27 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Log enhance to rotate log file via admin
operation
> [#3022]
[Vu] might change the slogan to 'log: rotate log file ...'?
> 
> In some cases the Users want to rotate log file at the time althouth
> the file size hasn't been reached MAX FILE SIZE. Log service provides the
> new feature that user can rotate log file via admin operation.
> ---
>  src/ais/include/saLog.h|   3 +-
>  src/log/apitest/tet_LogOiOps.c |  76 
>  src/log/logd/lgs_imm.cc| 258
---
> --
>  src/log/logd/lgs_mbcsv.cc  |  51 ++--
>  src/log/logd/lgs_stream.cc | 153 
>  src/log/logd/lgs_stream.h  |   3 +
>  6 files changed, 342 insertions(+), 202 deletions(-)
> 
> diff --git a/src/ais/include/saLog.h b/src/ais/include/saLog.h
> index 313c8d287..c28750600 100644
> --- a/src/ais/include/saLog.h
> +++ b/src/ais/include/saLog.h
> @@ -196,7 +196,8 @@ extern "C" {
> 
>  /* Admin operation IDs */
>   typedef enum {
> - SA_LOG_ADMIN_CHANGE_FILTER = 1
> + SA_LOG_ADMIN_CHANGE_FILTER = 1,
> + SA_LOG_ADMIN_ROTATE_FILE = 2
>   } saLogAdminOperationIdT;
> 
>  /*
> diff --git a/src/log/apitest/tet_LogOiOps.c
b/src/log/apitest/tet_LogOiOps.c
> index e74cd5331..ea96d86ce 100644
> --- a/src/log/apitest/tet_LogOiOps.c
> +++ b/src/log/apitest/tet_LogOiOps.c
> @@ -5479,6 +5479,78 @@ done:
>  _saLogStreamFixedLogRecordSize,
> SA_IMM_ATTR_SAUINT32T);
>  }
> 
> +//
> +// Test case for verifying the admin operation rotate log file for
> +// configuration application is ok
> +// Steps:
> +// 1. Create configuration app stream
> +// 2. Verify command admin operation rotate log file is ok
> +// 3. Delete configuration app stream
> +//
> +void admin_rotate_log_file(void)
> +{
> + int rc = 0;
> + char command[MAX_DATA];
> + const char *object_dn =
> +
>   "safLgStrCfg=admin_rotate_file,safApp=safLogService";
> +
> + // Create configuration application stream
> + sprintf(command, "immcfg -c SaLogStreamConfig %s "
> + "-a saLogStreamPathName=. "
> + "-a saLogStreamFileName=admin_rotate_file ",
> object_dn);
> + rc = systemCall(command);
> + osaf_nanosleep();
> + if (rc == 0) {
> + // Admin operation rotate log file
> + sprintf(command, "immadm -o 2 %s", object_dn);
> + rc = systemCall(command);
> + rc_validate(rc, 0);
> +
> + // Delete object
> + sprintf(command, "immcfg -d %s", object_dn);
> + systemCall(command);
> + } else {
> + rc_validate(rc, 0);
> + }
> +}
> +
> +//
> +// Test case for verifying the admin operation rotate log file for
> +// configuration application is ok
> +// Steps:
> +// 1. Create configuration app stream
> +// 2. Verify command admin operation rotate log file with param fails
> +// 3. Delete configuration app stream
> +//
> +void admin_rotate_log_file_with_param(void)
> +{
> + int rc = 0;
> + char command[MAX_DATA];
> + const char *object_dn =
> +
>   "safLgStrCfg=admin_rotate_file1,safApp=safLogService";
> +
> + // Create configuration application stream
> + sprintf(command, "immcfg -c SaLogStreamConfig %s"
> + " -a saLogStreamPathName=. "
> + "-a saLogStreamFileName=admin_rotate_file1 ",
> + object_dn);
> + rc = systemCall(command);
> + if (rc == 0) {
> + // Admin operation opId = 2 with parameter
> + sprintf(command, "immadm -o 2 -p "
> + "saLogStreamSeverityFilter:SA_UINT32_T:7 %s
> >"
> + " /dev/null 2>&1 ", object_dn);
> + rc = system(command);
> + rc_validate(WEXITSTATUS(rc), 1);
> +
> + // Delete object
> + sprintf(command, "immcfg -d %s", object_dn);
> + systemCall(command);
> + } else {
> + rc_validate(rc, 0);
> + }
> +}
> +
>  __attribute__((constructor)) static void saOiOperations_constructor(void)
>  {
>   /* Stream objects */
> @@ -5835,4 +5907,8 @@ __attribute__((constructor)) static void
> saOiOperations_constructor(void)
>   test_case_add(
>   6, verLogFileRotate,
>   "Verify that log file is not rotated if file size doesn't reach
max file
> size (ticket1439)");
> + test_case_add(6, admin_rotate_log_file,
> +   "Verify admin operation rotate log file is ok");
> + test_case_add(6, admin_rotate_log_file_with_param,
> +   "Verify admin operation rotate log file with parameter
> fails");
>  }
> 

[devel] [PATCH 0/1] Review Request for imm: fix coredump on immnd during upgrade [#3030]

2019-04-17 Thread Vu Minh Nguyen
Summary: imm: fix coredump on immnd during upgrade [#3030]
Review request for Ticket(s): 3030
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3030
Base revision: ecbdd454813cb2e5994143aa202535374d119392
Personal repository: git://git.code.sf.net/u/winhvu/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 7c90172e2fc6ff1700668db98063a9253ec71a0e
Author: Vu Minh Nguyen 
Date:   Wed, 17 Apr 2019 16:09:57 +0700

imm: fix coredump on immnd during upgrade [#3030]

The assertion about the existence of the new added attribute
`saImmFileSystemStatus` should be done if the admOp ID is
either 400 or 401.



Complete diffstat:
--
 src/imm/common/immsv_api.h   | 2 +-
 src/imm/config/immsv_classes.xml | 1 -
 src/imm/immnd/ImmModel.cc| 7 ---
 3 files changed, 5 insertions(+), 5 deletions(-)


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


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


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] imm: fix coredump on immnd during upgrade [#3030]

2019-04-17 Thread Vu Minh Nguyen
The assertion about the existence of the new added attribute
`saImmFileSystemStatus` should be done if the admOp ID is
either 400 or 401.
---
 src/imm/common/immsv_api.h   | 2 +-
 src/imm/config/immsv_classes.xml | 1 -
 src/imm/immnd/ImmModel.cc| 7 ---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/imm/common/immsv_api.h b/src/imm/common/immsv_api.h
index 3ab3892d1..c37a624ed 100644
--- a/src/imm/common/immsv_api.h
+++ b/src/imm/common/immsv_api.h
@@ -151,7 +151,7 @@ typedef enum {
 #define OPENSAF_IMM_FLAG_PRT50_ALLOW 0x0080
 #define OPENSAF_IMM_FLAG_PRT51_ALLOW 0x0100
 #define OPENSAF_IMM_FLAG_PRT51710_ALLOW 0x0200
-#define OPENSAF_IMM_FLAG_PRT51906_ALLOW 0x0800
+#define OPENSAF_IMM_FLAG_PRT51906_ALLOW 0x0400
 
 #define OPENSAF_IMM_SERVICE_NAME "safImmService"
 
diff --git a/src/imm/config/immsv_classes.xml b/src/imm/config/immsv_classes.xml
index c6f448e82..193ccd2e2 100644
--- a/src/imm/config/immsv_classes.xml
+++ b/src/imm/config/immsv_classes.xml
@@ -50,7 +50,6 @@
saImmFileSystemStatus
SA_UINT32_T
SA_RUNTIME
-   SA_RUNTIME
SA_CACHED


diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
index 2cf2649cf..1435690c0 100644
--- a/src/imm/immnd/ImmModel.cc
+++ b/src/imm/immnd/ImmModel.cc
@@ -13873,9 +13873,6 @@ SaAisErrorT ImmModel::admoImmMngtObject(const 
ImmsvOmAdminOperationInvoke* req,
   valuep = (ImmAttrValue*)avi->second;
 
   auto fs_attr_iter = immObject->mAttrValueMap.find(saImmFileSystemStatus);
-  osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
-  auto fs_attr_value = fs_attr_iter->second;
-
 
   if (req->operationId == SA_IMM_ADMIN_EXPORT) { /* Standard */
 err = SA_AIS_ERR_NOT_SUPPORTED;
@@ -13900,11 +13897,15 @@ SaAisErrorT ImmModel::admoImmMngtObject(const 
ImmsvOmAdminOperationInvoke* req,
   } else if (req->operationId == SA_IMM_ADMIN_FS_AVAILABLE) {
 LOG_NO("Received: immadm -o %u safRdn=immManagement,safApp=safImmService",
SA_IMM_ADMIN_FS_AVAILABLE);
+osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
+auto fs_attr_value = fs_attr_iter->second;
 sFileSystemAvailable = true;
 fs_attr_value->setValue_int(1);
   } else if (req->operationId == SA_IMM_ADMIN_FS_UNAVAILABLE) {
 LOG_NO("Received: immadm -o %u safRdn=immManagement,safApp=safImmService",
SA_IMM_ADMIN_FS_UNAVAILABLE);
+osafassert(fs_attr_iter != immObject->mAttrValueMap.end());
+auto fs_attr_value = fs_attr_iter->second;
 sFileSystemAvailable = false;
 fs_attr_value->setValue_int(0);
   } else {
-- 
2.19.2



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


Re: [devel] [PATCH 1/1] imm: return try-again on write requests while fs is unavailable [#3019]

2019-04-10 Thread Vu Minh Nguyen
catch possible dangers as
> >> this case seems to be.
> >> >
> >> >Finally one more thing.
> >> >The main reason that this problem is occuring is the unavailability of the
> file
> >> system.
> >> >As long as the file system is unavailabale the user will have a problem in
> >> obtaining the result of a commit request that
> >> >has gone "to the file system". It goes via the sqlite library of course.
> >> >
> >> >
> >> >/Anders
> >> >
> >> >>Ursprungligt meddelande
> >> >>Från : vu.m.ngu...@dektech.com.au
> >> >>Datum : 2019-04-09 - 04:55 ()
> >> >>Till : anders.bjornerst...@telia.com, gary@dektech.com.au,
> >> lennart.l...@ericsson.com, hans.nordeb...@ericsson.com
> >> >>Kopia : opensaf-devel@lists.sourceforge.net
> >> >>Ämne : Re: [devel] [PATCH 1/1] imm: return try-again on write requests
> >> while fs is unavailable [#3019]
> >> >>
> >> >>Hi AndersBj,
> >> >>
> >> >>Thanks for your comments.
> >> >>
> >> >>However, I need your help to provide more info on your concern so that
> I
> >> can fully understand it. Which use case below describe exactly your
> concern
> >> about "additional Apply requests"?
> >> >>
> >> >>Here are some use cases that I can think about the "additional apply
> >> requests".
> >> >>
> >> >>1) "Additional Apply requests" are invoked after the first apply has
> returned
> >> with SA_AIS_OK (the transaction has been committed).
> >> >>The additional apply should get FAILED_OPERATION as the CCB has
> been
> >> applied.
> >> >>
> >> >>2) "Additional Apply requests" are invoked after the first apply has
> returned
> >> due to timeout even the transaction commit is in progress.
> >> >>The additional apply request should get BAD_HANDLE as the ccb has
> been
> >> cleaned up as the result of timeout from the first one.
> >> >>
> >> >>3) "Additional Apply requests" are invoked concurrently in another
> thread
> >> while the first one is on-going.
> >> >>The additional apply request should get TRY_AGAIN as in legacy code
> the
> >> first call is blocking on waiting for reply
> >> >>even such code is *not allowed* though - user should make sure not
> using
> >> same handle concurrently from different threads.
> >> >>
> >> >>4) Other cases
> >> >>
> >> >>Regards, Vu
> >> >>
> >> >>> -Original Message-
> >> >>> From: and...@acm.org 
> >> >>> Sent: Monday, April 8, 2019 6:15 PM
> >> >>> To: gary@dektech.com.au; vu.m.ngu...@dektech.com.au;
> >> >>> lennart.l...@ericsson.com; hans.nordeb...@ericsson.com
> >> >>> Cc: opensaf-devel@lists.sourceforge.net
> >> >>> Subject: Re: [devel] [PATCH 1/1] imm: return try-again on write
> requests
> >> >>> while fs is unavailable [#3019]
> >> >>>
> >> >>> Hi,
> >> >>>
> >> >>> I think this ticket (#3019) is erroneous and dangerous.
> >> >>> If you currently have an apply in progress (a commit of a transaction)
> >> that
> >> >>> means you DONT KNOW if the operation will/has succeeded.
> >> >>> What you DO know is that the wrtite/commit most likely will succeed
> or
> >> fail
> >> >>> at some time.
> >> >>> If you during the uncertainty generate additional Apply requests on
> the
> >> same
> >> >>> CCB, then you can be pretty sure that those requests
> >> >>> do not "by pass" the blocked request. Instead you can be pretty sure
> that
> >> the
> >> >>> redundant apply request(s) will return an error code
> >> >>> which most likely will cause the user to conclude that the CCB faile to
> >> apply,
> >> >>> when in fact this is uncertain and likely to be false.
> >> >>>
> >> >>> A disaster in other words.
> >> >>>
> >> >>> /AndersBj
> >> >>>
> >> >>>
> >> >>> >Ursprungligt meddelande
> >> >>> 

Re: [devel] [PATCH 1/1] imm: return try-again on write requests while fs is unavailable [#3019]

2019-04-09 Thread Vu Minh Nguyen
t; >that the handle is never used concurrently.
> >
> >In summary.
> >I dont know what problem this ticket is trying to fix and the fix it proposes
> seems both dangerous and misguided.
> >
> >If I missed something then dont hesitate to point it out.
> >Maybe a lot has happened in the implementation or even the SAF standard
> since I left.
> >I have not tried to follow it.
> >
> >I only keep an eye on the IMM ticket process to catch possible dangers as
> this case seems to be.
> >
> >Finally one more thing.
> >The main reason that this problem is occuring is the unavailability of the 
> >file
> system.
> >As long as the file system is unavailabale the user will have a problem in
> obtaining the result of a commit request that
> >has gone "to the file system". It goes via the sqlite library of course.
> >
> >
> >/Anders
> >
> >>Ursprungligt meddelande
> >>Från : vu.m.ngu...@dektech.com.au
> >>Datum : 2019-04-09 - 04:55 ()
> >>Till : anders.bjornerst...@telia.com, gary@dektech.com.au,
> lennart.l...@ericsson.com, hans.nordeb...@ericsson.com
> >>Kopia : opensaf-devel@lists.sourceforge.net
> >>Ämne : Re: [devel] [PATCH 1/1] imm: return try-again on write requests
> while fs is unavailable [#3019]
> >>
> >>Hi AndersBj,
> >>
> >>Thanks for your comments.
> >>
> >>However, I need your help to provide more info on your concern so that I
> can fully understand it. Which use case below describe exactly your concern
> about "additional Apply requests"?
> >>
> >>Here are some use cases that I can think about the "additional apply
> requests".
> >>
> >>1) "Additional Apply requests" are invoked after the first apply has 
> >>returned
> with SA_AIS_OK (the transaction has been committed).
> >>The additional apply should get FAILED_OPERATION as the CCB has been
> applied.
> >>
> >>2) "Additional Apply requests" are invoked after the first apply has 
> >>returned
> due to timeout even the transaction commit is in progress.
> >>The additional apply request should get BAD_HANDLE as the ccb has been
> cleaned up as the result of timeout from the first one.
> >>
> >>3) "Additional Apply requests" are invoked concurrently in another thread
> while the first one is on-going.
> >>The additional apply request should get TRY_AGAIN as in legacy code the
> first call is blocking on waiting for reply
> >>even such code is *not allowed* though - user should make sure not using
> same handle concurrently from different threads.
> >>
> >>4) Other cases
> >>
> >>Regards, Vu
> >>
> >>> -Original Message-
> >>> From: and...@acm.org 
> >>> Sent: Monday, April 8, 2019 6:15 PM
> >>> To: gary@dektech.com.au; vu.m.ngu...@dektech.com.au;
> >>> lennart.l...@ericsson.com; hans.nordeb...@ericsson.com
> >>> Cc: opensaf-devel@lists.sourceforge.net
> >>> Subject: Re: [devel] [PATCH 1/1] imm: return try-again on write requests
> >>> while fs is unavailable [#3019]
> >>>
> >>> Hi,
> >>>
> >>> I think this ticket (#3019) is erroneous and dangerous.
> >>> If you currently have an apply in progress (a commit of a transaction)
> that
> >>> means you DONT KNOW if the operation will/has succeeded.
> >>> What you DO know is that the wrtite/commit most likely will succeed or
> fail
> >>> at some time.
> >>> If you during the uncertainty generate additional Apply requests on the
> same
> >>> CCB, then you can be pretty sure that those requests
> >>> do not "by pass" the blocked request. Instead you can be pretty sure that
> the
> >>> redundant apply request(s) will return an error code
> >>> which most likely will cause the user to conclude that the CCB faile to
> apply,
> >>> when in fact this is uncertain and likely to be false.
> >>>
> >>> A disaster in other words.
> >>>
> >>> /AndersBj
> >>>
> >>>
> >>> >Ursprungligt meddelande
> >>> >Från : vu.m.ngu...@dektech.com.au
> >>> >Datum : 2019-04-08 - 03:05 ()
> >>> >Till : hans.nordeb...@ericsson.com, lennart.l...@ericsson.com,
> >>> gary@dektech.com.au
> >>> >Kopia : opensaf-devel@lists.sourceforge.net
> >>> >Ämne 

Re: [devel] [PATCH 1/1] imm: return try-again on write requests while fs is unavailable [#3019]

2019-04-08 Thread Vu Minh Nguyen
Hi AndersBj,

Thanks for your comments. 

However, I need your help to provide more info on your concern so that I can 
fully understand it. Which use case below describe exactly your concern about 
"additional Apply requests"?

Here are some use cases that I can think about the "additional apply requests".

1) "Additional Apply requests" are invoked after the first apply has returned 
with SA_AIS_OK (the transaction has been committed).
The additional apply should get FAILED_OPERATION as the CCB has been applied. 

2) "Additional Apply requests" are invoked after the first apply has returned 
due to timeout even the transaction commit is in progress.
The additional apply request should get BAD_HANDLE as the ccb has been cleaned 
up as the result of timeout from the first one.

3) "Additional Apply requests" are invoked concurrently in another thread while 
the first one is on-going.
The additional apply request should get TRY_AGAIN as in legacy code the first 
call is blocking on waiting for reply 
even such code is *not allowed* though - user should make sure not using same 
handle concurrently from different threads. 

4) Other cases

Regards, Vu

> -Original Message-
> From: and...@acm.org 
> Sent: Monday, April 8, 2019 6:15 PM
> To: gary@dektech.com.au; vu.m.ngu...@dektech.com.au;
> lennart.l...@ericsson.com; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1/1] imm: return try-again on write requests
> while fs is unavailable [#3019]
> 
> Hi,
> 
> I think this ticket (#3019) is erroneous and dangerous.
> If you currently have an apply in progress (a commit of a transaction) that
> means you DONT KNOW if the operation will/has succeeded.
> What you DO know is that the wrtite/commit most likely will succeed or fail
> at some time.
> If you during the uncertainty generate additional Apply requests on the same
> CCB, then you can be pretty sure that those requests
> do not "by pass" the blocked request. Instead you can be pretty sure that the
> redundant apply request(s) will return an error code
> which most likely will cause the user to conclude that the CCB faile to apply,
> when in fact this is uncertain and likely to be false.
> 
> A disaster in other words.
> 
> /AndersBj
> 
> 
> >Ursprungligt meddelande
> >Från : vu.m.ngu...@dektech.com.au
> >Datum : 2019-04-08 - 03:05 ()
> >Till : hans.nordeb...@ericsson.com, lennart.l...@ericsson.com,
> gary@dektech.com.au
> >Kopia : opensaf-devel@lists.sourceforge.net
> >Ämne : Re: [devel] [PATCH 1/1] imm: return try-again on write requests
> while fs is unavailable [#3019]
> >
> >Hi all,
> >
> >Have you had time to review the patch? I will push this ticket by this
> >Wednesday if there is no comment/feedback.
> >
> >Regards, Vu
> >
> >> -----Original Message-
> >> From: Vu Minh Nguyen 
> >> Sent: Tuesday, March 26, 2019 1:19 PM
> >> To: hans.nordeb...@ericsson.com; lennart.l...@ericsson.com;
> >> gary@dektech.com.au
> >> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> >> 
> >> Subject: [PATCH 1/1] imm: return try-again on write requests while fs is
> >> unavailable [#3019]
> >>
> >> When underlying file system is unresponsive to pbe write request, all IMM
> >> requests that required to be persistent such as creating an IMM object or
> >> creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.
> >>
> >> This changeset introduces two administrative operations which are
> provided
> >> to
> >> let user inform IMM if the file system is unavailable or not. If the file
> >> system is not available, IMM will return SA_AIS_ERR_TRY_AGAIN earlier to
> >> the
> >> caller instead of SA_AIS_ERR_TIMEOUT.
> >>
> >> Besides, a new IMM attribute, saImmFileSystemStatus, is added to
> >> SaImmMngt class; the value shows the current status of the file system
> >> according to IMM view.
> >> ---
> >>  src/imm/README|  49 ++-
> >>  .../management/test_saImmOmClassCreate_2.c| 136
> >> ++
> >>  src/imm/common/immsv_api.h|   5 +-
> >>  src/imm/config/immsv_classes.xml  |   7 +
> >>  src/imm/immnd/ImmModel.cc |  91 ++--
> >>  src/imm/immnd/ImmModel.h  |   1 +
> >>  src/imm/immnd/immnd_evt.c |  11 +-
> >>  src/imm/immnd/immnd_init.h|   1 +
> >>  8 files changed, 288 insertions(+), 

Re: [devel] [PATCH 1/1] imm: return try-again on write requests while fs is unavailable [#3019]

2019-04-07 Thread Vu Minh Nguyen
Hi all,

Have you had time to review the patch? I will push this ticket by this
Wednesday if there is no comment/feedback.

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen 
> Sent: Tuesday, March 26, 2019 1:19 PM
> To: hans.nordeb...@ericsson.com; lennart.l...@ericsson.com;
> gary@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] imm: return try-again on write requests while fs is
> unavailable [#3019]
> 
> When underlying file system is unresponsive to pbe write request, all IMM
> requests that required to be persistent such as creating an IMM object or
> creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.
> 
> This changeset introduces two administrative operations which are provided
> to
> let user inform IMM if the file system is unavailable or not. If the file
> system is not available, IMM will return SA_AIS_ERR_TRY_AGAIN earlier to
> the
> caller instead of SA_AIS_ERR_TIMEOUT.
> 
> Besides, a new IMM attribute, saImmFileSystemStatus, is added to
> SaImmMngt class; the value shows the current status of the file system
> according to IMM view.
> ---
>  src/imm/README|  49 ++-
>  .../management/test_saImmOmClassCreate_2.c| 136
> ++
>  src/imm/common/immsv_api.h|   5 +-
>  src/imm/config/immsv_classes.xml  |   7 +
>  src/imm/immnd/ImmModel.cc |  91 ++--
>  src/imm/immnd/ImmModel.h  |   1 +
>  src/imm/immnd/immnd_evt.c |  11 +-
>  src/imm/immnd/immnd_init.h|   1 +
>  8 files changed, 288 insertions(+), 13 deletions(-)
> 
> diff --git a/src/imm/README b/src/imm/README
> index 132ee0ac0..8e91b534c 100644
> --- a/src/imm/README
> +++ b/src/imm/README
> @@ -2969,7 +2969,7 @@ attribute in the object:
> 
>  The following is the shell command:
> 
> -immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:1024 \
> +immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:512 \
> opensafImm=opensafImm,safApp=safImmService
> 
>  This will set bit 10 of the 'opensafImmNostdFlags' runtime attribute
inside
> the immsv.
> @@ -3027,7 +3027,6 @@ expires.
>  To be possible to use this new feature, bit 10 must be set in
>  opensafImmNostdFlags attribute in IMM object.
> 
> -
>  Provide an admin-operation for re-generating backend database from one in
> RAM
> 
> ==
> ===
>  https://sourceforge.net/p/opensaf/tickets/2940/
> @@ -3046,6 +3045,52 @@ back-end database from one in memory to keep
> them both consistent.
> 
>  immadm -o 303 safRdn=immManagement,safApp=safImmService
> 
> +Return try-again on write requests while file system is unavailable
> +=
> ==
> +https://sourceforge.net/p/opensaf/tickets/3019
> +
> +When underlying file system is unresponsive to pbe write request, all IMM
> +requests that required to be persistent such as creating an IMM object or
> +creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.
> +
> +Since OpenSAF version 5.19.06, IMM introduces two new administrative
> operations
> +which are used to inform IMM if the file system is unavailable or not. If
the
> +file system is not available for write, IMM will return
> SA_AIS_ERR_TRY_AGAIN
> +earlier to the caller instead of SA_AIS_ERR_TIMEOUT.
> +
> +Operation ID 400 is used to inform the file system is unavailable:
> + immadm -o 400 safRdn=immManagement,safApp=safImmService
> +
> +and operation ID 401 is used to inform the file system is back:
> + immadm -o 401 safRdn=immManagement,safApp=safImmService
> +
> +Besides, a new runtime IMM attribute, saImmFileSystemStatus, is added to
> +SaImmMngt class; the value shows the current status of the file system:
> +saImmFileSystemStatus = 0 means the file system is unavailable and
> +saImmFileSystemStatus = 1 means the file system is fine for write.
> +
> +Fetching the value of that attribute, other services or applications that
> +have activities to read/write data from/to the file system may benefit as
> well.
> +
> +Note that, to use this new feature, bit 11 must be set in
> opensafImmNostdFlags.
> +
> +The following is the shell command to set the 11st bit:
> + immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:1024 \
> + opensafImm=opensafImm,safApp=safImmService
> +
> +In summary:
> + Bit 1 controls schema (imm class) changes allowed or not (normally
off/0).
> + Bit 2 controls OpenSAF4.1 protocols allowed or not (normally on/1).
> + Bit 3 controls OpenSAF4.3 protocols allowed or not 

Re: [devel] [PATCH 1/1] log: fix logd crash due to well known stream has numOpeners=0 [#3018]

2019-04-01 Thread Vu Minh Nguyen
Ack

Regards, Vu

> -Original Message-
> From: canht32 
> Sent: Thursday, March 28, 2019 1:15 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; canht32
> 
> Subject: [PATCH 1/1] log: fix logd crash due to well known stream has
> numOpeners=0 [#3018]
> 
> If client closes stream is successful in active node but it cannot be
> checkpointed
> to standby node. This causes the "numOpeners" is different between active
> and standby.
> It also different number of streams that client opened  between standby
and
> active.
> When the client open again that stream, the "numOpeners" is updated to be
> equal between
> active and standby while the client own number of streams is still
different
> betwwen
> active and standby. This will causes the logd crash.
> 
> Should restart standby node if handling the checkpoint of reopening stream
> with different of "numOpeners" between active and standby node.
> ---
>  src/log/logd/lgs_mbcsv.cc | 17 +++--
>  1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/src/log/logd/lgs_mbcsv.cc b/src/log/logd/lgs_mbcsv.cc
> index 8f66fb926..51201dbb7 100644
> --- a/src/log/logd/lgs_mbcsv.cc
> +++ b/src/log/logd/lgs_mbcsv.cc
> @@ -800,7 +800,6 @@ static uint32_t edu_enc_streams(lgs_cb_t *cb,
> NCS_UBAID *uba) {
>   *
>   * Notes : None.
> 
> **
> */
> -
>  static uint32_t edu_enc_reg_list(lgs_cb_t *cb, NCS_UBAID *uba) {
>log_client_t *client = NULL;
>lgs_ckpt_initialize_msg_t ckpt_reg_rec;
> @@ -2086,11 +2085,17 @@ uint32_t ckpt_proc_open_stream(lgs_cb_t *cb,
> void *data) {
>stream = log_stream_get_by_name(param->logStreamName);
>if (stream != NULL) {
>  TRACE("\tExisting stream - id %u", stream->streamId);
> -/*
> -** Update stream attributes that might change when a stream is
> -** opened a second time.
> -*/
> -stream->numOpeners = param->numOpeners;
> +
> +// Update the "numOpeners" on standby when reopening the stream
> +++stream->numOpeners;
> +if (param->numOpeners != stream->numOpeners) {
> +  // In some cases the checkpoint of closing stream fail and standby
node
> +  // haven't received the checkpoint. The "numOpeners" is different
> between
> +  // standby and active node. Should restart standby node if
reopening
> +  // the stream
> +  lgs_exit("NumOpeners is different between standby and active node",
> +   SA_AMF_COMPONENT_RESTART);
> +}
>} else {
>  TRACE("\tNew stream %s, id %u", param->logStreamName, param-
> >streamId);
> 
> --
> 2.15.1




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


[devel] [PATCH 1/1] imm: return try-again on write requests while fs is unavailable [#3019]

2019-03-26 Thread Vu Minh Nguyen
When underlying file system is unresponsive to pbe write request, all IMM
requests that required to be persistent such as creating an IMM object or
creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.

This changeset introduces two administrative operations which are provided to
let user inform IMM if the file system is unavailable or not. If the file
system is not available, IMM will return SA_AIS_ERR_TRY_AGAIN earlier to the
caller instead of SA_AIS_ERR_TIMEOUT.

Besides, a new IMM attribute, saImmFileSystemStatus, is added to
SaImmMngt class; the value shows the current status of the file system
according to IMM view.
---
 src/imm/README|  49 ++-
 .../management/test_saImmOmClassCreate_2.c| 136 ++
 src/imm/common/immsv_api.h|   5 +-
 src/imm/config/immsv_classes.xml  |   7 +
 src/imm/immnd/ImmModel.cc |  91 ++--
 src/imm/immnd/ImmModel.h  |   1 +
 src/imm/immnd/immnd_evt.c |  11 +-
 src/imm/immnd/immnd_init.h|   1 +
 8 files changed, 288 insertions(+), 13 deletions(-)

diff --git a/src/imm/README b/src/imm/README
index 132ee0ac0..8e91b534c 100644
--- a/src/imm/README
+++ b/src/imm/README
@@ -2969,7 +2969,7 @@ attribute in the object:
 
 The following is the shell command:
 
-immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:1024 \
+immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:512 \
opensafImm=opensafImm,safApp=safImmService
 
 This will set bit 10 of the 'opensafImmNostdFlags' runtime attribute inside 
the immsv.
@@ -3027,7 +3027,6 @@ expires.
 To be possible to use this new feature, bit 10 must be set in
 opensafImmNostdFlags attribute in IMM object.
 
-
 Provide an admin-operation for re-generating backend database from one in RAM
 =
 https://sourceforge.net/p/opensaf/tickets/2940/
@@ -3046,6 +3045,52 @@ back-end database from one in memory to keep them both 
consistent.
 
 immadm -o 303 safRdn=immManagement,safApp=safImmService
 
+Return try-again on write requests while file system is unavailable
+===
+https://sourceforge.net/p/opensaf/tickets/3019
+
+When underlying file system is unresponsive to pbe write request, all IMM
+requests that required to be persistent such as creating an IMM object or
+creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.
+
+Since OpenSAF version 5.19.06, IMM introduces two new administrative operations
+which are used to inform IMM if the file system is unavailable or not. If the
+file system is not available for write, IMM will return SA_AIS_ERR_TRY_AGAIN
+earlier to the caller instead of SA_AIS_ERR_TIMEOUT.
+
+Operation ID 400 is used to inform the file system is unavailable:
+ immadm -o 400 safRdn=immManagement,safApp=safImmService
+
+and operation ID 401 is used to inform the file system is back:
+ immadm -o 401 safRdn=immManagement,safApp=safImmService
+
+Besides, a new runtime IMM attribute, saImmFileSystemStatus, is added to
+SaImmMngt class; the value shows the current status of the file system:
+saImmFileSystemStatus = 0 means the file system is unavailable and
+saImmFileSystemStatus = 1 means the file system is fine for write.
+
+Fetching the value of that attribute, other services or applications that
+have activities to read/write data from/to the file system may benefit as well.
+
+Note that, to use this new feature, bit 11 must be set in opensafImmNostdFlags.
+
+The following is the shell command to set the 11st bit:
+ immadm -o 1 -p opensafImmNostdFlags:SA_UINT32_T:1024 \
+   opensafImm=opensafImm,safApp=safImmService
+
+In summary:
+ Bit 1 controls schema (imm class) changes allowed or not (normally off/0).
+ Bit 2 controls OpenSAF4.1 protocols allowed or not (normally on/1).
+ Bit 3 controls OpenSAF4.3 protocols allowed or not (normally on/1).
+ Bit 4 controls 2PBE oneSafe2PBE, see 2PBE feature in OpenSAF4.4 above 
(normally off/0).
+ Bit 5 controls OpenSAF4.5 protocols allowed or not (normally on/1).
+ Bit 6 controls OpenSAF4.6 protocols allowed or not (normally on/1).
+ Bit 7 controls OpenSAF4.7 protocols allowed or not (normally on/1).
+ Bit 8 controls OpenSAF5.0 protocols allowed or not (normally on/1).
+ Bit 9 controls OpenSAF5.1 protocols allowed or not (normally on/1).
+ Bit 10 controls OpenSAF5.17.11 protocols allowed or not (normally on/1).
+ Bit 11 controls OpenSAF5.19.06 protocols allowed or not (normally on/1).
+
 
 DEPENDENCIES
 
diff --git a/src/imm/apitest/management/test_saImmOmClassCreate_2.c 
b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
index f43884e1b..9e12f4f61 100644
--- a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
+++ b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
@@ -16,6 +16,7 @@
  */
 
 

[devel] [PATCH 0/1] Review Request for imm: return try-again on write requests while fs is unavailable [#3019]

2019-03-26 Thread Vu Minh Nguyen
Summary: imm: return try-again on write requests while fs is unavailable [#3019]
Review request for Ticket(s): 3019
Peer Reviewer(s): Hans, Lennart, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3019
Base revision: 7f68859e0dc70179eff72515f28bc69ffd1ab208
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 3b1c3551f74290e1eda711f7136a40d2168ab375
Author: Vu Minh Nguyen 
Date:   Tue, 26 Mar 2019 13:13:46 +0700

imm: return try-again on write requests while fs is unavailable [#3019]

When underlying file system is unresponsive to pbe write request, all IMM
requests that required to be persistent such as creating an IMM object or
creating an IMM class likely gets SA_AIS_ERR_TIMEOUT.

This changeset introduces two administrative operations which are provided to
let user inform IMM if the file system is unavailable or not. If the file
system is not available, IMM will return SA_AIS_ERR_TRY_AGAIN earlier to the
caller instead of SA_AIS_ERR_TIMEOUT.

Besides, a new IMM attribute, saImmFileSystemStatus, is added to
SaImmMngt class; the value shows the current status of the file system
according to IMM view.



Complete diffstat:
--
 src/imm/README |  49 +++-
 .../apitest/management/test_saImmOmClassCreate_2.c | 136 +
 src/imm/common/immsv_api.h |   5 +-
 src/imm/config/immsv_classes.xml   |   7 ++
 src/imm/immnd/ImmModel.cc  |  91 --
 src/imm/immnd/ImmModel.h   |   1 +
 src/imm/immnd/immnd_evt.c  |  11 +-
 src/imm/immnd/immnd_init.h |   1 +
 8 files changed, 288 insertions(+), 13 deletions(-)


Testing Commands:
-
02 new test cases are added:
immomtest 2 58
immomtest 2 59


Testing, Expected Results:
--
All tests are passed


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly 

Re: [devel] [PATCH 1/1] log: logd crash due to well known stream has numOpeners = 0 [#3018]

2019-03-22 Thread Vu Minh Nguyen
Hi Canh,

 

Thanks for your good finding.

 

There is other possibility that well-known streams can be deleted as well.
Looking at below code, proc_stream_open_msg().

 

rc = lgs_mds_msg_send(cb, , >fr_dest, >mds_ctxt,

MDS_SEND_PRIORITY_HIGH);

 

  // Checkpoint the opened stream

if (ais_rv == SA_AIS_OK) {

lgs_ckpt_stream_open(logStream, open_sync_param->client_id);

}

 

If the active node is rebooted or is split from the peer after sending OK
reply to log agent *and* before forwarding the update to standby node, 

the numberOpeners value at standby will be less than one comparing with the
actual total number of connections toward that stream.

 

I think, we should log Warning or Error in case checkpoint data gets failed
and never close well-known streams even the numberOpenners is zero(0).

 

Regards, Vu

 

From: Canh Van Truong  
Sent: Friday, March 22, 2019 12:01 PM
To: 'Vu Minh Nguyen' ; lennart.l...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] log: logd crash due to well known stream has
numOpeners = 0 [#3018]

 

Hi Lennart and aVu,

 

Thanks for your review.

I check the code again and guess the condition for the crash:

1/Current "numOpeners" of one well known stream = 2. This mean that just one
client open this stream. LOGD get close that stream request from client. The
closing stream is successful on active node. But checkpoiting to standby
have problem and cannot closing stream on standby. 

2/Now the "numOpeners" on active node is (1), on standby node is (2). And
still have one client own that well known stream on standby although the
client already closed the stream on active node. 

3/One other client open again that stream again. "numOpeners" on both active
node and standby is (2). Only one client own the stream, but 2 client own
that stream on standby.

4/Reboot active node and assume that 2 clients that is on active node, so 2
client will be downed. Standby node up to active will close that well known
stream 2 times with  numOpeners = 2. Then numOpeners will be zero for the
well known stream.

 

I don't see any more hint that cause the issue happen. 

 

Regards

Canh

From: Vu Minh Nguyen mailto:vu.m.ngu...@dektech.com.au> > 
Sent: Monday, March 18, 2019 2:14 PM
To: 'Canh Van Truong' mailto:canh.v.tru...@dektech.com.au> >; lennart.l...@ericsson.com
<mailto:lennart.l...@ericsson.com> 
Cc: opensaf-devel@lists.sourceforge.net
<mailto:opensaf-devel@lists.sourceforge.net> 
Subject: RE: [PATCH 1/1] log: logd crash due to well known stream has
numOpeners = 0 [#3018]

 

Hi Canh,

 

Log stream is allocated with brackets, (), going with new operator; It means
numOpeners field is already zero-initialized. 

log_stream_t *stream = new (std::nothrow) log_stream_t();

 

So, I don't think your change will address the issue. The bug may locate at
another place.

 

Regards, Vu

 

> -Original Message-

> From: Canh Van Truong mailto:canh.v.tru...@dektech.com.au> >

> Sent: Thursday, March 14, 2019 6:49 PM

> To: lennart.l...@ericsson.com <mailto:lennart.l...@ericsson.com> ;
vu.m.ngu...@dektech.com.au <mailto:vu.m.ngu...@dektech.com.au> 

> Cc: opensaf-devel@lists.sourceforge.net
<mailto:opensaf-devel@lists.sourceforge.net> ; Canh Van Truong

> mailto:canh.v.tru...@dektech.com.au> >

> Subject: [PATCH 1/1] log: logd crash due to well known stream has

> numOpeners = 0 [#3018]

> 

> When the stream is created, the numOpeners is not initialized and

> may be started with unexpected value (e.g max value of unsigned int32).

> It is not correct. That may cause when client close the well known stream

> and numOpeners may be 0. The crash happens.

> 

> The "numOpeners" should be initialized with 0.

> ---

>  src/log/logd/lgs_stream.cc | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc

> index 28344c8cd..8ad0757b9 100644

> --- a/src/log/logd/lgs_stream.cc

> +++ b/src/log/logd/lgs_stream.cc

> @@ -719,6 +719,7 @@ log_stream_t *log_stream_new(const std::string

> , int stream_id) {

>stream->severityFilter = 0x7f; /* by default all levels are allowed */

>stream->isRtStream = SA_FALSE;

>stream->dest_names.clear();

> +  stream->numOpeners = 0;  // Set the number of openers is 0 at creating

> stream

> 

>/* Initiate local or shared stream file descriptor dependant on shared
or

> * split file system

> --

> 2.15.1

 


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


Re: [devel] [PATCH 1/1] log: logd crash due to well known stream has numOpeners = 0 [#3018]

2019-03-18 Thread Vu Minh Nguyen
Hi Canh,

 

Log stream is allocated with brackets, (), going with new operator; It means
numOpeners field is already zero-initialized. 

log_stream_t *stream = new (std::nothrow) log_stream_t();

 

So, I don't think your change will address the issue. The bug may locate at
another place.

 

Regards, Vu

 

> -Original Message-

> From: Canh Van Truong 

> Sent: Thursday, March 14, 2019 6:49 PM

> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au

> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong

> 

> Subject: [PATCH 1/1] log: logd crash due to well known stream has

> numOpeners = 0 [#3018]

> 

> When the stream is created, the numOpeners is not initialized and

> may be started with unexpected value (e.g max value of unsigned int32).

> It is not correct. That may cause when client close the well known stream

> and numOpeners may be 0. The crash happens.

> 

> The "numOpeners" should be initialized with 0.

> ---

>  src/log/logd/lgs_stream.cc | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/src/log/logd/lgs_stream.cc b/src/log/logd/lgs_stream.cc

> index 28344c8cd..8ad0757b9 100644

> --- a/src/log/logd/lgs_stream.cc

> +++ b/src/log/logd/lgs_stream.cc

> @@ -719,6 +719,7 @@ log_stream_t *log_stream_new(const std::string

> , int stream_id) {

>stream->severityFilter = 0x7f; /* by default all levels are allowed */

>stream->isRtStream = SA_FALSE;

>stream->dest_names.clear();

> +  stream->numOpeners = 0;  // Set the number of openers is 0 at creating

> stream

> 

>/* Initiate local or shared stream file descriptor dependant on shared
or

> * split file system

> --

> 2.15.1

 


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


Re: [devel] [PATCH 1/1] log: Fix the last value of logRecordDestinationConfiguration is not deleted [#3014]

2019-03-06 Thread Vu Minh Nguyen
Hi Canh,

Ack. Thanks.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Friday, March 1, 2019 5:36 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Fix the last value of
> logRecordDestinationConfiguration is not deleted [#3014]
> 
> When using the command "immcfg logConfig=1,safApp=safLogService -a
> logRecordDestinationConfiguration-="
> If there is just one value in the multi attribute and we delete last one,
the
> value
> will be deleted in imm database but it is not deleted in LGD.
> 
> The patch update the attribute "logRecordDestinationConfiguration" = empty
> in lgd
> after the last value is deleted.
> ---
>  src/log/logd/lgs_config.cc | 14 ++
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/src/log/logd/lgs_config.cc b/src/log/logd/lgs_config.cc
> index f096b040f..44e10b84d 100644
> --- a/src/log/logd/lgs_config.cc
> +++ b/src/log/logd/lgs_config.cc
> @@ -306,10 +306,16 @@ void lgs_cfgupd_multival_delete(const std::string
> _name,
>  }
>}
> 
> -  // Add this new list to the config data list
> -  for (const auto  : result_list) {
> -lgs_cfgupd_list_create(attribute_name.c_str(),
> -   const_cast(value.c_str()),
config_data);
> +  if (result_list.empty()) {
> +// Delete the last value. Create config_data with empty value
> +lgs_cfgupd_list_create(attribute_name.c_str(), const_cast(""),
> +   config_data);
> +  } else {
> +// Add this new list to the config data list
> +for (const auto  : result_list) {
> +  lgs_cfgupd_list_create(attribute_name.c_str(),
> + const_cast(value.c_str()),
config_data);
> +}
>}
>TRACE_LEAVE();
>  }
> --
> 2.15.1




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


[devel] [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]

2019-03-01 Thread Vu Minh Nguyen
There is a dependency b/w svc_monitor_thread and spawn_services.
The coredump happens when spawn_services is executed while
the thread has not yet started. In this case, data is sent to the
pipe but no one consumed it. When it comes to consume the data,
will get unexpected data and crash the program.

This patch ensures the things will happen in the right order:
svc_monitor_thread must be in ready state before spawn_services()
is executed.
---
 src/nid/nodeinit.cc | 34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc
index 5f15916b4..2e6a5cd05 100644
--- a/src/nid/nodeinit.cc
+++ b/src/nid/nodeinit.cc
@@ -47,6 +47,8 @@
  *any notification.  *
  /
 
+#include "nid/nodeinit.h"
+
 #include 
 #include 
 #include 
@@ -61,20 +63,18 @@
 #include 
 #include 
 
-#include "osaf/configmake.h"
-#include "rde/agent/rda_papi.h"
-#include "base/logtrace.h"
-
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#include "osaf/configmake.h"
+#include "rde/agent/rda_papi.h"
+#include "base/logtrace.h"
 #include "base/conf.h"
 #include "base/osaf_poll.h"
 #include "base/osaf_time.h"
-
-#include "nid/nodeinit.h"
 #include "base/file_notify.h"
 
 #define SETSIG(sa, sig, fun, flags) \
@@ -134,6 +134,7 @@ static int start_monitor_svc(const char *svc);
 /* Data declarations for service monitoring */
 static int svc_mon_fd = -1;
 static int next_svc_fds_slot = 0;
+static std::atomic svc_monitor_thread_ready{false};
 
 struct SAFServices {
   const std::string fifo_dir = PKGLOCALSTATEDIR;
@@ -712,9 +713,9 @@ int32_t fork_daemon(NID_SPAWN_INFO *service, char *app, 
char *args[],
 
 tmp_pid = getpid();
 while (write(filedes[1], _pid, sizeof(int)) < 0) {
-  if (errno == EINTR)
+  if (errno == EINTR) {
 continue;
-  else if (errno == EPIPE) {
+  } else if (errno == EPIPE) {
 LOG_ER("Reader not available to return my PID");
   } else {
 LOG_ER("Problem writing to pipe, err=%s", strerror(errno));
@@ -1517,6 +1518,7 @@ void *svc_monitor_thread(void *fd) {
   next_svc_fds_slot++;
 
   while (true) {
+svc_monitor_thread_ready = true;
 unsigned rc = osaf_poll(fds, next_svc_fds_slot, -1);
 if (rc > 0) {
   // check if any monitored service has exit
@@ -1529,9 +1531,9 @@ void *svc_monitor_thread(void *fd) {
 
   if (fds[FD_SVC_MON_THR].revents & POLLIN) {
 while (true) {
-  read_rc = read(svc_mon_thr_fd, nid_name, NID_MAXSNAME);
+  read_rc = recv(svc_mon_thr_fd, nid_name, NID_MAXSNAME, MSG_DONTWAIT);
   if (read_rc == -1) {
-if (errno == EINTR) {
+if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) {
   continue;
 } else {
   LOG_ER("Failed to read on socketpair descriptor: %s",
@@ -1574,7 +1576,7 @@ uint32_t create_svc_monitor_thread(void) {
 
   TRACE_ENTER();
 
-  if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, s_pair) == -1) {
+  if (socketpair(AF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC, 0, s_pair) == -1) {
 LOG_ER("socketpair FAILED: %s", strerror(errno));
 return NCSCC_RC_FAILURE;
   }
@@ -1655,6 +1657,16 @@ int main(int argc, char *argv[]) {
 exit(EXIT_FAILURE);
   }
 
+  // Waiting until svc_monitor_thread is up and in ready state.
+  unsigned no_repeat = 0;
+  while (svc_monitor_thread_ready == false && no_repeat < 100) {
+osaf_nanosleep();
+no_repeat++;
+  }
+
+  osafassert(svc_monitor_thread_ready);
+  LOG_NO("svc_monitor_thread is up and in ready state");
+
   if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) {
 LOG_ER("Failed to parse file %s. Exiting", sbuf);
 exit(EXIT_FAILURE);
-- 
2.19.2



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


[devel] [PATCH 0/1] Review Request for nid: fix opensafd crashed during start-up [#3013] V2

2019-03-01 Thread Vu Minh Nguyen
Summary: nid: fix opensafd crashed during start-up [#3013]
Review request for Ticket(s): 3013
Peer Reviewer(s): Hans
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3013
Base revision: 1f9cf4636b07d28a906f62b44144c337c5280f1a
Personal repository: git://git.code.sf.net/u/winhvu/review


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

revision 89751e679b5eb9230214414ca44410620d72af39
Author: Vu Minh Nguyen 
Date:   Fri, 1 Mar 2019 16:05:12 +0700

nid: fix opensafd crashed during start-up [#3013]

There is a dependency b/w svc_monitor_thread and spawn_services.
The coredump happens when spawn_services is executed while
the thread has not yet started. In this case, data is sent to the
pipe but no one consumed it. When it comes to consume the data,
will get unexpected data and crash the program.

This patch ensures the things will happen in the right order:
svc_monitor_thread must be in ready state before spawn_services()
is executed.



Complete diffstat:
--
 src/nid/nodeinit.cc | 34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)


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


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


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


Re: [devel] [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]

2019-02-28 Thread Vu Minh Nguyen
Thanks Hans. I will send the V2 for these updates.

 

Regards, Vu

 

From: Hans Nordebäck  
Sent: Thursday, February 28, 2019 2:16 PM
To: Vu Minh Nguyen ; Gary Lee 

Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]

 

Hi Vu,

you can keep your patch for the ready state, but also change SOCK_STREAM to 
SOCK_DGRAM and change 

the read(svc_mon_thr_fd, nid_name, NID_MAXSNAME) in svc_monitor_thread to

recv(svc_mon_thr_fd, nid_name, NID_MAXSNAME, MSG_DONTWAIT) and also handle 
EAGAIN and

EWOULDBLOCK. Then only one nid_name per read/recv will be given instead of 
several nid_names

as in the SOCK_STREAM case.

/BR Hans

 

On 2/28/19 05:30, Vu Minh Nguyen wrote:

Hi Hans,
 
Thanks for your comment. 
 
But I has a concern that the service-monitoring function may not fully work 
if a service is crashed before the svc_monitor_thread goes to ready state?
 
Is it mandatory for monitoring thread to enter ready state before spawning
SAF services?
 
Regards, Vu
 

-Original Message-
From: Hans Nordebäck  <mailto:hans.nordeb...@ericsson.com> 

Sent: Wednesday, February 27, 2019 8:23 PM
To: Vu Minh Nguyen  <mailto:vu.m.ngu...@dektech.com.au> 
; Gary Lee
 <mailto:gary@dektech.com.au> 
Cc: opensaf-devel@lists.sourceforge.net 
<mailto:opensaf-devel@lists.sourceforge.net> ; Vu Minh Nguyen
 <mailto:vu.m.ngu...@dektech.com.au> 
Subject: RE: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
 
Hi Vu,
I discussed a bit with Anders, likely it should work if the socketpair is

changed

to socketpair(AF_UNIX, SOCK_DGRAM .. from SOCK_STREAM. /BR Hans
 
-Original Message-
From: Hans Nordebäck
Sent: den 27 februari 2019 11:55
To: 'Vu Minh Nguyen'  <mailto:vu.m.ngu...@dektech.com.au> 
; Gary Lee
 <mailto:gary@dektech.com.au> 
Cc: opensaf-devel@lists.sourceforge.net 
<mailto:opensaf-devel@lists.sourceforge.net> ; Vu Minh Nguyen
 <mailto:vu.m.ngu...@dektech.com.au> 
Subject: RE: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
 
Hi Vu,
ack, code review only/Thanks HansN
 
-Original Message-
From: Vu Minh Nguyen  <mailto:vu.m.ngu...@dektech.com.au> 

Sent: den 27 februari 2019 11:48
To: Hans Nordebäck  <mailto:hans.nordeb...@ericsson.com> 
; Gary Lee
 <mailto:gary@dektech.com.au> 
Cc: opensaf-devel@lists.sourceforge.net 
<mailto:opensaf-devel@lists.sourceforge.net> ; Vu Minh Nguyen
 <mailto:vu.m.ngu...@dektech.com.au> 
Subject: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
 
There is a dependency b/w svc_monitor_thread and spawn_services.
The coredump happens when spawn_services is executed while the thread
has not yet started. In this case, data is sent to the pipe but no one

consumed

it. Later on, reading data from the pipe, will get unexpected data and

crash

the program.
 
This patch ensures the order: svc_monitor_thread must be in ready state
before spawn_services() is executed.
---
 src/nid/nodeinit.cc | 11 +++
 1 file changed, 11 insertions(+)
 
diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc index
5f15916b4..b4945b05c 100644
--- a/src/nid/nodeinit.cc
+++ b/src/nid/nodeinit.cc
@@ -134,6 +134,7 @@ static int start_monitor_svc(const char *svc);
 /* Data declarations for service monitoring */  static int svc_mon_fd =

-1;

static int next_svc_fds_slot = 0;
+static bool svc_monitor_thread_running = false;
 
 struct SAFServices {
   const std::string fifo_dir = PKGLOCALSTATEDIR; @@ -1517,6 +1518,7 @@
void *svc_monitor_thread(void *fd) {
   next_svc_fds_slot++;
 
   while (true) {
+svc_monitor_thread_running = true;
 unsigned rc = osaf_poll(fds, next_svc_fds_slot, -1);
 if (rc > 0) {
   // check if any monitored service has exit @@ -1655,6 +1657,15 @@

int

main(int argc, char *argv[]) {
 exit(EXIT_FAILURE);
   }
 
+  // Waiting until svc_monitor_thread is up and in ready state.
+  // If spawn_services runs before the thread is in ready state,  //
+ receive side of the pipe s_pair will get unexpected data and  // may
+ crash the process.
+  while (svc_monitor_thread_running == false) {
+usleep(100);
+  }
+
+  LOG_NO("svc_monitor_thread is up and in ready state");
   if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) {
 LOG_ER("Failed to parse file %s. Exiting", sbuf);
 exit(EXIT_FAILURE);
--
2.19.2

 
 


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


Re: [devel] [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]

2019-02-27 Thread Vu Minh Nguyen
Hi Hans,

Thanks for your comment. 

But I has a concern that the service-monitoring function may not fully work 
if a service is crashed before the svc_monitor_thread goes to ready state?

Is it mandatory for monitoring thread to enter ready state before spawning
SAF services?

Regards, Vu

> -Original Message-
> From: Hans Nordebäck 
> Sent: Wednesday, February 27, 2019 8:23 PM
> To: Vu Minh Nguyen ; Gary Lee
> 
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: RE: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
> 
> Hi Vu,
> I discussed a bit with Anders, likely it should work if the socketpair is
changed
> to socketpair(AF_UNIX, SOCK_DGRAM .. from SOCK_STREAM. /BR Hans
> 
> -Original Message-
> From: Hans Nordebäck
> Sent: den 27 februari 2019 11:55
> To: 'Vu Minh Nguyen' ; Gary Lee
> 
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: RE: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
> 
> Hi Vu,
> ack, code review only/Thanks HansN
> 
> -Original Message-
> From: Vu Minh Nguyen 
> Sent: den 27 februari 2019 11:48
> To: Hans Nordebäck ; Gary Lee
> 
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]
> 
> There is a dependency b/w svc_monitor_thread and spawn_services.
> The coredump happens when spawn_services is executed while the thread
> has not yet started. In this case, data is sent to the pipe but no one
consumed
> it. Later on, reading data from the pipe, will get unexpected data and
crash
> the program.
> 
> This patch ensures the order: svc_monitor_thread must be in ready state
> before spawn_services() is executed.
> ---
>  src/nid/nodeinit.cc | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc index
> 5f15916b4..b4945b05c 100644
> --- a/src/nid/nodeinit.cc
> +++ b/src/nid/nodeinit.cc
> @@ -134,6 +134,7 @@ static int start_monitor_svc(const char *svc);
>  /* Data declarations for service monitoring */  static int svc_mon_fd =
-1;
> static int next_svc_fds_slot = 0;
> +static bool svc_monitor_thread_running = false;
> 
>  struct SAFServices {
>const std::string fifo_dir = PKGLOCALSTATEDIR; @@ -1517,6 +1518,7 @@
> void *svc_monitor_thread(void *fd) {
>next_svc_fds_slot++;
> 
>while (true) {
> +svc_monitor_thread_running = true;
>  unsigned rc = osaf_poll(fds, next_svc_fds_slot, -1);
>  if (rc > 0) {
>// check if any monitored service has exit @@ -1655,6 +1657,15 @@
int
> main(int argc, char *argv[]) {
>  exit(EXIT_FAILURE);
>}
> 
> +  // Waiting until svc_monitor_thread is up and in ready state.
> +  // If spawn_services runs before the thread is in ready state,  //
> + receive side of the pipe s_pair will get unexpected data and  // may
> + crash the process.
> +  while (svc_monitor_thread_running == false) {
> +usleep(100);
> +  }
> +
> +  LOG_NO("svc_monitor_thread is up and in ready state");
>if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) {
>  LOG_ER("Failed to parse file %s. Exiting", sbuf);
>  exit(EXIT_FAILURE);
> --
> 2.19.2




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


[devel] [PATCH 0/1] Review Request for nid: fix opensafd crashed during start-up [#3013]

2019-02-27 Thread Vu Minh Nguyen
Summary: nid: fix opensafd crashed during start-up [#3013]
Review request for Ticket(s): 3013
Peer Reviewer(s): Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3013
Base revision: 1f9cf4636b07d28a906f62b44144c337c5280f1a
Personal repository: git://git.code.sf.net/u/winhvu/review


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

revision 4bfd21acce133e2b5bbb83ec42e36682f4ac4c77
Author: Vu Minh Nguyen 
Date:   Wed, 27 Feb 2019 17:43:21 +0700

nid: fix opensafd crashed during start-up [#3013]

There is a dependency b/w svc_monitor_thread and spawn_services.
The coredump happens when spawn_services is executed while
the thread has not yet started. In this case, data is sent to the
pipe but no one consumed it. Later on, reading data from the pipe,
will get unexpected data and crash the program.

This patch ensures the order: svc_monitor_thread must be in ready state
before spawn_services() is executed.



Complete diffstat:
--
 src/nid/nodeinit.cc | 11 +++
 1 file changed, 11 insertions(+)


Testing Commands:
-
To produce the issue, manually test by having some delay in svc_thread_monitor
to make the spawn_services() executing before the thread is ready.


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


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


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


Reviewer Checklist:
---
Ack from reviewers


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.



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


[devel] [PATCH 1/1] nid: fix opensafd crashed during start-up [#3013]

2019-02-27 Thread Vu Minh Nguyen
There is a dependency b/w svc_monitor_thread and spawn_services.
The coredump happens when spawn_services is executed while
the thread has not yet started. In this case, data is sent to the
pipe but no one consumed it. Later on, reading data from the pipe,
will get unexpected data and crash the program.

This patch ensures the order: svc_monitor_thread must be in ready state
before spawn_services() is executed.
---
 src/nid/nodeinit.cc | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc
index 5f15916b4..b4945b05c 100644
--- a/src/nid/nodeinit.cc
+++ b/src/nid/nodeinit.cc
@@ -134,6 +134,7 @@ static int start_monitor_svc(const char *svc);
 /* Data declarations for service monitoring */
 static int svc_mon_fd = -1;
 static int next_svc_fds_slot = 0;
+static bool svc_monitor_thread_running = false;
 
 struct SAFServices {
   const std::string fifo_dir = PKGLOCALSTATEDIR;
@@ -1517,6 +1518,7 @@ void *svc_monitor_thread(void *fd) {
   next_svc_fds_slot++;
 
   while (true) {
+svc_monitor_thread_running = true;
 unsigned rc = osaf_poll(fds, next_svc_fds_slot, -1);
 if (rc > 0) {
   // check if any monitored service has exit
@@ -1655,6 +1657,15 @@ int main(int argc, char *argv[]) {
 exit(EXIT_FAILURE);
   }
 
+  // Waiting until svc_monitor_thread is up and in ready state.
+  // If spawn_services runs before the thread is in ready state,
+  // receive side of the pipe s_pair will get unexpected data and
+  // may crash the process.
+  while (svc_monitor_thread_running == false) {
+usleep(100);
+  }
+
+  LOG_NO("svc_monitor_thread is up and in ready state");
   if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) {
 LOG_ER("Failed to parse file %s. Exiting", sbuf);
 exit(EXIT_FAILURE);
-- 
2.19.2



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


[devel] [PATCH 1/1] imm: fix racing in sending discard-node during network split [#3012]

2019-02-24 Thread Vu Minh Nguyen
At the time of spliting the cluster into 02 partitions but keeping a node
such as PL-3 connecting with both partitions, just IMMND on PL-3 will get
discard-node messages from both active IMMD on partition #1 and from standby
IMMD on partition #2.

That race later on caused IMMND on PL-3 crashed due to the mismatch
found at finalize-sync.

This patch makes a minor change at standby IMMD - rather then sending the
discard-node message even in standby role, will put the message in queue
and only broadcast it when the standby is assigned to active.
---
 src/imm/immd/immd_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/imm/immd/immd_proc.c b/src/imm/immd/immd_proc.c
index c16232d2d..69e23f2d3 100644
--- a/src/imm/immd/immd_proc.c
+++ b/src/imm/immd/immd_proc.c
@@ -778,7 +778,7 @@ uint32_t immd_process_immnd_down(IMMD_CB *cb, 
IMMD_IMMND_INFO_NODE *immnd_info,
}
}
 
-   if (active || !cb->immd_remote_up) {
+   if (active) {
/*
 ** HAFE - Let IMMND subscribe for IMMND up/down events instead?
 ** ABT - Not for now. IMMND up/down are only subscribed by
-- 
2.19.2



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


[devel] [PATCH 0/1] Review Request for imm: fix racing in sending discard-node during network split [#3012]

2019-02-24 Thread Vu Minh Nguyen
Summary: imm: fix racing in sending discard-node during network split [#3012]
Review request for Ticket(s): 3012
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3012
Base revision: 91806d17b2d79138f68ff3eb3449a9a6ba3dfbf0
Personal repository: git://git.code.sf.net/u/winhvu/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 827a1d4c9c4708776cb67dd27e984368c089f232
Author: Vu Minh Nguyen 
Date:   Mon, 25 Feb 2019 14:27:33 +0700

imm: fix racing in sending discard-node during network split [#3012]

At the time of spliting the cluster into 02 partitions but keeping a node
such as PL-3 connecting with both partitions, just IMMND on PL-3 will get
discard-node messages from both active IMMD on partition #1 and from standby
IMMD on partition #2.

That race later on caused IMMND on PL-3 crashed due to the mismatch
found at finalize-sync.

This patch makes a minor change at standby IMMD - rather then sending the
discard-node message even in standby role, will put the message in queue
and only broadcast it when the standby is assigned to active.



Complete diffstat:
--
 src/imm/immd/immd_proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Testing Commands:
-
Refer to the ticket description.


Testing, Expected Results:
--
No coredump is generated.


Conditions of Submission:
-
Ack from peer reviewers.


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


Re: [devel] [PATCH 1/1] log: fix coredump at log agent application [#3002]

2019-02-10 Thread Vu Minh Nguyen
Hi Lennart,

 

This happens when shutting down log application and causing coredump for the
application. 

 

The coredump backtrace can be found in the ticket.

 

Regards, Vu

 

From: Lennart Lund  
Sent: Wednesday, January 30, 2019 5:04 PM
To: Vu Minh Nguyen ; Canh Van Truong

Cc: opensaf-devel@lists.sourceforge.net
Subject: SV: [PATCH 1/1] log: fix coredump at log agent application [#3002]

 

Hi Vu,

 

Ack. Not tested

 

If I understand correct this fix solves a problem with shutting down the log
service but what is the problem if the described race condition happen?

 

Thanks 

Lennart

  _  

Från: Vu Minh Nguyen mailto:vu.m.ngu...@dektech.com.au> >
Skickat: den 24 januari 2019 11:14
Till: Lennart Lund; Canh Van Truong
Kopia: opensaf-devel@lists.sourceforge.net
<mailto:opensaf-devel@lists.sourceforge.net> ; Vu Minh Nguyen
Ämne: [PATCH 1/1] log: fix coredump at log agent application [#3002] 

 

There is a race in using singleton-static class object b/w mds thread
and application thread - caller of exit() api.

This patch still uses singleton but making the instance shared_ptr
to ensure the resource will not be destroyed if it is being used.
---
 src/log/agent/lga_agent.cc |  7 ++-
 src/log/agent/lga_agent.h  | 21 ++---
 src/log/agent/lga_api.cc   | 20 ++--
 src/log/agent/lga_mds.cc   | 32 
 src/log/agent/lga_state.cc |  2 +-
 src/log/agent/lga_util.cc  | 10 +-
 6 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
index bf9caa935..1000bb3fd 100644
--- a/src/log/agent/lga_agent.cc
+++ b/src/log/agent/lga_agent.cc
@@ -108,7 +108,7 @@ ScopeData::~ScopeData() {
 recovery2_unlock(is_locked_);
   }
 
-  LogAgent::instance().EnterCriticalSection();
+  LogAgent::instance()->EnterCriticalSection();
   LogClient* client = client_data_->client;
   bool* is_updated = client_data_->is_updated;
   RefCounter::Degree client_degree = client_data_->value;
@@ -128,15 +128,12 @@ ScopeData::~ScopeData() {
   stream->RestoreRefCounter(caller, stream_degree, *stream_is_updated);
 }
   }
-  LogAgent::instance().LeaveCriticalSection();
+  LogAgent::instance()->LeaveCriticalSection();
 }
 
 
//--

 // LogAgent
 
//--

-// Singleton represents LOG agent.
-LogAgent LogAgent::me_;
-
 LogAgent::LogAgent() {
   client_list_.clear();
   // There is high risk of calling one @LogClient method
diff --git a/src/log/agent/lga_agent.h b/src/log/agent/lga_agent.h
index 0049da054..0c32ea33b 100644
--- a/src/log/agent/lga_agent.h
+++ b/src/log/agent/lga_agent.h
@@ -19,12 +19,14 @@
 #define SRC_LOG_AGENT_LGA_AGENT_H_
 
 #include 
+#include 
 #include 
 #include 
-#include "mds/mds_papi.h"
 #include 
-#include "base/macros.h"
 #include 
+
+#include "base/macros.h"
+#include "mds/mds_papi.h"
 #include "log/common/lgsv_msg.h"
 #include "log/common/lgsv_defs.h"
 #include "log/agent/lga_common.h"
@@ -80,7 +82,15 @@ class LogClient;
 //<
 class LogAgent {
  public:
-  static LogAgent& instance() { return me_; }
+  static std::shared_ptr& instance() {
+// Ensure this static singleton instance is only destroyed when
+// no one is using it. Note that: static data can be destroyed
+// in log application thread which calls exit() libc. So, introducing
+// shared_ptr<> to avoid races among threads.
+static std::shared_ptr me =
+std::shared_ptr{new LogAgent()};
+return me;
+  }
 
   //<
   // C++ APIs wrapper for corresponding C LOG Agent APIs
@@ -158,11 +168,11 @@ class LogAgent {
   // Introduce these public interface for MDS thread use.
   void EnterCriticalSection();
   void LeaveCriticalSection();
+  ~LogAgent() {}
 
  private:
   // Not allow to create @LogAgent object, except the singleton object
@me_.
   LogAgent();
-  ~LogAgent() {}
 
   // True if there is no Active SC, otherwise false
   bool no_active_log_server() const;
@@ -274,9 +284,6 @@ class LogAgent {
   // LGS LGA sync params
   NCS_SEL_OBJ lgs_sync_sel_;
 
-  // Singleton represents LOG Agent in LOG application process
-  static LogAgent me_;
-
   DELETE_COPY_AND_MOVE_OPERATORS(LogAgent);
 };
 
diff --git a/src/log/agent/lga_api.cc b/src/log/agent/lga_api.cc
index 37a1cc650..97dbf1d31 100644
--- a/src/log/agent/lga_api.cc
+++ b/src/log/agent/lga_api.cc
@@ -39,7 +39,7 @@
 SaAisErrorT saLogInitialize(SaLogHandleT* logHandle,
 const SaLogCallbacksT* callbacks,
 SaVersionT* version) {
-  return LogAgent::instance().saLogInitialize(logHandle, callbacks,
version);
+  return LogAgent::instance()->saLogInitialize(logHandle, callbacks,
version);
 }
 
 
/***

Re: [devel] [PATCH 1/1] log: fix coredump at log agent application [#3002]

2019-01-28 Thread Vu Minh Nguyen
Hi,

Have you had time to review this ticket? Thanks. 

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen 
> Sent: Thursday, January 24, 2019 5:15 PM
> To: lennart.l...@ericsson.com; canh.v.tru...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] log: fix coredump at log agent application [#3002]
> 
> There is a race in using singleton-static class object b/w mds thread
> and application thread - caller of exit() api.
> 
> This patch still uses singleton but making the instance shared_ptr
> to ensure the resource will not be destroyed if it is being used.
> ---
>  src/log/agent/lga_agent.cc |  7 ++-
>  src/log/agent/lga_agent.h  | 21 ++---
>  src/log/agent/lga_api.cc   | 20 ++--
>  src/log/agent/lga_mds.cc   | 32 
>  src/log/agent/lga_state.cc |  2 +-
>  src/log/agent/lga_util.cc  | 10 +-
>  6 files changed, 48 insertions(+), 44 deletions(-)
> 
> diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
> index bf9caa935..1000bb3fd 100644
> --- a/src/log/agent/lga_agent.cc
> +++ b/src/log/agent/lga_agent.cc
> @@ -108,7 +108,7 @@ ScopeData::~ScopeData() {
>  recovery2_unlock(is_locked_);
>}
> 
> -  LogAgent::instance().EnterCriticalSection();
> +  LogAgent::instance()->EnterCriticalSection();
>LogClient* client = client_data_->client;
>bool* is_updated = client_data_->is_updated;
>RefCounter::Degree client_degree = client_data_->value;
> @@ -128,15 +128,12 @@ ScopeData::~ScopeData() {
>stream->RestoreRefCounter(caller, stream_degree,
> *stream_is_updated);
>  }
>}
> -  LogAgent::instance().LeaveCriticalSection();
> +  LogAgent::instance()->LeaveCriticalSection();
>  }
> 
>
//--

>  // LogAgent
>
//--

> -// Singleton represents LOG agent.
> -LogAgent LogAgent::me_;
> -
>  LogAgent::LogAgent() {
>client_list_.clear();
>// There is high risk of calling one @LogClient method
> diff --git a/src/log/agent/lga_agent.h b/src/log/agent/lga_agent.h
> index 0049da054..0c32ea33b 100644
> --- a/src/log/agent/lga_agent.h
> +++ b/src/log/agent/lga_agent.h
> @@ -19,12 +19,14 @@
>  #define SRC_LOG_AGENT_LGA_AGENT_H_
> 
>  #include 
> +#include 
>  #include 
>  #include 
> -#include "mds/mds_papi.h"
>  #include 
> -#include "base/macros.h"
>  #include 
> +
> +#include "base/macros.h"
> +#include "mds/mds_papi.h"
>  #include "log/common/lgsv_msg.h"
>  #include "log/common/lgsv_defs.h"
>  #include "log/agent/lga_common.h"
> @@ -80,7 +82,15 @@ class LogClient;
>  //<
>  class LogAgent {
>   public:
> -  static LogAgent& instance() { return me_; }
> +  static std::shared_ptr& instance() {
> +// Ensure this static singleton instance is only destroyed when
> +// no one is using it. Note that: static data can be destroyed
> +// in log application thread which calls exit() libc. So, introducing
> +// shared_ptr<> to avoid races among threads.
> +static std::shared_ptr me =
> +std::shared_ptr{new LogAgent()};
> +return me;
> +  }
> 
>//<
>// C++ APIs wrapper for corresponding C LOG Agent APIs
> @@ -158,11 +168,11 @@ class LogAgent {
>// Introduce these public interface for MDS thread use.
>void EnterCriticalSection();
>void LeaveCriticalSection();
> +  ~LogAgent() {}
> 
>   private:
>// Not allow to create @LogAgent object, except the singleton object
> @me_.
>LogAgent();
> -  ~LogAgent() {}
> 
>// True if there is no Active SC, otherwise false
>bool no_active_log_server() const;
> @@ -274,9 +284,6 @@ class LogAgent {
>// LGS LGA sync params
>NCS_SEL_OBJ lgs_sync_sel_;
> 
> -  // Singleton represents LOG Agent in LOG application process
> -  static LogAgent me_;
> -
>DELETE_COPY_AND_MOVE_OPERATORS(LogAgent);
>  };
> 
> diff --git a/src/log/agent/lga_api.cc b/src/log/agent/lga_api.cc
> index 37a1cc650..97dbf1d31 100644
> --- a/src/log/agent/lga_api.cc
> +++ b/src/log/agent/lga_api.cc
> @@ -39,7 +39,7 @@
>  SaAisErrorT saLogInitialize(SaLogHandleT* logHandle,
>  const SaLogCallbacksT* callbacks,
>  SaVersionT* version) {
> -  return LogAgent::instance().saLogInitialize(logHandle, callbacks,
version);
> +  return LogAgent::instance()->saLogInitialize(logHandle, callbacks,
vers

Re: [devel] Review request imm: update PR documentation regarding empty value persisted [#2991]

2019-01-28 Thread Vu Minh Nguyen
Hi all,

 

Any comment for this update? Will push the documentation E/today if getting
no comment/response.

 

Regards, Vu

 

From: Vu Minh Nguyen  
Sent: Thursday, January 17, 2019 9:44 AM
To: 'Lennart Lund' 
Cc: 'opensaf-devel@lists.sourceforge.net'

Subject: [devel] Review request imm: update PR documentation regarding empty
value persisted [#2991]

 

Hi Lennart, all

 

This is the IMM PR documentation update regarding the enhancement in the
ticket #2985 - allow empty-value attributes persisted.

 

To view all changes, open the doc with LibreOffice Writer then click
Edit/Trace Changes/Manage.

 

Please help to review it. Thanks.

 

Regards, Vu

 


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


Re: [devel] [PATCH 1/1] osaf: do quick local node reboot when split network [#3001]

2019-01-28 Thread Vu Minh Nguyen
Hi Hans,

Thanks for your comments. See my comment inline. Thanks

Regards, Vu

> -Original Message-
> From: Hans Nordebäck 
> Sent: Monday, January 28, 2019 4:37 PM
> To: Hans Nordebäck ; Vu Minh Nguyen
> ; Gary Lee ;
> Minh Hon Chau 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1/1] osaf: do quick local node reboot when
split
> network [#3001]
> 
> Hi Vu,
> See one more comment below/Thanks HansN
> 
> -Original Message-
> From: Hans Nordebäck 
> Sent: den 28 januari 2019 10:15
> To: Vu Minh Nguyen ; Gary Lee
> ; Minh Hon Chau 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1/1] osaf: do quick local node reboot when
split
> network [#3001]
> 
> Hi Vu, ack review only. Two comments below/Thanks HansN
> 
> On 1/25/19 12:34, Vu Minh Nguyen wrote:
> > ---
> >   scripts/opensaf_reboot   | 33 +++--
> >   src/amf/amfd/ndproc.cc   |  4 ++--
> >   src/base/ncssysf_def.h   |  6 ++
> >   src/base/sysf_def.c  | 10 ++
> >   src/fm/fmd/fm_main.cc|  6 +++---
> >   src/fm/fmd/fm_rda.cc |  5 ++---
> >   src/rde/rded/rde_main.cc |  6 ++
> >   7 files changed, 52 insertions(+), 18 deletions(-)
> >
> > diff --git a/scripts/opensaf_reboot b/scripts/opensaf_reboot index
> > 727272e1d..2f7a7daeb 100644
> > --- a/scripts/opensaf_reboot
> > +++ b/scripts/opensaf_reboot
> > @@ -31,7 +31,7 @@ export
> LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
> >
> >   # Node fencing: OpenSAF cannot reboot a node when there's no CLM
> node to
> >   # PLM EE mapping in the information model. In such cases rebooting
> > would be done -# through proprietary mechanisms, i.e. not through PLM.
> > Node_id is (the only
> > +# through proprietary mechanisms, i.e. not through PLM. Node_id is
> > +(the only
> >   # entity) at the disposal of such a mechanism.
> >
> >   if [ -f "$pkgsysconfdir/fmd.conf" ]; then @@ -81,7 +81,6 @@
> > opensaf_reboot_with_remote_fencing()
> >   #if plm exists in the system,then the reboot is performed using the
> eename.
> >   opensaf_reboot_with_plm()
> >   {
> > -
> >   immadm -o 7 $ee_name
> >   retval=$?
> >   if [ $retval != 0 ]; then
> > @@ -96,12 +95,29 @@ opensaf_reboot_with_plm()
> >   logger -t "opensaf_reboot" "abrupt restart failed for $ee_name: unable
to
> restart remote node"
> >   exit 1
> >   fi
> > -fi
> > +fi
> >   fi
> >   #Note: Operation Id SA_PLM_ADMIN_RESTART=7
> >   #In the example the $ee_name would expand to (for eg:-)
> safEE=my_linux_os,safHE=64bitmulticore,safDomain=my_domain
> >   }
> >
> > +# Force local node reboot as fast as possible
> > +quick_local_node_reboot()
> > +{
> > +logger -t "opensaf_reboot" "Do quick local node reboot"
> [HansN] perhaps reuse the same logic as in sysf_def.c, i.e. use the sysrq
as
> fallback and use a short timeout
[Vu]
Forcing node reboot by touching /proc/sysrq-trigger is not allowed on
containers such as LXC 
(as container is immutable), therefore I provided 02 more alternatives below
in case the first try is failed.
> > +
> > +$icmd /bin/echo -n 'b' 2> /dev/null > /proc/sysrq-trigger
> [HansN] if not run as root, i.e. icmd is sudo, I think you need to use
> cmd: /bin/echo -n 'b' | $icmd tee /proc/sysrq-trigger , please check
> [HansN] or $icmd  /bin/sh -c "/bin/echo -n 'b' 2> /dev/null > /proc/sysrq-
> trigger"
[Vu] Thanks for your suggestion. Will update accordingly.
> > +ret_code=$?
> > +
> > +if [ $ret_code != 0 ] && [ -x /bin/systemctl ]; then
> > +$icmd /bin/systemctl --force --force reboot
> > +ret_code=$?
> > +fi
> > +
> > +if [ $ret_code != 0 ]; then
> > +$icmd /sbin/reboot -f
> > +fi
> > +}
> >
> >   if ! test -f "$NODE_ID_FILE"; then
> >   logger -t "opensaf_reboot" "$NODE_ID_FILE doesnt exists,reboot failed
"
> > @@ -112,8 +128,13 @@ temp_node_id=`cat "$NODE_ID_FILE"`
> >   temp_node_id=`echo "$temp_node_id" |sed -e 's:^0[bBxX]::'| sed -e
> 's:^:0x:'`
> >   self_node_id=`printf "%d" $temp_node_id`
> >
> > -# If clm cluster reboot requested argument one and two are set but
> > not used, argument 3 is set to 1, "safe reboot" request -if [
> > "$safe_reboot" = 1 ]; then
> > +# If no argument is provided, forcing node reboot immediately without
> > +log # flushing, process terminating, disk un-mounting.
> > +# If clm cluster reboot 

[devel] [PATCH 1/1] osaf: do quick local node reboot when split network [#3001]

2019-01-25 Thread Vu Minh Nguyen
---
 scripts/opensaf_reboot   | 33 +++--
 src/amf/amfd/ndproc.cc   |  4 ++--
 src/base/ncssysf_def.h   |  6 ++
 src/base/sysf_def.c  | 10 ++
 src/fm/fmd/fm_main.cc|  6 +++---
 src/fm/fmd/fm_rda.cc |  5 ++---
 src/rde/rded/rde_main.cc |  6 ++
 7 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/scripts/opensaf_reboot b/scripts/opensaf_reboot
index 727272e1d..2f7a7daeb 100644
--- a/scripts/opensaf_reboot
+++ b/scripts/opensaf_reboot
@@ -31,7 +31,7 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 
 # Node fencing: OpenSAF cannot reboot a node when there's no CLM node to
 # PLM EE mapping in the information model. In such cases rebooting would be 
done
-# through proprietary mechanisms, i.e. not through PLM. Node_id is (the only 
+# through proprietary mechanisms, i.e. not through PLM. Node_id is (the only
 # entity) at the disposal of such a mechanism.
 
 if [ -f "$pkgsysconfdir/fmd.conf" ]; then
@@ -81,7 +81,6 @@ opensaf_reboot_with_remote_fencing()
 #if plm exists in the system,then the reboot is performed using the eename.
 opensaf_reboot_with_plm()
 {
- 
immadm -o 7 $ee_name
retval=$?
if [ $retval != 0 ]; then
@@ -96,12 +95,29 @@ opensaf_reboot_with_plm()
logger -t "opensaf_reboot" "abrupt restart 
failed for $ee_name: unable to restart remote node"
exit 1
fi
-   fi 
+   fi
fi
 #Note: Operation Id SA_PLM_ADMIN_RESTART=7
 #In the example the $ee_name would expand to (for eg:-) 
safEE=my_linux_os,safHE=64bitmulticore,safDomain=my_domain
 }
 
+# Force local node reboot as fast as possible
+quick_local_node_reboot()
+{
+   logger -t "opensaf_reboot" "Do quick local node reboot"
+
+   $icmd /bin/echo -n 'b' 2> /dev/null > /proc/sysrq-trigger
+   ret_code=$?
+
+   if [ $ret_code != 0 ] && [ -x /bin/systemctl ]; then
+   $icmd /bin/systemctl --force --force reboot
+   ret_code=$?
+   fi
+
+   if [ $ret_code != 0 ]; then
+   $icmd /sbin/reboot -f
+   fi
+}
 
 if ! test -f "$NODE_ID_FILE"; then
logger -t "opensaf_reboot" "$NODE_ID_FILE doesnt exists,reboot failed "
@@ -112,8 +128,13 @@ temp_node_id=`cat "$NODE_ID_FILE"`
 temp_node_id=`echo "$temp_node_id" |sed -e 's:^0[bBxX]::'| sed -e 's:^:0x:'`
 self_node_id=`printf "%d" $temp_node_id`
 
-# If clm cluster reboot requested argument one and two are set but not used, 
argument 3 is set to 1, "safe reboot" request
-if [ "$safe_reboot" = 1 ]; then
+# If no argument is provided, forcing node reboot immediately without log
+# flushing, process terminating, disk un-mounting.
+# If clm cluster reboot requested argument one and two are set but not used,
+# argument 3 is set to 1, "safe reboot" request.
+if [ "$#" = 0 ]; then
+   quick_local_node_reboot
+elif [ "$safe_reboot" = 1 ]; then
opensaf_safe_reboot
 else
# A node ID of zero(0) means an order to reboot the local node
@@ -165,7 +186,7 @@ else
logger -t "opensaf_reboot" "Not 
rebooting remote node $ee_name as it is not in INSTANTIATED state"
elif [ $plm_node_state != 2 ]; then
opensaf_reboot_with_plm
-   else
+   else
logger -t "opensaf_reboot" "Not 
rebooting remote node $ee_name as it is already in locked state"
fi
else
diff --git a/src/amf/amfd/ndproc.cc b/src/amf/amfd/ndproc.cc
index ec347fc71..c5060e67b 100644
--- a/src/amf/amfd/ndproc.cc
+++ b/src/amf/amfd/ndproc.cc
@@ -1262,7 +1262,7 @@ void check_quorum(AVD_CL_CB *cb) {
 
 // remote fencing is disabled and we have lost write access
 // reboot this node to prevent split brain
-opensaf_reboot(0, nullptr,
-  "Quorum lost. Rebooting this node to prevent split-brain");
+opensaf_quick_reboot("Quorum lost. Rebooting this node to "
+ "prevent split-brain");
   }
 }
diff --git a/src/base/ncssysf_def.h b/src/base/ncssysf_def.h
index 3df8b221e..3de6f44f6 100644
--- a/src/base/ncssysf_def.h
+++ b/src/base/ncssysf_def.h
@@ -76,6 +76,12 @@ void opensaf_reboot_prepare(void);
  */
 void opensaf_reboot(unsigned node_id, const char* ee_name, const char* reason);
 
+/**
+ * Do quick local node reboot - without first unmounting file systems
+ * or syncing disks attached to the system.
+*/
+void opensaf_quick_reboot(const char* reason);
+
 /*
  ** **
  ** ncs_os_get_time_stamp:  Return the current timestamp as "time_t" in **
diff --git a/src/base/sysf_def.c b/src/base/sysf_def.c
index d0cfc94ef..880f08ec4 100644

[devel] [PATCH 0/1] Review Request for osaf: do quick local node reboot when split network [#3001]

2019-01-25 Thread Vu Minh Nguyen
Summary: osaf: do quick local node reboot when split network [#3001]
Review request for Ticket(s): 3001
Peer Reviewer(s): Gary, Minh, Hans
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3001
Base revision: ab4defdce8c0fee1d68c697a8e0cf7dccb7564b9
Personal repository: git://git.code.sf.net/u/winhvu/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 906f36a82e75898783d38f3e9d55b87a62c0bb38
Author: Vu Minh Nguyen 
Date:   Fri, 25 Jan 2019 18:30:12 +0700

osaf: do quick local node reboot when split network [#3001]



Complete diffstat:
--
 scripts/opensaf_reboot   | 33 +++--
 src/amf/amfd/ndproc.cc   |  4 ++--
 src/base/ncssysf_def.h   |  6 ++
 src/base/sysf_def.c  | 10 ++
 src/fm/fmd/fm_main.cc|  6 +++---
 src/fm/fmd/fm_rda.cc |  5 ++---
 src/rde/rded/rde_main.cc |  6 ++
 7 files changed, 52 insertions(+), 18 deletions(-)


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


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


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] log: fix coredump at log agent application [#3002]

2019-01-24 Thread Vu Minh Nguyen
There is a race in using singleton-static class object b/w mds thread
and application thread - caller of exit() api.

This patch still uses singleton but making the instance shared_ptr
to ensure the resource will not be destroyed if it is being used.
---
 src/log/agent/lga_agent.cc |  7 ++-
 src/log/agent/lga_agent.h  | 21 ++---
 src/log/agent/lga_api.cc   | 20 ++--
 src/log/agent/lga_mds.cc   | 32 
 src/log/agent/lga_state.cc |  2 +-
 src/log/agent/lga_util.cc  | 10 +-
 6 files changed, 48 insertions(+), 44 deletions(-)

diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
index bf9caa935..1000bb3fd 100644
--- a/src/log/agent/lga_agent.cc
+++ b/src/log/agent/lga_agent.cc
@@ -108,7 +108,7 @@ ScopeData::~ScopeData() {
 recovery2_unlock(is_locked_);
   }
 
-  LogAgent::instance().EnterCriticalSection();
+  LogAgent::instance()->EnterCriticalSection();
   LogClient* client = client_data_->client;
   bool* is_updated = client_data_->is_updated;
   RefCounter::Degree client_degree = client_data_->value;
@@ -128,15 +128,12 @@ ScopeData::~ScopeData() {
   stream->RestoreRefCounter(caller, stream_degree, *stream_is_updated);
 }
   }
-  LogAgent::instance().LeaveCriticalSection();
+  LogAgent::instance()->LeaveCriticalSection();
 }
 
 
//--
 // LogAgent
 
//--
-// Singleton represents LOG agent.
-LogAgent LogAgent::me_;
-
 LogAgent::LogAgent() {
   client_list_.clear();
   // There is high risk of calling one @LogClient method
diff --git a/src/log/agent/lga_agent.h b/src/log/agent/lga_agent.h
index 0049da054..0c32ea33b 100644
--- a/src/log/agent/lga_agent.h
+++ b/src/log/agent/lga_agent.h
@@ -19,12 +19,14 @@
 #define SRC_LOG_AGENT_LGA_AGENT_H_
 
 #include 
+#include 
 #include 
 #include 
-#include "mds/mds_papi.h"
 #include 
-#include "base/macros.h"
 #include 
+
+#include "base/macros.h"
+#include "mds/mds_papi.h"
 #include "log/common/lgsv_msg.h"
 #include "log/common/lgsv_defs.h"
 #include "log/agent/lga_common.h"
@@ -80,7 +82,15 @@ class LogClient;
 //<
 class LogAgent {
  public:
-  static LogAgent& instance() { return me_; }
+  static std::shared_ptr& instance() {
+// Ensure this static singleton instance is only destroyed when
+// no one is using it. Note that: static data can be destroyed
+// in log application thread which calls exit() libc. So, introducing
+// shared_ptr<> to avoid races among threads.
+static std::shared_ptr me =
+std::shared_ptr{new LogAgent()};
+return me;
+  }
 
   //<
   // C++ APIs wrapper for corresponding C LOG Agent APIs
@@ -158,11 +168,11 @@ class LogAgent {
   // Introduce these public interface for MDS thread use.
   void EnterCriticalSection();
   void LeaveCriticalSection();
+  ~LogAgent() {}
 
  private:
   // Not allow to create @LogAgent object, except the singleton object @me_.
   LogAgent();
-  ~LogAgent() {}
 
   // True if there is no Active SC, otherwise false
   bool no_active_log_server() const;
@@ -274,9 +284,6 @@ class LogAgent {
   // LGS LGA sync params
   NCS_SEL_OBJ lgs_sync_sel_;
 
-  // Singleton represents LOG Agent in LOG application process
-  static LogAgent me_;
-
   DELETE_COPY_AND_MOVE_OPERATORS(LogAgent);
 };
 
diff --git a/src/log/agent/lga_api.cc b/src/log/agent/lga_api.cc
index 37a1cc650..97dbf1d31 100644
--- a/src/log/agent/lga_api.cc
+++ b/src/log/agent/lga_api.cc
@@ -39,7 +39,7 @@
 SaAisErrorT saLogInitialize(SaLogHandleT* logHandle,
 const SaLogCallbacksT* callbacks,
 SaVersionT* version) {
-  return LogAgent::instance().saLogInitialize(logHandle, callbacks, version);
+  return LogAgent::instance()->saLogInitialize(logHandle, callbacks, version);
 }
 
 /***
@@ -69,7 +69,7 @@ SaAisErrorT saLogInitialize(SaLogHandleT* logHandle,
  ***/
 SaAisErrorT saLogSelectionObjectGet(SaLogHandleT logHandle,
 SaSelectionObjectT* selectionObject) {
-  return LogAgent::instance().saLogSelectionObjectGet(logHandle,
+  return LogAgent::instance()->saLogSelectionObjectGet(logHandle,
   selectionObject);
 }
 
@@ -96,7 +96,7 @@ SaAisErrorT saLogSelectionObjectGet(SaLogHandleT logHandle,
  ***/
 SaAisErrorT saLogDispatch(SaLogHandleT logHandle,
   SaDispatchFlagsT dispatchFlags) {
-  return LogAgent::instance().saLogDispatch(logHandle, dispatchFlags);
+  return LogAgent::instance()->saLogDispatch(logHandle, dispatchFlags);
 }
 
 /***

[devel] [PATCH 0/1] Review Request for log: fix coredump at log agent application [#3002]

2019-01-24 Thread Vu Minh Nguyen
Summary: log: fix coredump at log agent application [#3002]
Review request for Ticket(s): 3002
Peer Reviewer(s): Lennart, Canh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3002
Base revision: c68d843d99087cebe15c9c67f46b9045fb753059
Personal repository: git://git.code.sf.net/u/winhvu/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 160735e4879ee3482170795f6247b71980a0d598
Author: Vu Minh Nguyen 
Date:   Thu, 24 Jan 2019 17:11:45 +0700

log: fix coredump at log agent application [#3002]

There is a race in using singleton-static class object b/w mds thread
and application thread - caller of exit() api.

This patch still uses singleton but making the instance shared_ptr
to ensure the resource will not be destroyed if it is being used.



Complete diffstat:
--
 src/log/agent/lga_agent.cc |  7 ++-
 src/log/agent/lga_agent.h  | 21 ++---
 src/log/agent/lga_api.cc   | 20 ++--
 src/log/agent/lga_mds.cc   | 32 
 src/log/agent/lga_state.cc |  2 +-
 src/log/agent/lga_util.cc  | 10 +-
 6 files changed, 48 insertions(+), 44 deletions(-)


Testing Commands:
-
Very hard to reproduce the issue.

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


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] imm: allow empty-value attribute with default-tag persisted [#2985]

2019-01-14 Thread Vu Minh Nguyen
During runtime, when replacing value of an attribute which has default-value
tag with NULL, this NULL value is not persistent after cluster is rebooted -
NULL value will be automatically replaced with its default value by IMM.

This behavior causes several unexpected results. Below is an use case:
User defines an attribute with name `maxAge`; the value shows how many days
user passwords will get expired; default value is 30 days. If replacing with
a NULL/empty, it means the passwords will never get expired.

User may change the existing value with NULL - expect the passwords never get
expired, but later on, after cluster is rebooted, that value is silently
replaced with the default value without notice of user.

This patch makes some changes in immdump/immloader/imm om library/immnd
to make NULL value in such case persisted even after cluster is rebooted.
---
 src/imm/README   | 10 +---
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 +---
 src/imm/immloadd/imm_pbe_load.cc | 16 --
 src/imm/immnd/ImmModel.cc|  9 ++-
 src/imm/tools/imm_dumper.cc  | 15 -
 src/imm/tools/imm_xmlw_dump.cc   | 98 +---
 7 files changed, 119 insertions(+), 59 deletions(-)

diff --git a/src/imm/README b/src/imm/README
index 7ace34741..132ee0ac0 100644
--- a/src/imm/README
+++ b/src/imm/README
@@ -351,14 +351,8 @@ as part of an attribute definition.
 (i) A default declaration is only allowed for single valued attributes (no
 concept of a multivalued default exists).
 
-(ii) Default values are assigned at object creation. Default values are NOT
-assigned if an attribute is set to the empty/null value by a modification.
-
-(iii) Default values are assigned at cluster restart for any attributes that
-are null/empty and that have a default. This is a special case of (i) because
-imm loading actually uses the regular imm API to recreate the imm contents.
-In particular, saImmOmCcbObjectCreate is used to recreate all objects from
-the file-system image.
+(ii) Default values are assigned at object creation, except the creation comes
+from IMM loader.
 
 Common missunderstandings about "system attributes" of an imm object.
 -
diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc
index 7155799d9..0d24b2335 100644
--- a/src/imm/agent/imma_om_api.cc
+++ b/src/imm/agent/imma_om_api.cc
@@ -2037,7 +2037,7 @@ static SaAisErrorT ccb_object_create_common(
 TRACE_2("ERR_INVALID_PARAM: Not allowed to set attribute %s",
 sysaImplName);
 goto mds_send_fail;
-  } else if (attr->attrValuesNumber == 0) {
+  } else if (attr->attrValuesNumber == 0 && !immOmIsLoader) {
 TRACE("CcbObjectCreate ignoring attribute %s with no values",
   attr->attrName);
 continue;
@@ -2065,7 +2065,9 @@ static SaAisErrorT ccb_object_create_common(
 
   const SaImmAttrValueT *avarr = attr->attrValues;
   /*alloc-5 */
-  imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  if (attr->attrValuesNumber > 0) {
+imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  }
 
   if (attr->attrValuesNumber > 1) {
 unsigned int numAdded = attr->attrValuesNumber - 1;
@@ -2087,6 +2089,7 @@ static SaAisErrorT ccb_object_create_common(
 }
   }
 
+
   rc = imma_evt_fake_evs(cb, , _evt, cl_node->syncr_timeout,
  cl_node->handle, , false);
   cl_node = NULL;
diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc
index e9a985c22..3bd3e2b2e 100644
--- a/src/imm/immloadd/imm_loader.cc
+++ b/src/imm/immloadd/imm_loader.cc
@@ -117,6 +117,7 @@ typedef struct ParserStateStruct {
   SaImmAttrFlagsT attrFlags;
   SaUint32T attrNtfId;
   char *attrDefaultValueBuffer;
+  bool is_null_value;
 
   int attrValueTypeSet;
   int attrNtfIdSet;
@@ -925,6 +926,13 @@ static void startElementHandler(void *userData, const 
xmlChar *name,
 state->state[state->depth] = VALUE;
 state->valueContinue = 0;
 state->isBase64Encoded = isBase64Encoded(attrs);
+state->is_null_value = false;
+if (attrs) {
+  char* null_value = getAttributeValue("xsi:nil", attrs);
+  if (null_value && std::string{null_value} == "true") {
+state->is_null_value = true;
+  }
+}
 /*  */
   } else if (strcmp((const char *)name, "category") == 0) {
 state->state[state->depth] = CATEGORY;
@@ -982,7 +990,7 @@ static void endElementHandler(void *userData, const xmlChar 
*name) {
 
   /*  */
   if (strcmp((const char *)name, "value") == 0) {
-if (state->attrValueBuffers.empty()) {
+if (state->attrValueBuffers.empty() && !state->is_null_value) {
   char *str = (char *)malloc(1);
 
   str[0] = '\0';
@@ -1759,14 +1767,13 @@ void addObjectAttributeDefinition(
   SaImmAttrValuesT_2 attrValues;
   int i;
   size_t len;
+  

[devel] [PATCH 0/1] Review Request for imm: allow empty-value attribute with default-tag persisted [#2985] V3

2019-01-14 Thread Vu Minh Nguyen
Summary: imm: allow empty-value attribute with default-tag persisted [#2985]
Review request for Ticket(s): 2985
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2985
Base revision: 5f7408cc86bbbd7cbaa6f94f9ed83fe70c713a16
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 67b1566d66cbeb2a066ae283a406a122f7168ae5
Author: Vu Minh Nguyen 
Date:   Tue, 15 Jan 2019 10:29:26 +0700

imm: allow empty-value attribute with default-tag persisted [#2985]

During runtime, when replacing value of an attribute which has default-value
tag with NULL, this NULL value is not persistent after cluster is rebooted -
NULL value will be automatically replaced with its default value by IMM.

This behavior causes several unexpected results. Below is an use case:
User defines an attribute with name `maxAge`; the value shows how many days
user passwords will get expired; default value is 30 days. If replacing with
a NULL/empty, it means the passwords will never get expired.

User may change the existing value with NULL - expect the passwords never get
expired, but later on, after cluster is rebooted, that value is silently
replaced with the default value without notice of user.

This patch makes some changes in immdump/immloader/imm om library/immnd
to make NULL value in such case persisted even after cluster is rebooted.



Complete diffstat:
--
 src/imm/README   | 10 +---
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 ++
 src/imm/immloadd/imm_pbe_load.cc | 16 ---
 src/imm/immnd/ImmModel.cc|  9 +++-
 src/imm/tools/imm_dumper.cc  | 15 +-
 src/imm/tools/imm_xmlw_dump.cc   | 98 +++-
 7 files changed, 119 insertions(+), 59 deletions(-)


Testing Commands:
-
1) Import TestClass.xml
immcfg -f TestClass.xml
2) Create an object of TestClass
immcfg -c TestClass testClass=0
3) Replace all attribute values of that object with empty
4) Dump whole IMM database (using with new option -n), and overwrite existing 
imm.xml file
5) Restart cluster with new dump
6) Check the values of attributes that have been replaced with empty
6) Repeat the test with PBE enable.


Testing, Expected Results:
--
The attributes remain empty


Conditions of Submission:
-
Ack(s) from peer reviewer(s)


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

Re: [devel] [PATCH 1/1] imm: allow empty-value attribute with default-tag persisted [#2985]

2019-01-14 Thread Vu Minh Nguyen
Hi Lennart,

Thanks for your comments. 

Yes, your proposal can work but in our case users would like to benefit from
the default values
and in addition with that, they expect to have empty-value attributes
persisted as other persistent 
attribute values do.

As your comment in the ticket, I will update the immdump's code a bit - add
a new option '-n' (--null). 
If the option is given, all empty-value attributes will be dumped with
xsi:nil notation.

Will send the V2 shortly.

Regards, Vu

> -Original Message-
> From: Lennart Lund 
> Sent: Thursday, January 10, 2019 3:40 PM
> To: Vu Minh Nguyen ; Hans Nordebäck
> ; Gary Lee ;
> Karin Holm 
> Cc: opensaf-devel@lists.sourceforge.net; Lennart Lund
> 
> Subject: RE: [PATCH 1/1] imm: allow empty-value attribute with default-tag
> persisted [#2985]
> 
> Hi Vu,
> 
> I have not reviewed the code but have looked at the ticket and it seems to
be
> invalid. To me it seems as if the use case described in the ticket is not
really
> valid even if the IMM behavior is a bit inconsistent (value= is
> replaced by default at restart but other values are not). If I have
understood it
> correctly you say that an attribute where an empty value has a significant
> meaning (from ticket: MaxAge= means that a password never
> expires). This is in itself not an invalid use case but there is already a
way to
> avoid this behavior and that is to not have a default value in the class
> specification. If all values including  is a valid value then
setting a
> default value to be handled by IMM is incorrect. Instead, the software
that
> "owns/is dependent on" this attribute should check if the value is valid
(if for
> example the attribute has a max value so values larger than that max are
> invalid) and if the value is invalid it could be replaced by a default
value.
> 
> Thanks
> Lennart
> 
> -Original Message-
> From: Vu Minh Nguyen 
> Sent: den 10 januari 2019 03:56
> To: Hans Nordebäck ; Lennart Lund
> ; Gary Lee 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1/1] imm: allow empty-value attribute with default-tag
> persisted [#2985]
> 
> Hi,
> 
> Any comment from you? I will push this ticket B/next week if no comment.
> 
> Regards, Vu
> 
> > -Original Message-
> > From: Vu Minh Nguyen 
> > Sent: Wednesday, December 19, 2018 6:11 PM
> > To: hans.nordeb...@ericsson.com; lennart.l...@ericsson.com;
> > gary@dektech.com.au
> > Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> > 
> > Subject: [PATCH 1/1] imm: allow empty-value attribute with default-tag
> > persisted [#2985]
> >
> > During runtime, when replacing value of an attribute which has
> default-value
> > tag with NULL, this NULL value is not persistent after cluster is
> > rebooted
> -
> > NULL value will be automatically replaced with its default value by IMM.
> >
> > This behavior causes several unexpected results. Below is a use case.
> >
> > User defines an attribute with name `maxAge`. It is used to shows how
> > many days user passwords will be expired, default value is 30 days; if
> > replacing
> with
> > a NULL/empty, it means the passwords will never get expired.
> >
> > During runtime, user changes the existing value with NULL - expect the
> > passwords never get expired. Later on, then cluster is rebooted, that
> > value is
> silently
> > replaced with the default without notice of user.
> >
> > This patch makes some changes in immdump/immloader/imm om
> > library/immnd to make NULL value in such case persisted even after
> > cluster is rebooted.
> > ---
> >  src/imm/README   | 10 +---
> >  src/imm/agent/imma_om_api.cc |  7 ++-
> >  src/imm/immloadd/imm_loader.cc   | 23 +---
> >  src/imm/immloadd/imm_pbe_load.cc | 16 --
> >  src/imm/immnd/ImmModel.cc|  9 ++-
> >  src/imm/tools/imm_xmlw_dump.cc   | 96 --
> --
> >  6 files changed, 100 insertions(+), 61 deletions(-)
> >
> > diff --git a/src/imm/README b/src/imm/README index
> > 7ace34741..132ee0ac0 100644
> > --- a/src/imm/README
> > +++ b/src/imm/README
> > @@ -351,14 +351,8 @@ as part of an attribute definition.
> >  (i) A default declaration is only allowed for single valued
> > attributes
> (no
> >  concept of a multivalued default exists).
> >
> > -(ii) Default values are assigned at object creation. Default values
> > are
> NOT
> > -assigned if an attribute is set to the empty/null value by a
> modification.
> > -
> > -(iii) Default values are assigned at cluster res

Re: [devel] [PATCH 1/1] imm: allow empty-value attribute with default-tag persisted [#2985]

2019-01-09 Thread Vu Minh Nguyen
Hi,

Any comment from you? I will push this ticket B/next week if no comment.

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen 
> Sent: Wednesday, December 19, 2018 6:11 PM
> To: hans.nordeb...@ericsson.com; lennart.l...@ericsson.com;
> gary@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] imm: allow empty-value attribute with default-tag
> persisted [#2985]
> 
> During runtime, when replacing value of an attribute which has
default-value
> tag with NULL, this NULL value is not persistent after cluster is rebooted
-
> NULL value will be automatically replaced with its default value by IMM.
> 
> This behavior causes several unexpected results. Below is a use case.
> 
> User defines an attribute with name `maxAge`. It is used to shows how many
> days
> user passwords will be expired, default value is 30 days; if replacing
with
> a NULL/empty, it means the passwords will never get expired.
> 
> During runtime, user changes the existing value with NULL - expect the
> passwords
> never get expired. Later on, then cluster is rebooted, that value is
silently
> replaced with the default without notice of user.
> 
> This patch makes some changes in immdump/immloader/imm om
> library/immnd
> to make NULL value in such case persisted even after cluster is rebooted.
> ---
>  src/imm/README   | 10 +---
>  src/imm/agent/imma_om_api.cc |  7 ++-
>  src/imm/immloadd/imm_loader.cc   | 23 +---
>  src/imm/immloadd/imm_pbe_load.cc | 16 --
>  src/imm/immnd/ImmModel.cc|  9 ++-
>  src/imm/tools/imm_xmlw_dump.cc   | 96 
>  6 files changed, 100 insertions(+), 61 deletions(-)
> 
> diff --git a/src/imm/README b/src/imm/README
> index 7ace34741..132ee0ac0 100644
> --- a/src/imm/README
> +++ b/src/imm/README
> @@ -351,14 +351,8 @@ as part of an attribute definition.
>  (i) A default declaration is only allowed for single valued attributes
(no
>  concept of a multivalued default exists).
> 
> -(ii) Default values are assigned at object creation. Default values are
NOT
> -assigned if an attribute is set to the empty/null value by a
modification.
> -
> -(iii) Default values are assigned at cluster restart for any attributes
that
> -are null/empty and that have a default. This is a special case of (i)
because
> -imm loading actually uses the regular imm API to recreate the imm
contents.
> -In particular, saImmOmCcbObjectCreate is used to recreate all objects
from
> -the file-system image.
> +(ii) Default values are assigned at object creation, except the creation
> comes
> +from IMM loader.
> 
>  Common missunderstandings about "system attributes" of an imm object.
>  -
> diff --git a/src/imm/agent/imma_om_api.cc
> b/src/imm/agent/imma_om_api.cc
> index 7155799d9..0d24b2335 100644
> --- a/src/imm/agent/imma_om_api.cc
> +++ b/src/imm/agent/imma_om_api.cc
> @@ -2037,7 +2037,7 @@ static SaAisErrorT ccb_object_create_common(
>  TRACE_2("ERR_INVALID_PARAM: Not allowed to set attribute %s",
>  sysaImplName);
>  goto mds_send_fail;
> -  } else if (attr->attrValuesNumber == 0) {
> +  } else if (attr->attrValuesNumber == 0 && !immOmIsLoader) {
>  TRACE("CcbObjectCreate ignoring attribute %s with no values",
>attr->attrName);
>  continue;
> @@ -2065,7 +2065,9 @@ static SaAisErrorT ccb_object_create_common(
> 
>const SaImmAttrValueT *avarr = attr->attrValues;
>/*alloc-5 */
> -  imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType,
avarr[0]);
> +  if (attr->attrValuesNumber > 0) {
> +imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType,
avarr[0]);
> +  }
> 
>if (attr->attrValuesNumber > 1) {
>  unsigned int numAdded = attr->attrValuesNumber - 1;
> @@ -2087,6 +2089,7 @@ static SaAisErrorT ccb_object_create_common(
>  }
>}
> 
> +
>rc = imma_evt_fake_evs(cb, , _evt, cl_node->syncr_timeout,
>   cl_node->handle, , false);
>cl_node = NULL;
> diff --git a/src/imm/immloadd/imm_loader.cc
> b/src/imm/immloadd/imm_loader.cc
> index e9a985c22..3bd3e2b2e 100644
> --- a/src/imm/immloadd/imm_loader.cc
> +++ b/src/imm/immloadd/imm_loader.cc
> @@ -117,6 +117,7 @@ typedef struct ParserStateStruct {
>SaImmAttrFlagsT attrFlags;
>SaUint32T attrNtfId;
>char *attrDefaultValueBuffer;
> +  bool is_null_value;
> 
>int attrValueTypeSet;
>int attrNtfIdSet;
> @@ -925,6 +926

Re: [devel] [PATCH 1/1] log: Update level of printout info in syslog from ER to WA [#2990]

2018-12-27 Thread Vu Minh Nguyen
Hi Canh,

Ack for the patch. However, I think the ticket slogan should be updated to
reflect the case. Thanks.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Thursday, December 27, 2018 3:10 PM
> To: vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] log: Update level of printout info in syslog from ER
to
> WA [#2990]
> 
> ---
>  src/log/logd/lgs_evt.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/log/logd/lgs_evt.cc b/src/log/logd/lgs_evt.cc
> index 589cb262b..35d939a4b 100644
> --- a/src/log/logd/lgs_evt.cc
> +++ b/src/log/logd/lgs_evt.cc
> @@ -1523,7 +1523,7 @@ static uint32_t process_api_evt(lgsv_lgs_evt_t
> *evt) {
>}
> 
>if (lgs_lga_api_msg_dispatcher[api_type](lgs_cb, evt) !=
> NCSCC_RC_SUCCESS) {
> -LOG_ER("lgs_lga_api_msg_dispatcher FAILED type: %d", evt-
> >info.msg.type);
> +LOG_WA("lgs_lga_api_msg_dispatcher FAILED type: %d", evt-
> >info.msg.type);
>}
> 
>  done:
> --
> 2.15.1




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


Re: [devel] [PATCH 1/1] imm: correct mismatched log info showing resources in displayverbose [#2986]

2018-12-25 Thread Vu Minh Nguyen
Ack

Thanks, Vu

> -Original Message-
> From: khanh.h.dang 
> Sent: Wednesday, December 19, 2018 4:53 PM
> To: vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; khanh.h.dang
> 
> Subject: [PATCH 1/1] imm: correct mismatched log info showing resources in
> displayverbose [#2986]
> 
> fix notification log, displaying resources when the number is greater than
> 127, instead of 128.
> fix mismatched information of resource type.
> ---
>  src/imm/immnd/ImmModel.cc | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/imm/immnd/ImmModel.cc b/src/imm/immnd/ImmModel.cc
> index 8e3f338..b301a51 100644
> --- a/src/imm/immnd/ImmModel.cc
> +++ b/src/imm/immnd/ImmModel.cc
> @@ -13671,8 +13671,8 @@ SaAisErrorT ImmModel::resourceDisplay(
> 
>  } else {
>LOG_NO(
> -  "The Number of implementers are greater than 128,
displaying the
> implementers"
> -  "information to syslog");
> +  "The number of implementers is greater than 127, "
> +  "displaying the implementers information to syslog");
>ImplementerVector::iterator i;
>for (i = sImplementerVector.begin(); i !=
sImplementerVector.end();
> ++i) {
> @@ -13707,12 +13707,12 @@ SaAisErrorT ImmModel::resourceDisplay(
>}
>  } else {
>LOG_NO(
> -  "The Number of AdminOwners are greater than 128, displaying
the
> adminowner"
> -  "information to syslog");
> +  "The number of adminowners is greater than 127, "
> +  "displaying the adminowners information to syslog");
>AdminOwnerVector::iterator i;
>for (i = sOwnerVector.begin(); i != sOwnerVector.end(); ++i) {
>  AdminOwnerInfo* adminOwner = (*i);
> -LOG_IN("Implementer name %s and location of the implementer
is
> %u",
> +LOG_IN("Adminowner name %s and location of the adminowner is
> %u",
> adminOwner->mAdminOwnerName.c_str(), adminOwner-
> >mNodeId);
>}
>  }
> --
> 2.7.4




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


[devel] [PATCH 0/1] Review Request for imm: allow empty-value attribute with default-tag persisted [#2985] V2

2018-12-19 Thread Vu Minh Nguyen
Summary: imm: allow empty-value attribute with default-tag persisted [#2985] V2
Review request for Ticket(s): 2985
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2985
Base revision: 9ce47c5a79cc080d89d192bc1947ebd04aa0a122
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 39f46dd06f7705929c293d00b48443570b6af235
Author: Vu Minh Nguyen 
Date:   Wed, 19 Dec 2018 18:00:48 +0700

imm: allow empty-value attribute with default-tag persisted [#2985]

During runtime, when replacing value of an attribute which has default-value
tag with NULL, this NULL value is not persistent after cluster is rebooted -
NULL value will be automatically replaced with its default value by IMM.

This behavior causes several unexpected results. Below is a use case.

User defines an attribute with name `maxAge`. It is used to shows how many days
user passwords will be expired, default value is 30 days; if replacing with
a NULL/empty, it means the passwords will never get expired.

During runtime, user changes the existing value with NULL - expect the passwords
never get expired. Later on, then cluster is rebooted, that value is silently
replaced with the default without notice of user.

This patch makes some changes in immdump/immloader/imm om library/immnd
to make NULL value in such case persisted even after cluster is rebooted.



Complete diffstat:
--
 src/imm/README   | 10 +
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 ++
 src/imm/immloadd/imm_pbe_load.cc | 16 ---
 src/imm/immnd/ImmModel.cc|  9 +++-
 src/imm/tools/imm_xmlw_dump.cc   | 96 +---
 6 files changed, 100 insertions(+), 61 deletions(-)


Testing Commands:
-
1) Import TestClass.xml
immcfg -f TestClass.xml
2) Create an object of TestClass
immcfg -c TestClass testClass=0
3) Replace all attribute values of that object with empty
4) Dump whole IMM database, and overwrite existing imm.xml file
5) Restart cluster with new dump
6) Check the values of attributes that have been replaced with empty
6) Repeat the test with PBE enable.


Testing, Expected Results:
--
The values remains empty after cluster is rebooted.


Conditions of Submission:
-
Ack from peer reviewers


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 h

[devel] [PATCH 1/1] imm: allow empty-value attribute with default-tag persisted [#2985]

2018-12-19 Thread Vu Minh Nguyen
During runtime, when replacing value of an attribute which has default-value
tag with NULL, this NULL value is not persistent after cluster is rebooted -
NULL value will be automatically replaced with its default value by IMM.

This behavior causes several unexpected results. Below is a use case.

User defines an attribute with name `maxAge`. It is used to shows how many days
user passwords will be expired, default value is 30 days; if replacing with
a NULL/empty, it means the passwords will never get expired.

During runtime, user changes the existing value with NULL - expect the passwords
never get expired. Later on, then cluster is rebooted, that value is silently
replaced with the default without notice of user.

This patch makes some changes in immdump/immloader/imm om library/immnd
to make NULL value in such case persisted even after cluster is rebooted.
---
 src/imm/README   | 10 +---
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 +---
 src/imm/immloadd/imm_pbe_load.cc | 16 --
 src/imm/immnd/ImmModel.cc|  9 ++-
 src/imm/tools/imm_xmlw_dump.cc   | 96 
 6 files changed, 100 insertions(+), 61 deletions(-)

diff --git a/src/imm/README b/src/imm/README
index 7ace34741..132ee0ac0 100644
--- a/src/imm/README
+++ b/src/imm/README
@@ -351,14 +351,8 @@ as part of an attribute definition.
 (i) A default declaration is only allowed for single valued attributes (no
 concept of a multivalued default exists).
 
-(ii) Default values are assigned at object creation. Default values are NOT
-assigned if an attribute is set to the empty/null value by a modification.
-
-(iii) Default values are assigned at cluster restart for any attributes that
-are null/empty and that have a default. This is a special case of (i) because
-imm loading actually uses the regular imm API to recreate the imm contents.
-In particular, saImmOmCcbObjectCreate is used to recreate all objects from
-the file-system image.
+(ii) Default values are assigned at object creation, except the creation comes
+from IMM loader.
 
 Common missunderstandings about "system attributes" of an imm object.
 -
diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc
index 7155799d9..0d24b2335 100644
--- a/src/imm/agent/imma_om_api.cc
+++ b/src/imm/agent/imma_om_api.cc
@@ -2037,7 +2037,7 @@ static SaAisErrorT ccb_object_create_common(
 TRACE_2("ERR_INVALID_PARAM: Not allowed to set attribute %s",
 sysaImplName);
 goto mds_send_fail;
-  } else if (attr->attrValuesNumber == 0) {
+  } else if (attr->attrValuesNumber == 0 && !immOmIsLoader) {
 TRACE("CcbObjectCreate ignoring attribute %s with no values",
   attr->attrName);
 continue;
@@ -2065,7 +2065,9 @@ static SaAisErrorT ccb_object_create_common(
 
   const SaImmAttrValueT *avarr = attr->attrValues;
   /*alloc-5 */
-  imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  if (attr->attrValuesNumber > 0) {
+imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  }
 
   if (attr->attrValuesNumber > 1) {
 unsigned int numAdded = attr->attrValuesNumber - 1;
@@ -2087,6 +2089,7 @@ static SaAisErrorT ccb_object_create_common(
 }
   }
 
+
   rc = imma_evt_fake_evs(cb, , _evt, cl_node->syncr_timeout,
  cl_node->handle, , false);
   cl_node = NULL;
diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc
index e9a985c22..3bd3e2b2e 100644
--- a/src/imm/immloadd/imm_loader.cc
+++ b/src/imm/immloadd/imm_loader.cc
@@ -117,6 +117,7 @@ typedef struct ParserStateStruct {
   SaImmAttrFlagsT attrFlags;
   SaUint32T attrNtfId;
   char *attrDefaultValueBuffer;
+  bool is_null_value;
 
   int attrValueTypeSet;
   int attrNtfIdSet;
@@ -925,6 +926,13 @@ static void startElementHandler(void *userData, const 
xmlChar *name,
 state->state[state->depth] = VALUE;
 state->valueContinue = 0;
 state->isBase64Encoded = isBase64Encoded(attrs);
+state->is_null_value = false;
+if (attrs) {
+  char* null_value = getAttributeValue("xsi:nil", attrs);
+  if (null_value && std::string{null_value} == "true") {
+state->is_null_value = true;
+  }
+}
 /*  */
   } else if (strcmp((const char *)name, "category") == 0) {
 state->state[state->depth] = CATEGORY;
@@ -982,7 +990,7 @@ static void endElementHandler(void *userData, const xmlChar 
*name) {
 
   /*  */
   if (strcmp((const char *)name, "value") == 0) {
-if (state->attrValueBuffers.empty()) {
+if (state->attrValueBuffers.empty() && !state->is_null_value) {
   char *str = (char *)malloc(1);
 
   str[0] = '\0';
@@ -1759,14 +1767,13 @@ void addObjectAttributeDefinition(
   SaImmAttrValuesT_2 attrValues;
   int i;
   size_t len;
+  bool null_value = 

[devel] [PATCH 1/1] imm: allow empty-value attribute with default-tag persisted [#2985]

2018-12-19 Thread Vu Minh Nguyen
When replacing value of an attribute which has default-value tag with NULL
during runtime, NULL value will be replaced with its default value after
cluster is rebooted; in other words, that value is not persisted.

This patch makes some changes in immdump/immloader/imm om library/immnd
to handle such requirement.
---
 src/imm/README   | 10 +---
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 +---
 src/imm/immloadd/imm_pbe_load.cc | 16 --
 src/imm/immnd/ImmModel.cc|  9 ++-
 src/imm/tools/imm_xmlw_dump.cc   | 96 
 6 files changed, 100 insertions(+), 61 deletions(-)

diff --git a/src/imm/README b/src/imm/README
index 7ace34741..132ee0ac0 100644
--- a/src/imm/README
+++ b/src/imm/README
@@ -351,14 +351,8 @@ as part of an attribute definition.
 (i) A default declaration is only allowed for single valued attributes (no
 concept of a multivalued default exists).
 
-(ii) Default values are assigned at object creation. Default values are NOT
-assigned if an attribute is set to the empty/null value by a modification.
-
-(iii) Default values are assigned at cluster restart for any attributes that
-are null/empty and that have a default. This is a special case of (i) because
-imm loading actually uses the regular imm API to recreate the imm contents.
-In particular, saImmOmCcbObjectCreate is used to recreate all objects from
-the file-system image.
+(ii) Default values are assigned at object creation, except the creation comes
+from IMM loader.
 
 Common missunderstandings about "system attributes" of an imm object.
 -
diff --git a/src/imm/agent/imma_om_api.cc b/src/imm/agent/imma_om_api.cc
index 7155799d9..0d24b2335 100644
--- a/src/imm/agent/imma_om_api.cc
+++ b/src/imm/agent/imma_om_api.cc
@@ -2037,7 +2037,7 @@ static SaAisErrorT ccb_object_create_common(
 TRACE_2("ERR_INVALID_PARAM: Not allowed to set attribute %s",
 sysaImplName);
 goto mds_send_fail;
-  } else if (attr->attrValuesNumber == 0) {
+  } else if (attr->attrValuesNumber == 0 && !immOmIsLoader) {
 TRACE("CcbObjectCreate ignoring attribute %s with no values",
   attr->attrName);
 continue;
@@ -2065,7 +2065,9 @@ static SaAisErrorT ccb_object_create_common(
 
   const SaImmAttrValueT *avarr = attr->attrValues;
   /*alloc-5 */
-  imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  if (attr->attrValuesNumber > 0) {
+imma_copyAttrValue(&(p->n.attrValue), attr->attrValueType, avarr[0]);
+  }
 
   if (attr->attrValuesNumber > 1) {
 unsigned int numAdded = attr->attrValuesNumber - 1;
@@ -2087,6 +2089,7 @@ static SaAisErrorT ccb_object_create_common(
 }
   }
 
+
   rc = imma_evt_fake_evs(cb, , _evt, cl_node->syncr_timeout,
  cl_node->handle, , false);
   cl_node = NULL;
diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc
index e9a985c22..3bd3e2b2e 100644
--- a/src/imm/immloadd/imm_loader.cc
+++ b/src/imm/immloadd/imm_loader.cc
@@ -117,6 +117,7 @@ typedef struct ParserStateStruct {
   SaImmAttrFlagsT attrFlags;
   SaUint32T attrNtfId;
   char *attrDefaultValueBuffer;
+  bool is_null_value;
 
   int attrValueTypeSet;
   int attrNtfIdSet;
@@ -925,6 +926,13 @@ static void startElementHandler(void *userData, const 
xmlChar *name,
 state->state[state->depth] = VALUE;
 state->valueContinue = 0;
 state->isBase64Encoded = isBase64Encoded(attrs);
+state->is_null_value = false;
+if (attrs) {
+  char* null_value = getAttributeValue("xsi:nil", attrs);
+  if (null_value && std::string{null_value} == "true") {
+state->is_null_value = true;
+  }
+}
 /*  */
   } else if (strcmp((const char *)name, "category") == 0) {
 state->state[state->depth] = CATEGORY;
@@ -982,7 +990,7 @@ static void endElementHandler(void *userData, const xmlChar 
*name) {
 
   /*  */
   if (strcmp((const char *)name, "value") == 0) {
-if (state->attrValueBuffers.empty()) {
+if (state->attrValueBuffers.empty() && !state->is_null_value) {
   char *str = (char *)malloc(1);
 
   str[0] = '\0';
@@ -1759,14 +1767,13 @@ void addObjectAttributeDefinition(
   SaImmAttrValuesT_2 attrValues;
   int i;
   size_t len;
+  bool null_value = attrValueBuffers->empty();
+
   TRACE_ENTER2("attrValueBuffers size:%u",
(unsigned int)attrValueBuffers->size());
   /* The attrName must be set */
   assert(attrName);
 
-  /* The value array can not be empty */
-  assert(!attrValueBuffers->empty());
-
   /* The object class must be set */
   assert(objectClass);
 
@@ -1778,15 +1785,15 @@ void addObjectAttributeDefinition(
 
   /* For each value, convert from char* to SaImmAttrValuesT_2 and
  store an array pointing to all in attrValues */
-  attrValues.attrValuesNumber = attrValueBuffers->size();
-  

[devel] [PATCH 0/1] Review Request for imm: allow empty-value attribute with default-tag persisted [#2985]

2018-12-19 Thread Vu Minh Nguyen
Summary: imm: allow empty-value attribute with default-tag persisted [#2985]
Review request for Ticket(s): 2985
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2985
Base revision: 9ce47c5a79cc080d89d192bc1947ebd04aa0a122
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision ae02c3dcafe8934eb73887ce8e1f02be83cd6942
Author: Vu Minh Nguyen 
Date:   Wed, 19 Dec 2018 16:13:47 +0700

imm: allow empty-value attribute with default-tag persisted [#2985]

When replacing value of an attribute which has default-value tag with NULL
during runtime, NULL value will be replaced with its default value after
cluster is rebooted; in other words, that value is not persisted.

This patch makes some changes in immdump/immloader/imm om library/immnd
to handle such requirement.



Complete diffstat:
--
 src/imm/README   | 10 +
 src/imm/agent/imma_om_api.cc |  7 ++-
 src/imm/immloadd/imm_loader.cc   | 23 ++
 src/imm/immloadd/imm_pbe_load.cc | 16 ---
 src/imm/immnd/ImmModel.cc|  9 +++-
 src/imm/tools/imm_xmlw_dump.cc   | 96 +---
 6 files changed, 100 insertions(+), 61 deletions(-)


Testing Commands:
-
1) Import TestClass.xml
immcfg -f TestClass.xml
2) Create an object of TestClass
immcfg -c TestClass testClass=0
3) Replace all attribute values of that object with empty
4) Dump whole IMM database, and overwrite existing imm.xml file
5) Restart cluster with new dump
6) Check the values of attributes that have been replaced with empty
6) Repeat the test with PBE enable.


Testing, Expected Results:
--
The values remains empty.


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

___ Your changes affect u

[devel] [PATCH 1/1] imm: coredump when importing object having SaAnyT type value [#2988]

2018-12-18 Thread Vu Minh Nguyen
With SaAnyT value, imm import passed wrong memory pointer to free().
---
 src/imm/tools/imm_import.cc | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/src/imm/tools/imm_import.cc b/src/imm/tools/imm_import.cc
index ba5023b17..32a3f5424 100644
--- a/src/imm/tools/imm_import.cc
+++ b/src/imm/tools/imm_import.cc
@@ -345,13 +345,7 @@ static void free_parserState(ParserState *state) {
 for (it = state->attrValues.begin(); it != state->attrValues.end(); ++it) {
   free(it->attrName);
   for (i = 0; it->attrValues[i]; i++) {
-if (it->attrValueType == SA_IMM_ATTR_SASTRINGT ||
-it->attrValueType == SA_IMM_ATTR_SAANYT) {
-  free(*(void **)(it->attrValues[i]));
-} else if (it->attrValueType == SA_IMM_ATTR_SANAMET) {
-  osaf_extended_name_free((SaNameT *)it->attrValues[i]);
-}
-free(it->attrValues[i]);
+free_attr_value(it->attrValueType, it->attrValues[i]);
   }
   free(it->attrValues);
 }
@@ -833,13 +827,7 @@ done:
   for (it = state->attrValues.begin(); it != state->attrValues.end(); ++it) {
 free(it->attrName);
 for (i = 0; it->attrValues[i]; i++) {
-  if (it->attrValueType == SA_IMM_ATTR_SASTRINGT ||
-  it->attrValueType == SA_IMM_ATTR_SAANYT) {
-free(*(void **)(it->attrValues[i]));
-  } else if (it->attrValueType == SA_IMM_ATTR_SANAMET) {
-osaf_extended_name_free((SaNameT *)it->attrValues[i]);
-  }
-  free(it->attrValues[i]);
+  free_attr_value(it->attrValueType, it->attrValues[i]);
 }
 free(it->attrValues);
   }
-- 
2.19.2



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


[devel] [PATCH 0/1] Review Request for imm: coredump when importing object having SaAnyT type value [#2988] V2

2018-12-18 Thread Vu Minh Nguyen
Summary: imm: coredump when importing object having SaAnyT type value [#2988]
Review request for Ticket(s): 2988
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2988
Base revision: 9ce47c5a79cc080d89d192bc1947ebd04aa0a122
Personal repository: git://git.code.sf.net/u/winhvu/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   n
 Other   y


Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 7a2b68423960faf56983bc69995dc09a284f56e7
Author: Vu Minh Nguyen 
Date:   Wed, 19 Dec 2018 14:10:49 +0700

imm: coredump when importing object having SaAnyT type value [#2988]

With SaAnyT value, imm import passed wrong memory pointer to free().



Complete diffstat:
--
 src/imm/tools/imm_import.cc | 16 ++--
 1 file changed, 2 insertions(+), 14 deletions(-)


Testing Commands:
-
immcfg -f TestClass.xml


Testing, Expected Results:
--
no coredump is generated


Conditions of Submission:
-
Ack from peer reviewer(s)


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] imm: coredump when importing object having SaAnyT type value [#2988]

2018-12-18 Thread Vu Minh Nguyen
With SaAnyT value, imm import passed wrong memory pointer to free().
---
 src/imm/tools/imm_import.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/imm/tools/imm_import.cc b/src/imm/tools/imm_import.cc
index ba5023b17..46dd32072 100644
--- a/src/imm/tools/imm_import.cc
+++ b/src/imm/tools/imm_import.cc
@@ -833,9 +833,10 @@ done:
   for (it = state->attrValues.begin(); it != state->attrValues.end(); ++it) {
 free(it->attrName);
 for (i = 0; it->attrValues[i]; i++) {
-  if (it->attrValueType == SA_IMM_ATTR_SASTRINGT ||
-  it->attrValueType == SA_IMM_ATTR_SAANYT) {
-free(*(void **)(it->attrValues[i]));
+  if (it->attrValueType == SA_IMM_ATTR_SASTRINGT) {
+free(*(SaStringT*)(it->attrValues[i]));
+  } else if (it->attrValueType == SA_IMM_ATTR_SAANYT) {
+free(((SaAnyT*)it->attrValues[i])->bufferAddr);
   } else if (it->attrValueType == SA_IMM_ATTR_SANAMET) {
 osaf_extended_name_free((SaNameT *)it->attrValues[i]);
   }
-- 
2.19.2



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


[devel] [PATCH 0/1] Review Request for imm: coredump when importing object having SaAnyT type value [#2988]

2018-12-18 Thread Vu Minh Nguyen
Summary: imm: coredump when importing object having SaAnyT type value [#2988]
Review request for Ticket(s): 2988
Peer Reviewer(s): Lennart, Gary, Hans
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2988
Base revision: 9ce47c5a79cc080d89d192bc1947ebd04aa0a122
Personal repository: git://git.code.sf.net/u/winhvu/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   n
 Other   y


Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision a8fa9340bc3d3062df422672d4872f53c67aaf7e
Author: Vu Minh Nguyen 
Date:   Wed, 19 Dec 2018 11:33:49 +0700

imm: coredump when importing object having SaAnyT type value [#2988]

With SaAnyT value, imm import passed wrong memory pointer to free().



Complete diffstat:
--
 src/imm/tools/imm_import.cc | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)


Testing Commands:
-
immcfg -f TestClass.xml


Testing, Expected Results:
--
No coredump is generated


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


Re: [devel] [PATCH 1/1] imm: initialize attrDefinitionsOut with NULL [#2987]

2018-12-17 Thread Vu Minh Nguyen
Ack. Thanks.

I am going to push this today.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Monday, December 17, 2018 3:16 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 1/1] imm: initialize attrDefinitionsOut with NULL [#2987]
> 
> ---
>  src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> b/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> index 1d4e8eb..be512f6 100644
> --- a/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> @@ -191,7 +191,7 @@ void
> saImmOmClassDescriptionGet_2_with_className_as_null(void)
>   SA_IMM_ATTR_RUNTIME | SA_IMM_ATTR_RDN |
> SA_IMM_ATTR_CACHED, NULL};
>   const SaImmAttrDefinitionT_2 *attrDefinitionsIn[] = {, NULL};
>   SaImmClassCategoryT classCategory;
> - SaImmAttrDefinitionT_2 **attrDefinitionsOut;
> + SaImmAttrDefinitionT_2 **attrDefinitionsOut = NULL;
> 
>   safassert(immutil_saImmOmInitialize(,
> , ),
> SA_AIS_OK);
> --
> 2.7.4




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


Re: [devel] [PATCH 1/1] imm: add new test cases in imm apitest v2 [#2951]

2018-12-11 Thread Vu Minh Nguyen
Ack. 

Thanks, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Friday, November 30, 2018 1:04 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 1/1] imm: add new test cases in imm apitest v2 [#2951]
> 
> ---
>  .../apitest/management/test_saImmOmClassCreate_2.c | 129
> +
>  .../apitest/management/test_saImmOmClassDelete.c   |  27 +
>  .../management/test_saImmOmClassDescriptionGet_2.c |  32 +
>  src/imm/apitest/management/test_saImmOmDispatch.c  | 122
> +++
>  src/imm/apitest/management/test_saImmOmFinalize.c  |  26 +
>  .../apitest/management/test_saImmOmInitialize.c|  53 +
>  .../management/test_saImmOmSelectionObjectGet.c|  26 +
>  7 files changed, 415 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> index 4f25f8b..f43884e 100644
> --- a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> @@ -426,6 +426,110 @@ void saImmOmClassCreate_2_19(void)
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> 
> +/* Object to test: saImmOmClassCreate_2() API:
> + * Test: Creating a config class with invalid handle
> + * step1:Call saImmOmInitialize() API and it returns SA_AIS_OK
> + * step2:Now call the saImmOmClassCreate_2() with -1
> + * Result: Shall fail with return code SA_AIS_ERR_BAD_HANDLE
> + */
> +void saImmOmClassCreate_2_with_invalid_handle_with_config_class(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = immutil_saImmOmClassCreate_2(-1, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> +
> +/* Object to test: saImmOmClassCreate_2() API:
> + * Test: Creating a config class with uninitialized handle
> + * Result: Shall fail with return code SA_AIS_ERR_BAD_HANDLE
> + */
> +void saImmOmClassCreate_2_uninitialized_handle_with_config_class(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +/* Object to test: saImmOmClassCreate_2() API:
> + * Test: Creating a runtime class with uninitialized handle
> + * Result: Shall fail with return code SA_AIS_ERR_BAD_HANDLE
> + */
> +void
> saImmOmClassCreate_2_with_uninitialized_handle_with_runtime_class(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {
> + "rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_RUNTIME | SA_IMM_ATTR_RDN |
> SA_IMM_ATTR_CACHED, NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_RUNTIME,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +
> +/* Object to test: saImmOmClassCreate_2() API:
> + * Test: Creating a config class with invalid handle
> + * step1:Call saImmOmInitialize() API and it returns SA_AIS_OK
> + * step2:Call saImmOmFinalize()
> + * step3:Now call the saImmOmClassCreate_2() with immOmHandle
> + * Result: Shall fail with return code SA_AIS_ERR_BAD_HANDLE
> + */
> +void saImmOmClassCreate_2_with_finalized_handle_config_class(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, 

Re: [devel] [PATCH 2/3] imm: add new test case of API saImmOmClassDescriptionGet_2() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack with a minor comment. Thanks.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Friday, November 2, 2018 2:08 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 2/3] imm: add new test case of API
> saImmOmClassDescriptionGet_2() of apitest [#2951]
> 
> ---
>  .../apitest/management/test_saImmOmClassCreate_2.c |  3 +++
>  .../management/test_saImmOmClassDescriptionGet_2.c | 25
> ++
>  2 files changed, 28 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> index 9afbbe7..ea4db45 100644
> --- a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> @@ -1509,6 +1509,7 @@ extern void
> saImmOmClassDescriptionGet_2_02(void);
>  extern void saImmOmClassDescriptionGet_2_03(void);
>  extern void saImmOmClassDescriptionGet_2_04(void);
>  extern void saImmOmClassDescriptionGet_2_05(void);
> +extern void saImmOmClassDescriptionGet_2_06(void);
>  extern void saImmOmClassDescriptionMemoryFree_2_01(void);
>  extern void saImmOmClassDescriptionMemoryFree_2_02(void);
> 
> @@ -1604,6 +1605,8 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   2, saImmOmClassDescriptionGet_2_05,
>   "saImmOmClassDescriptionGet_2 - SA_AIS_OK, Fetch includes
> SA_IMM_ATTR_NO_DANGLING");
> + test_case_add(2, saImmOmClassDescriptionGet_2_06,
> +   "saImmOmClassDescriptionGet_2 -
> SA_AIS_ERR_INVALID_PARAM");
[Vu] Lack of test slogan. A suggestion "Get class descriptor of an invalid
class name".
> 
>   test_case_add(2, saImmOmClassDescriptionMemoryFree_2_01,
> "saImmOmClassDescriptionMemoryFree_2 - SA_AIS_OK");
> diff --git
> a/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> b/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> index ecf7ceb..bada265 100644
> --- a/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassDescriptionGet_2.c
> @@ -175,3 +175,28 @@ void saImmOmClassDescriptionGet_2_05(void)
>   safassert(immutil_saImmOmClassDelete(immOmHandle, className),
> SA_AIS_OK);
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> +
> +void saImmOmClassDescriptionGet_2_06(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {
> + "rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_RUNTIME | SA_IMM_ATTR_RDN |
> SA_IMM_ATTR_CACHED, NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitionsIn[] = {, NULL};
> + SaImmClassCategoryT classCategory;
> + SaImmAttrDefinitionT_2 **attrDefinitionsOut;
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + safassert(immutil_saImmOmClassCreate_2(immOmHandle,
> className,
> +SA_IMM_CLASS_RUNTIME,
> attrDefinitionsIn),
> +   SA_AIS_OK);
> + rc = immutil_saImmOmClassDescriptionGet_2(immOmHandle, NULL,
> +   ,
);
> + test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
> +
>   safassert(immutil_saImmOmClassDescriptionMemoryFree_2(immOm
> Handle,
> +   attrDefinitionsOut),
> +   SA_AIS_OK);
> + safassert(immutil_saImmOmClassDelete(immOmHandle, className),
> SA_AIS_OK);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> --
> 2.7.4




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


Re: [devel] [PATCH 3/3] imm: add new test case of API saImmOmClassDelete() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Friday, November 2, 2018 2:08 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 3/3] imm: add new test case of API saImmOmClassDelete()
> of apitest [#2951]
> 
> ---
>  .../apitest/management/test_saImmOmClassCreate_2.c|  4 
>  src/imm/apitest/management/test_saImmOmClassDelete.c  | 19
> +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> index ea4db45..d8810e9 100644
> --- a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> @@ -1517,6 +1517,7 @@ extern void saImmOmClassDelete_2_01(void);
>  extern void saImmOmClassDelete_2_02(void);
>  extern void saImmOmClassDelete_2_03(void);
>  extern void saImmOmClassDelete_2_04(void);
> +extern void saImmOmClassDelete_2_05(void);
> 
>  __attribute__((constructor)) static void
saImmOmInitialize_constructor(void)
>  {
> @@ -1627,6 +1628,9 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   2, saImmOmClassDelete_2_04,
>   "saImmOmClassDelete_2  - SA_AIS_ERR_INVALID_PARAM, Empty
> classname");
> + test_case_add(
> + 2, saImmOmClassDelete_2_05,
> + "saImmOmClassDelete_2 - SA_AIS_ERR_NOT_EXIST ");
[Vu] Please add a slogan for this test case. A suggestion "Double delete a
class name"
> 
>   test_case_add(
>   2, saImmOmClassCreate_SchemaChange_2_01,
> diff --git a/src/imm/apitest/management/test_saImmOmClassDelete.c
> b/src/imm/apitest/management/test_saImmOmClassDelete.c
> index 273d192..ad36b8f 100644
> --- a/src/imm/apitest/management/test_saImmOmClassDelete.c
> +++ b/src/imm/apitest/management/test_saImmOmClassDelete.c
> @@ -76,3 +76,22 @@ void saImmOmClassDelete_2_04(void)
>   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> +
> +void saImmOmClassDelete_2_05(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> + SA_AIS_OK);
> + safassert(immutil_saImmOmClassCreate_2(immOmHandle,
> className,
> +SA_IMM_CLASS_CONFIG,
attrDefinitions),
> +   SA_AIS_OK);
> + immutil_saImmOmClassDelete(immOmHandle, className);
[Vu] Should add an assertion for the first delete to make sure the class has
been successfully deleted.
> + rc = immutil_saImmOmClassDelete(immOmHandle, className);
> + test_validate(rc, SA_AIS_ERR_NOT_EXIST);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> --
> 2.7.4




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


Re: [devel] [PATCH 1/3] imm: add new test cases of API saImmOmClassCreate_2() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack with minor comments.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Friday, November 2, 2018 2:08 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 1/3] imm: add new test cases of API
> saImmOmClassCreate_2() of apitest [#2951]
> 
> ---
>  .../apitest/management/test_saImmOmClassCreate_2.c | 85
> ++
>  1 file changed, 85 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> index 4f25f8b..9afbbe7 100644
> --- a/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> +++ b/src/imm/apitest/management/test_saImmOmClassCreate_2.c
> @@ -426,6 +426,80 @@ void saImmOmClassCreate_2_19(void)
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> 
> +void saImmOmClassCreate_2_20(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = immutil_saImmOmClassCreate_2(-1, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> +
> +void saImmOmClassCreate_2_21(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmClassCreate_2_22(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {
> + "rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_RUNTIME | SA_IMM_ATTR_RDN |
> SA_IMM_ATTR_CACHED, NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_RUNTIME,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmClassCreate_2_23(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {"rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_CONFIG |
> SA_IMM_ATTR_RDN,
> + NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_CONFIG,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmClassCreate_2_24(void)
> +{
> + const SaImmClassNameT className = (SaImmClassNameT)
> __FUNCTION__;
> + SaImmAttrDefinitionT_2 attr1 = {
> + "rdn", SA_IMM_ATTR_SANAMET,
> + SA_IMM_ATTR_RUNTIME | SA_IMM_ATTR_RDN |
> SA_IMM_ATTR_CACHED, NULL};
> + const SaImmAttrDefinitionT_2 *attrDefinitions[] = {, NULL};
> +
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = immutil_saImmOmClassCreate_2(immOmHandle, className,
> SA_IMM_CLASS_RUNTIME,
> +   attrDefinitions);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
>  /*
>Verify it is not allowed to create IMM object class with reserved name.
>NOTE: As the list of reserved class names is read from the environment
> @@ -1497,6 +1571,17 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   2, saImmOmClassCreate_2_19,
>   "saImmOmClassCreate_2 - SA_AIS_OK, Create a class that has
> STRONG_DEFAULT flag without having default value");
> + test_case_add(2, saImmOmClassCreate_2_20,
> +   "saImmOmClassCreate_2 - SA_AIS_ERR_BAD_HANDLE
> CONFIG CLASS");
[Vu] Use lowercase for test slogans to align with existing ones and the
slogan for this test case seems not relevant. A suggestion "create config
class with invalid handle".

> + test_case_add(2, saImmOmClassCreate_2_21,
> +  

Re: [devel] [PATCH 2/3] imm: add new test case of API saImmOmDispatch() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack for this patch with a minor comment. Thanks.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Thursday, November 1, 2018 3:28 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 2/3] imm: add new test case of API saImmOmDispatch() of
> apitest [#2951]
> 
> ---
>  src/imm/apitest/management/test_saImmOmDispatch.c  | 72
> ++
>  .../apitest/management/test_saImmOmInitialize.c| 35 +++
>  2 files changed, 107 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmDispatch.c
> b/src/imm/apitest/management/test_saImmOmDispatch.c
> index 3648a95..0ab9885 100644
> --- a/src/imm/apitest/management/test_saImmOmDispatch.c
> +++ b/src/imm/apitest/management/test_saImmOmDispatch.c
> @@ -52,3 +52,75 @@ void saImmOmDispatch_04(void)
>   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> +
> +void saImmOmDispatch_05(void)
> +{
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_ONE);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmDispatch_06(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_ONE);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmDispatch_07(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_BLOCKING);
> + test_validate(rc, SA_AIS_OK);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> +
> +void saImmOmDispatch_08(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = saImmOmDispatch(-1, SA_DISPATCH_ALL);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> +
> +void saImmOmDispatch_09(void)
> +{
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_ALL);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmDispatch_10(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_ALL);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmDispatch_11(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = saImmOmDispatch(-1, SA_DISPATCH_BLOCKING);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> + safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
> +}
> +
> +void saImmOmDispatch_12(void)
> +{
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_BLOCKING);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmDispatch_13(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = saImmOmDispatch(immOmHandle, SA_DISPATCH_BLOCKING);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> diff --git a/src/imm/apitest/management/test_saImmOmInitialize.c
> b/src/imm/apitest/management/test_saImmOmInitialize.c
> index 2dca5da..b17ab86 100644
> --- a/src/imm/apitest/management/test_saImmOmInitialize.c
> +++ b/src/imm/apitest/management/test_saImmOmInitialize.c
> @@ -309,6 +309,15 @@ extern void saImmOmDispatch_01(void);
>  extern void saImmOmDispatch_02(void);
>  extern void saImmOmDispatch_03(void);
>  extern void saImmOmDispatch_04(void);
> +extern void saImmOmDispatch_05(void);
> +extern void saImmOmDispatch_06(void);
> +extern void saImmOmDispatch_07(void);
> +extern void saImmOmDispatch_08(void);
> +extern void saImmOmDispatch_09(void);
> +extern void saImmOmDispatch_10(void);
> +extern void saImmOmDispatch_11(void);
> +extern void saImmOmDispatch_12(void);
> +extern void saImmOmDispatch_13(void);
>  extern void saImmOmFinalize_01(void);
>  extern void saImmOmFinalize_02(void);
>  extern void saImmOmThreadInterference_01(void);
> @@ -369,6 +378,32 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   1, saImmOmDispatch_04,
>   "saImmOmDispatch - SA_AIS_ERR_INVALID_PARAM - invalid
> dispatchFlags");
> + test_case_add(
> + 1, saImmOmDispatch_05,
> + "saImmOmDispatch - SA_AIS_ERR_BAD_HANDLE - uninitilized
> handle SA_DISPATCH_ONE");
[Vu] Typo uninitilized? Also check it in following printouts.
> + test_case_add(
> + 1, saImmOmDispatch_06,
> + "saImmOmDispatch - SA_AIS_ERR_BAD_HANDLE - finalized handle
> SA_DISPATCH_ONE");
> + test_case_add(1, saImmOmDispatch_07,
> +   "saImmOmDispatch - SA_AIS_OK
> SA_DISPATCH_BLOCKING");
> + test_case_add(
> +   

Re: [devel] [PATCH 1/3] imm: add new test cases of API saImmOmSelectionObjectGet() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack for this patch with a minor comment.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Thursday, November 1, 2018 3:28 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 1/3] imm: add new test cases of API
> saImmOmSelectionObjectGet() of apitest [#2951]
> 
> ---
>  src/imm/apitest/management/test_saImmOmInitialize.c   |  8 
>  .../apitest/management/test_saImmOmSelectionObjectGet.c   | 15
> +++
>  2 files changed, 23 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmInitialize.c
> b/src/imm/apitest/management/test_saImmOmInitialize.c
> index 9dcfe7a..2dca5da 100644
> --- a/src/imm/apitest/management/test_saImmOmInitialize.c
> +++ b/src/imm/apitest/management/test_saImmOmInitialize.c
> @@ -303,6 +303,8 @@ void saImmOmInitialize_11(void)
> 
>  extern void saImmOmSelectionObjectGet_01(void);
>  extern void saImmOmSelectionObjectGet_02(void);
> +extern void saImmOmSelectionObjectGet_03(void);
> +extern void saImmOmSelectionObjectGet_04(void);
>  extern void saImmOmDispatch_01(void);
>  extern void saImmOmDispatch_02(void);
>  extern void saImmOmDispatch_03(void);
> @@ -350,6 +352,12 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   1, saImmOmSelectionObjectGet_02,
>   "saImmOmSelectionObjectGet - SA_AIS_ERR_BAD_HANDLE - invalid
> handle");
> + test_case_add(
> + 1, saImmOmSelectionObjectGet_03,
> + "saImmOmSelectionObjectGet - SA_AIS_ERR_BAD_HANDLE -
> uninitlized handle");
[Vu] Typo "uninitlized" ?

> + test_case_add(
> + 1, saImmOmSelectionObjectGet_04,
> + "saImmOmSelectionObjectGet - SA_AIS_ERR_BAD_HANDLE -
> finalized handle");
> 
>   test_case_add(1, saImmOmDispatch_01,
> "saImmOmDispatch - SA_AIS_OK SA_DISPATCH_ALL");
> diff --git
> a/src/imm/apitest/management/test_saImmOmSelectionObjectGet.c
> b/src/imm/apitest/management/test_saImmOmSelectionObjectGet.c
> index 017fd70..75b8b86 100644
> --- a/src/imm/apitest/management/test_saImmOmSelectionObjectGet.c
> +++ b/src/imm/apitest/management/test_saImmOmSelectionObjectGet.c
> @@ -35,3 +35,18 @@ void saImmOmSelectionObjectGet_02(void)
>   test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> +
> +void saImmOmSelectionObjectGet_03(void)
> +{
> + rc = immutil_saImmOmSelectionObjectGet(immOmHandle,
> );
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmSelectionObjectGet_04(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + immutil_saImmOmFinalize(immOmHandle);
> + rc = immutil_saImmOmSelectionObjectGet(immOmHandle,
> );
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> --
> 2.7.4




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


Re: [devel] [PATCH 3/3] imm: add new test case of API saImmOmFinalize() of apitest [#2951]

2018-11-28 Thread Vu Minh Nguyen
Hi Mohan,

Ack for this patch. 

Thanks.

Regards, Vu

> -Original Message-
> From: Mohan Kanakam 
> Sent: Thursday, November 1, 2018 3:28 PM
> To: vu.m.ngu...@dektech.com.au; hans.nordeb...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net; Mohan Kanakam
> 
> Subject: [PATCH 3/3] imm: add new test case of API saImmOmFinalize() of
> apitest [#2951]
> 
> ---
>  src/imm/apitest/management/test_saImmOmFinalize.c   | 15
> +++
>  src/imm/apitest/management/test_saImmOmInitialize.c |  8 
>  2 files changed, 23 insertions(+)
> 
> diff --git a/src/imm/apitest/management/test_saImmOmFinalize.c
> b/src/imm/apitest/management/test_saImmOmFinalize.c
> index 1c60657..02238a8 100644
> --- a/src/imm/apitest/management/test_saImmOmFinalize.c
> +++ b/src/imm/apitest/management/test_saImmOmFinalize.c
> @@ -33,3 +33,18 @@ void saImmOmFinalize_02(void)
>   test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
>   safassert(immutil_saImmOmFinalize(immOmHandle), SA_AIS_OK);
>  }
> +
> +void saImmOmFinalize_03(void)
> +{
> + safassert(immutil_saImmOmInitialize(,
> , ),
> +   SA_AIS_OK);
> + rc = immutil_saImmOmFinalize(immOmHandle);
> + rc = immutil_saImmOmFinalize(immOmHandle);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> +
> +void saImmOmFinalize_04(void)
> +{
> + rc = immutil_saImmOmFinalize(immOmHandle);
> + test_validate(rc, SA_AIS_ERR_BAD_HANDLE);
> +}
> diff --git a/src/imm/apitest/management/test_saImmOmInitialize.c
> b/src/imm/apitest/management/test_saImmOmInitialize.c
> index b17ab86..84b6cf2 100644
> --- a/src/imm/apitest/management/test_saImmOmInitialize.c
> +++ b/src/imm/apitest/management/test_saImmOmInitialize.c
> @@ -320,6 +320,8 @@ extern void saImmOmDispatch_12(void);
>  extern void saImmOmDispatch_13(void);
>  extern void saImmOmFinalize_01(void);
>  extern void saImmOmFinalize_02(void);
> +extern void saImmOmFinalize_03(void);
> +extern void saImmOmFinalize_04(void);
>  extern void saImmOmThreadInterference_01(void);
> 
>  __attribute__((constructor)) static void
saImmOmInitialize_constructor(void)
> @@ -409,6 +411,12 @@ __attribute__((constructor)) static void
> saImmOmInitialize_constructor(void)
>   test_case_add(
>   1, saImmOmFinalize_02,
>   "saImmOmFinalize - SA_AIS_ERR_BAD_HANDLE - invalid handle");
> + test_case_add(
> + 1, saImmOmFinalize_03,
> + "saImmOmFinalize - SA_AIS_ERR_BAD_HANDLE - finalized handle");
> + test_case_add(
> + 1, saImmOmFinalize_04,
> + "saImmOmFinalize - SA_AIS_ERR_BAD_HANDLE - uninitlized
> handle");
> 
>   test_case_add(
>   1, saImmOmThreadInterference_01,
> --
> 2.7.4




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


[devel] [PATCH 1/1] imm: fix introduceMsg resent in every 0.1 second [#2959]

2018-11-13 Thread Vu Minh Nguyen
It is expected that resending introduceMsg should happen every 05 seconds
if the previous send has not yet received the response e.g because of having
network issue or having the active IMMD unresponsive. However, in some cases,
the re-send is done every 0.1 second.

This patch adds a few code to make the logic work as expectation.
---
 src/imm/immnd/immnd_proc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/imm/immnd/immnd_proc.c b/src/imm/immnd/immnd_proc.c
index b03063882..62547ead2 100644
--- a/src/imm/immnd/immnd_proc.c
+++ b/src/imm/immnd/immnd_proc.c
@@ -2024,6 +2024,7 @@ uint32_t immnd_proc_server(uint32_t *timeout)
struct timespec jobDurationTs;
osaf_timespec_subtract(, >mJobStart, );
SaUint32T jobDurationSec = (SaUint32T)jobDurationTs.tv_sec;
+   static SaUint32T prev_jobduration = 0;
bool pbeImmndDeadlock = false;
if (!jobDurationSec) {
++jobDurationSec;
@@ -2050,6 +2051,7 @@ uint32_t immnd_proc_server(uint32_t *timeout)
switch (cb->mState) {
case IMM_SERVER_ANONYMOUS: /*send introduceMe msg. */
/*TRACE_5("IMM_SERVER_ANONYMOUS");*/
+   prev_jobduration = jobDurationSec;
if (immnd_introduceMe(cb) == NCSCC_RC_SUCCESS) {
cb->mStep = 0;
cb->mJobStart = now;
@@ -2108,11 +2110,12 @@ uint32_t immnd_proc_server(uint32_t *timeout)
immnd_forkLoader(cb, true);
}
} else if (!(jobDurationSec %
-5)) { /* Every 5 seconds */
+5) && (jobDurationSec != 
prev_jobduration)) { /* Every 5 seconds */
LOG_WA(
"Resending introduce-me - problems with MDS 
? %f",
osaf_timespec_to_double());
immnd_introduceMe(cb);
+   prev_jobduration = jobDurationSec;
}
 
if (cb->preLoadPid > 0) {
-- 
2.18.0



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


[devel] [PATCH 0/1] Review Request for imm: fix introduceMsg resent in every 0.1 second [#2959]

2018-11-13 Thread Vu Minh Nguyen
Summary: imm: fix introduceMsg resent in every 0.1 second [#2959]
Review request for Ticket(s): 2959
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2959
Base revision: 5bb2174a323a97f626ce354d553a1dc4d1673899
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision ae7c71cf5621e78fbeffece3b65184d5829938ac
Author: Vu Minh Nguyen 
Date:   Tue, 13 Nov 2018 17:50:18 +0700

imm: fix introduceMsg resent in every 0.1 second [#2959]

It is expected that resending introduceMsg should happen every 05 seconds
if the previous send has not yet received the response e.g because of having
network issue or having the active IMMD unresponsive. However, in some cases,
the re-send is done every 0.1 second.

This patch adds a few code to make the logic work as expectation.



Complete diffstat:
--
 src/imm/immnd/immnd_proc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)


Testing Commands:
-
1) Stop active IMMD for a while
pkill -STOP osafimmd
2) Kill an osafimmnd on PL-3
pkill osafimmnd

Then observe the syslog of PL-3

Testing, Expected Results:
--
IntroduceMsg is resent every 05 seconds.


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 0/1] Review Request for smf: add retry machanism to adminop utils [#2956]

2018-11-06 Thread Vu Minh Nguyen
Summary: smf: add retry machanism to adminop utils [#2956]
Review request for Ticket(s): 2956
Peer Reviewer(s): Lennart
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2956
Base revision: f8a6848a1cdbff0b518c3db951e4689e260226c7
Personal repository: git://git.code.sf.net/u/winhvu/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 16722697b993da76fb4212105bd1b9b7cc35424c
Author: Vu Minh Nguyen 
Date:   Tue, 6 Nov 2018 17:42:59 +0700

smf: add retry machanism to adminop utils [#2956]

Execution of the campaign will get failed if getting timeout
during performing admin operation.

This ticket adds some retries in such case or in case of getting
SA_AIS_ERR_BAD_HANDLE.



Complete diffstat:
--
 src/smf/smfd/SmfUtils.cc | 12 
 1 file changed, 12 insertions(+)


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


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


Conditions of Submission:
-
Ack from peer reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] smf: add retry machanism to adminop utils [#2956]

2018-11-06 Thread Vu Minh Nguyen
Execution of the campaign will get failed if getting timeout
during performing admin operation.

This ticket adds some retries in such case or in case of getting
SA_AIS_ERR_BAD_HANDLE.
---
 src/smf/smfd/SmfUtils.cc | 12 
 1 file changed, 12 insertions(+)

diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc
index c2931c84b..b777d2d3c 100644
--- a/src/smf/smfd/SmfUtils.cc
+++ b/src/smf/smfd/SmfUtils.cc
@@ -254,14 +254,17 @@ bool SmfImmUtils::initialize(void) {
 bool SmfImmUtils::finalize(void) {
   if (m_ownerHandle != 0) {
 (void)immutil_saImmOmAdminOwnerFinalize(m_ownerHandle);
+m_ownerHandle = 0;
   }
 
   if (m_accessorHandle != 0) {
 (void)immutil_saImmOmAccessorFinalize(m_accessorHandle);
+m_accessorHandle = 0;
   }
 
   if (m_omHandle != 0) {
 (void)immutil_saImmOmFinalize(m_omHandle);
+m_omHandle = 0;
   }
 
   return true;
@@ -584,6 +587,7 @@ SaAisErrorT SmfImmUtils::callAdminOperation(
 TRACE("contains NO parameters");
   }
 
+retry_admop:
   rc = immutil_saImmOmAdminOwnerSet(m_ownerHandle, objectNames, SA_IMM_ONE);
   if (rc != SA_AIS_OK) {
 LOG_NO("Fail to set admin owner, rc=%s, dn=[%s]", saf_error(rc),
@@ -606,6 +610,14 @@ SaAisErrorT SmfImmUtils::callAdminOperation(
 retry--;
   }
 
+  // Handle recovery and retry the admin operation.
+  if (retry && (rc == SA_AIS_ERR_TIMEOUT || rc == SA_AIS_ERR_BAD_HANDLE)) {
+finalize();
+initialize();
+sleep(2);
+goto retry_admop;
+  }
+
   if (retry <= 0) {
 LOG_NO(
 "Fail to invoke admin operation, too many SA_AIS_ERR_TRY_AGAIN, giving 
up. dn=[%s], opId=[%u]",
-- 
2.18.0



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


[devel] [PATCH 1/1] imm: fix osafimmnd coredump genereted during sanity test [#2947]

2018-10-29 Thread Vu Minh Nguyen
The coredump is generated in the context of processing the message type
"IMMND_EVT_D2ND_IMPLDELETE" because the memory is corrupted at the time
of decoding that message.

It allocated 'size' bytes of memory with the boundary in range [0 - 'size - 1'],
but modified - added null terminated, the memory at the index of `size` which
was out of that range.

This patch fixes such issue. The memory should be allocated with `size + 1`
bytes in length.
---
 src/imm/common/immsv_evt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/imm/common/immsv_evt.c b/src/imm/common/immsv_evt.c
index 03a7f8125..c93f82a0f 100644
--- a/src/imm/common/immsv_evt.c
+++ b/src/imm/common/immsv_evt.c
@@ -2898,7 +2898,7 @@ static uint32_t immsv_evt_dec_sublevels(NCS_UBAID *i_ub, 
IMMSV_EVT *o_evt)
implNameList[i].size = ncs_decode_32bit();
ncs_dec_skip_space(i_ub, 4);
 
-   implNameList[i].buf = (char 
*)malloc(implNameList[i].size);
+   implNameList[i].buf = (char 
*)malloc(implNameList[i].size + 1);
if (implNameList[i].buf == NULL ||

ncs_decode_n_octets_from_uba(i_ub,
(uint8_t 
*)implNameList[i].buf,
-- 
2.18.0



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


[devel] [PATCH 0/1] Review Request for imm: fix osafimmnd coredump genereted during sanity test [#2947]

2018-10-29 Thread Vu Minh Nguyen
Summary: imm: fix osafimmnd coredump genereted during sanity test [#2947]
Review request for Ticket(s): 2947
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2947
Base revision: 02110168c1b62505f6377fe223c7955417413ac9
Personal repository: git://git.code.sf.net/u/winhvu/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

NOTE: Patch(es) contain lines longer than 80 characers

Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision eed9bb36e13f6c884fbee57e207d7591c5b5e72f
Author: Vu Minh Nguyen 
Date:   Mon, 29 Oct 2018 16:09:43 +0700

imm: fix osafimmnd coredump genereted during sanity test [#2947]

The coredump is generated in the context of processing the message type
"IMMND_EVT_D2ND_IMPLDELETE" because the memory is corrupted at the time
of decoding that message.

It allocated 'size' bytes of memory with the boundary in range [0 - 'size - 1'],
but modified - added null terminated, the memory at the index of `size` which
was out of that range.

This patch fixes such issue. The memory should be allocated with `size + 1`
bytes in length.



Complete diffstat:
--
 src/imm/common/immsv_evt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Testing Commands:
-
Kill the active osafamfd, but it is not easy to reproduce the issue.


Testing, Expected Results:
--
No coredump is generated.


Conditions of Submission:
-
Acks from peer reviewers.


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


Re: [devel] [PATCH 1/1] imm: fix coredump generated during roaming test [#2943]

2018-10-28 Thread Vu Minh Nguyen
Hi all,

Do you have any comment for this patch? Thanks.

Regards, Vu

> -Original Message-
> From: Vu Minh Nguyen 
> Sent: Tuesday, October 23, 2018 11:31 AM
> To: hans.nordeb...@ericsson.com; lennart.l...@ericsson.com;
> gary@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] imm: fix coredump generated during roaming test
> [#2943]
> 
> The fix of ticket [#2934] was not covered the roaming SC case.
> With roaming, IMMND veteran could run on system controller node type.
> 
> Instead of going to accept_node directly in previous fix, it should go to
> update_node_type.
> ---
>  src/imm/immd/immd_evt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/imm/immd/immd_evt.c b/src/imm/immd/immd_evt.c
> index 9cd82da64..a0f632b7e 100644
> --- a/src/imm/immd/immd_evt.c
> +++ b/src/imm/immd/immd_evt.c
> @@ -1814,7 +1814,7 @@ static uint32_t
> immd_evt_proc_immnd_intro(IMMD_CB *cb, IMMD_EVT *evt,
>  cb->ccb_id_count, msg-
> >ccb_id_count,
>  cb->impl_count,
msg->impl_count);
>   }
> - goto accept_node;
> + goto update_node_type;
>   }
> 
>   if (cb->fevsSendCount <
evt->info.ctrl_msg.fevs_count)
> {
> @@ -1887,6 +1887,7 @@ static uint32_t
> immd_evt_proc_immnd_intro(IMMD_CB *cb, IMMD_EVT *evt,
>   }
>   }
> 
> +update_node_type:
>   /* Determine type of node. */
>   if (sinfo->dest == cb->loc_immnd_dest) {
>   node_info->isOnController = true;
> --
> 2.18.0




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


[devel] [PATCH 0/1] Review Request for imm: fix coredump generated during roaming test [#2943]

2018-10-22 Thread Vu Minh Nguyen
Summary: imm: fix coredump generated during roaming test [#2943]
Review request for Ticket(s): 2943
Peer Reviewer(s): Lennart, Hans, Gary
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2943
Base revision: 3b80698770d599bc15b97119cbfd4098943d7643
Personal repository: git://git.code.sf.net/u/winhvu/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 c756ce4a0861176c58f9cc76bec3de2ac579b72f
Author: Vu Minh Nguyen 
Date:   Tue, 23 Oct 2018 10:31:16 +0700

imm: fix coredump generated during roaming test [#2943]

The fix of ticket [#2934] was not covered the roaming SC case.
With roaming, IMMND veteran could run on system controller node type.

Instead of going to accept_node directly in previous fix, it should go to
update_node_type.



Complete diffstat:
--
 src/imm/immd/immd_evt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


Testing Commands:
-
1) Bring up 10 SCs
2) Brutally stop both active and standby node


Testing, Expected Results:
--
No coredump is generated.


Conditions of Submission:
-
Acks from peer reviewers.


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

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

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

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



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


[devel] [PATCH 1/1] imm: fix coredump generated during roaming test [#2943]

2018-10-22 Thread Vu Minh Nguyen
The fix of ticket [#2934] was not covered the roaming SC case.
With roaming, IMMND veteran could run on system controller node type.

Instead of going to accept_node directly in previous fix, it should go to
update_node_type.
---
 src/imm/immd/immd_evt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/imm/immd/immd_evt.c b/src/imm/immd/immd_evt.c
index 9cd82da64..a0f632b7e 100644
--- a/src/imm/immd/immd_evt.c
+++ b/src/imm/immd/immd_evt.c
@@ -1814,7 +1814,7 @@ static uint32_t immd_evt_proc_immnd_intro(IMMD_CB *cb, 
IMMD_EVT *evt,
   cb->ccb_id_count, 
msg->ccb_id_count,
   cb->impl_count, msg->impl_count);
}
-   goto accept_node;
+   goto update_node_type;
}
 
if (cb->fevsSendCount < evt->info.ctrl_msg.fevs_count) {
@@ -1887,6 +1887,7 @@ static uint32_t immd_evt_proc_immnd_intro(IMMD_CB *cb, 
IMMD_EVT *evt,
}
}
 
+update_node_type:
/* Determine type of node. */
if (sinfo->dest == cb->loc_immnd_dest) {
node_info->isOnController = true;
-- 
2.18.0



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


  1   2   3   4   5   6   7   >