[devel] [PATCH 2 of 2] AMF: Update README for SC Absence feature [#2033]

2016-09-21 Thread Minh Hon Chau
 osaf/services/saf/amf/README_HEADLESS |  151 +
 1 files changed, 76 insertions(+), 75 deletions(-)


Rephrase Headless to SC absence, plus documentation for
admin continuation

diff --git a/osaf/services/saf/amf/README_HEADLESS 
b/osaf/services/saf/amf/README_SC_ABSENCE
rename from osaf/services/saf/amf/README_HEADLESS
rename to osaf/services/saf/amf/README_SC_ABSENCE
--- a/osaf/services/saf/amf/README_HEADLESS
+++ b/osaf/services/saf/amf/README_SC_ABSENCE
@@ -18,86 +18,87 @@
 GENERAL
 ---
 
-This is a description of how the AMF service handles being headless (SC down)
-and recovery (SC up).
+This is a description of how the AMF service suppports the SC absence feature 
+which allows payloads to remain running during the absence of both SCs, and 
+perform recovery after at least one SC comes back. 
 
 CONFIGURATION
 -
 
-AMF reads the "scAbsenceAllowed" attribute to determine if headless mode is
-enabled. A positive integer indicates the number of seconds AMF will tolerate
-being headless, and a zero value indicates the headless feature is disabled.
+AMF reads the "scAbsenceAllowed" attribute to determine if SC absence feature 
+is enabled. A positive integer indicates the number of seconds AMF will 
+tolerate the absence period of both SCs, and a zero value indicates this 
+feature is disabled.
 
-Normally, the AMF Node Director (amfnd) will restart a node if there is no 
active
-AMF Director (amfd). If headless support is enabled, the Node Director will 
-delay the restart for the duration specified in "scAbsenceAllowed". If a SC 
-recovers during the period, the restart is aborted.
+Normally, the AMF Node Director (amfnd) will restart a node if there is no 
+active AMF Director (amfd). If this feature is enabled, the Node Director will
+delay the restart for the duration specified in "scAbsenceAllowed". If a SC
+returns during the period, the restart is aborted.
 
 IMPLEMENTATION DETAILS
 --
 
-* Amfnd detects being headless:
-Upon receiving NCSMDS_DOWN event which indicates the last active SC has 
-gone, amfnd will not reboot the node and enter headless mode (if 
saAbsenceAllowed
-is configured)
+* Amfnd detects absence of SCs:
+Upon receiving NCSMDS_DOWN event which indicates the last active SC has gone,
+amfnd will not reboot the node and enters SC absence period (if 
+scAbsenceAllowed is configured)
 
-* Escalation and Recovery during headless:
-Restarts will work as normal, but failover or switchover will
-result in Node Failfast.
-
-The repair action will be initiated when a SC returns if
+* Escalation and Recovery during SC absence period:
+Restarts will work as normal, but failover or switchover will result in Node
+Failfast. The repair action will be initiated when a SC returns if 
 saAmfSGAutoRepair is enabled.
 
-* Amfnd detects SC comes back from headless:
-NCSMDS_UP is the event that amfnd uses to detect the presence of an active amfd
-after being headless.
+* Amfnd detects return of SCs:
+NCSMDS_UP is the event that amfnd uses to detect the presence of an active 
amfd.
 
 * New sync messages 
+New messages (state information messages) have been introduced to carry 
+assignments and states from all amfnd(s), which then are sent to amfd. State 
+information messages also contain component and SU restart counts. These new 
+counter values will be updated to IMM after recovery.The operation where 
+amfnd(s) sends state information messages and amfd processes these messages
+is known as a *sync* operation.
 
-New messages (state information messages) have been introduced to carry 
assignments and
-states from all amfnd(s), which then are sent to amfd.
+* Admin operation continuation
+If an admin operation on an AMF entity is still in progress when the cluster 
+loses both SCs, the operation will continue when a SC returns. In order to 
+resume the admin operation, AMF internal states that are used in the admin 
+operation need to be restored. In a normal cluster state, these states are
+*regularly* checkpointed to the standby AMFD so that the standby AMFD can 
+take over the active role if the active AMFD goes down. Using a similar 
+approach, new AMF runtime cached attributes are introduced to store the states 
+in IMM, as another method of restoring these states for the purpose of SC 
+absence recovery. The new attributes are:
+- osafAmfSISUFsmState:SUSI fsm state 
+- osafAmfSGFsmState:SG fsm state
+- osafAmfSGSuOperationList:SU operation list of SG
+- osafAmfSUSwitch:SU switch toggle.
 
-State information messages also contain component and SU restart counts. These
-new counter values will be updated to IMM after headless recovery.
-
-The operation where amfnd(s) sends state information messages and amfd 
processes
-these messages is known as a *sync* operation.
+Only 2N SG is currently supported for admin operation continuation.
 
 LIMITATIONS
 ---
 
-* Recovery actions are limited while headless.
-

[devel] [PATCH 1 of 2] AMF: Update PR doc for SC Absence feature [#2033]

2016-09-21 Thread Minh Hon Chau


Rephrase Headless to SC absence, plus documentation for
admin continuation

Link to document for review
https://sourceforge.net/p/opensaf/tickets/_discuss/thread/3f0beb7d/a191/attachment/OpenSAF_AMF_PR_2033.odt


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


[devel] [PATCH 0 of 2] Review Request for AMF: Update README for SC Absence feature [#2033]

2016-09-21 Thread Minh Hon Chau
Summary: AMF: Update README for SC Absence feature [#2033]
Review request for Trac Ticket(s): 2033
Peer Reviewer(s): AMF devs
Pull request to: <>
Affected branch(es): 5.1, default
Development branch: default


Impacted area   Impact y/n

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


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

changeset 486b3871b3a376e47c4f066ede4e4562c4d8c699
Author: minh-chau 
Date:   Thu, 22 Sep 2016 15:18:23 +1000

AMF: Update PR doc for SC Absence feature [#2033] Rephrase Headless to 
SC
absence, plus documentation for admin continuation

Link to document for review 
https://sourceforge.net/p/opensaf/tickets/_discu
ss/thread/3f0beb7d/a191/attachment/OpenSAF_AMF_PR_2033.odt

changeset 1dc6270fa071e864a55ee34c86ec155cb820ddde
Author: minh-chau 
Date:   Thu, 22 Sep 2016 15:18:23 +1000

AMF: Update README for SC Absence feature [#2033] Rephrase Headless to 
SC
absence, plus documentation for admin continuation


Complete diffstat:
--
 osaf/services/saf/amf/README_HEADLESS |  151 
+++---
 1 files changed, 76 insertions(+), 75 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 ack from reviewer


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

2016-09-21 Thread Vo Minh Hoang
Dear Mahesh,

The submitted patch correct the behavior of cpd_ckpt_db_entry_update()
function to be similar to cpd_sb_proc_ckpt_create() in handling node_info.
So both 2 cases have been considered.

Thank you and best regards,
Hoang

-Original Message-
From: A V Mahesh [mailto:mahesh.va...@oracle.com] 
Sent: Thursday, September 22, 2016 11:45 AM
To: Hoang Vo ; anders.wid...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1 of 1] cpd: coredump error while creating checkpoint
after previous creating got error [#2055]

Hi Hoang,

Please check below cases as well



uint32_t cpd_ckpt_db_entry_update(CPD_CB *cb,
MDS_DEST *cpnd_dest,
CPSV_ND2D_CKPT_CREATE *ckpt_create,
CPD_CKPT_INFO_NODE **o_ckpt_node,
CPD_CKPT_MAP_INFO **io_map_info)

uint32_t cpd_sb_proc_ckpt_create(CPD_CB *cb, CPD_MBCSV_MSG *msg)



-AVM


On 9/21/2016 4:05 PM, Hoang Vo wrote:
>   osaf/services/saf/cpsv/cpd/cpd_proc.c |  5 -
>   1 files changed, 0 insertions(+), 5 deletions(-)
>
>
> Problem:
> First creating time, cpd got error in creating immOm object and run to
error handling steps, this free node_info memory without removing it from
nsc_patricia_tree.
> Second creating time, cpd try to access node_info and got error.
>
> Solution:
> Do not free node_info memory here when this scope does not init it. Only
free mode_info in cpd_cpnd_info_node_delete function.
>
> diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
> b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> --- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
> +++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> @@ -383,11 +383,6 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
>   }
>   }
>   
> - if (node_info) {
> - m_MMGR_FREE_CPD_CPND_INFO_NODE(node_info);
> -
> - }
> -
>   TRACE_LEAVE();
>   return proc_rc;
>   



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


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

2016-09-21 Thread A V Mahesh
Hi Hoang,

Please check below cases as well



uint32_t cpd_ckpt_db_entry_update(CPD_CB *cb,
MDS_DEST *cpnd_dest,
CPSV_ND2D_CKPT_CREATE *ckpt_create,
CPD_CKPT_INFO_NODE **o_ckpt_node, 
CPD_CKPT_MAP_INFO **io_map_info)

uint32_t cpd_sb_proc_ckpt_create(CPD_CB *cb, CPD_MBCSV_MSG *msg)



-AVM


On 9/21/2016 4:05 PM, Hoang Vo wrote:
>   osaf/services/saf/cpsv/cpd/cpd_proc.c |  5 -
>   1 files changed, 0 insertions(+), 5 deletions(-)
>
>
> Problem:
> First creating time, cpd got error in creating immOm object and run to error 
> handling steps, this free node_info memory without removing it from 
> nsc_patricia_tree.
> Second creating time, cpd try to access node_info and got error.
>
> Solution:
> Do not free node_info memory here when this scope does not init it. Only free 
> mode_info in cpd_cpnd_info_node_delete function.
>
> diff --git a/osaf/services/saf/cpsv/cpd/cpd_proc.c 
> b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> --- a/osaf/services/saf/cpsv/cpd/cpd_proc.c
> +++ b/osaf/services/saf/cpsv/cpd/cpd_proc.c
> @@ -383,11 +383,6 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB
>   }
>   }
>   
> - if (node_info) {
> - m_MMGR_FREE_CPD_CPND_INFO_NODE(node_info);
> -
> - }
> -
>   TRACE_LEAVE();
>   return proc_rc;
>   


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


Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread A V Mahesh
Hi Vu,

Still we can convert this below  logic to a function which is use in 
multiple places

like log_stream_get_next_by_id()

===

/* Check existing streams */
 uint32_t count = 0, stream_id = 0, max = 0;
 uint32_t num = get_number_of_streams();
 max = get_max_number_of_streams();
 while (count < num && stream_id < max) {
   stream = log_stream_get_by_id(stream_id++);
   if (stream == nullptr) continue;

=

-AVM


On 9/21/2016 3:38 PM, Vu Minh Nguyen wrote:
>   osaf/services/saf/logsv/lgs/lgs_amf.cc|  34 ++-
>   osaf/services/saf/logsv/lgs/lgs_config.cc |  12 +++--
>   osaf/services/saf/logsv/lgs/lgs_evt.cc|  31 +-
>   osaf/services/saf/logsv/lgs/lgs_imm.cc|  63 
> +++---
>   osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  29 +
>   osaf/services/saf/logsv/lgs/lgs_stream.cc |  16 ++-
>   osaf/services/saf/logsv/lgs/lgs_stream.h  |   3 +-
>   7 files changed, 123 insertions(+), 65 deletions(-)
>
>
> The `number of streams` refers to total existing log streams in cluster.
> And `stream_array` is the database holding all existing log streams.
> When interating all log streams, logsv first started at the index `number of 
> streams`,
> if getting NULL, logsv considered that case as `no stream`. This is 
> absolutely wrong.
>
> This patch provides other way to iterate all log streams.
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc 
> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> @@ -26,13 +26,19 @@
>   
>   static void close_all_files() {
> log_stream_t *stream;
> -  int num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
> +
> +  num = get_number_of_streams();
> +  max = get_max_number_of_streams();
> +  // Iterate all existing log streams in cluster
> +  // the condition `stream_id < max` to avoid blocking
> +  while (count < num && stream_id < max) {
> +stream = log_stream_get_by_id(stream_id++);
> +if (stream == nullptr) continue;
> +
> +count++;
>   if (log_stream_file_close(stream) != 0)
> LOG_WA("Could not close file for stream %s", stream->name.c_str());
> -
> -stream = log_stream_get_by_id(--num);
> }
>   }
>   
> @@ -52,7 +58,7 @@ static void close_all_files() {
>   static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT 
> invocation) {
> log_stream_t *stream;
> SaAisErrorT error = SA_AIS_OK;
> -  int num;
> +  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
>   
> TRACE_ENTER2("HA ACTIVE request");
>   
> @@ -67,13 +73,17 @@ static SaAisErrorT amf_active_state_hand
>   
> /* check existing streams */
> num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  if (!stream)
> +  max = get_max_number_of_streams();
> +  while (count < num && stream_id < max) {
> +stream = log_stream_get_by_id(stream_id++);
> +if (stream == nullptr) continue;
> +
> +count++;
> +*stream->p_fd = -1; /* First Initialize fd */
> +  }
> +
> +  if (count == 0)
>   LOG_ER("No streams exist!");
> -  while (stream != NULL) {
> -*stream->p_fd = -1; /* First Initialize fd */
> -stream = log_stream_get_by_id(--num);
> -  }
>   
>   done:
> /* Update role independent of stream processing */
> diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc 
> b/osaf/services/saf/logsv/lgs/lgs_config.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_config.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
> @@ -458,7 +458,7 @@ int lgs_cfg_verify_root_dir(const std::s
> int rc = 0;
> log_stream_t *stream = NULL;
> size_t n = root_str_in.size();
> -  int num;
> +  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
>   
> if (n > PATH_MAX) {
>   LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
> @@ -471,16 +471,18 @@ int lgs_cfg_verify_root_dir(const std::s
>  * must not be larger than PATH_MAX.
>  */
> num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  max = get_max_number_of_streams();
> +  while (count < num && stream_id < max) {
> +stream = log_stream_get_by_id(stream_id++);
> +if (stream == nullptr) continue;
> +
> +count++;
>   if (lgs_is_valid_pathlength(stream->pathName, stream->fileName,
>   root_str_in) == false) {
> TRACE("The rootPath is invalid (%s)", root_str_in.c_str());
> rc = -1;
> goto done;
>   }
> -
> -stream = log_stream_get_by_id(--num);
> }
>   
> if (lgs_path_is_writeable_dir_h(root_str_in) == false) {
> diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.cc 
> b/osaf/services/saf/logsv/lgs/lgs_evt.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_evt.cc
> +++ 

Re: [devel] [PATCH 1 of 1] amf: handle csi attributes using long dn APIs in assignment messages [#1993]

2016-09-21 Thread Gary Lee
Hi Praveen

ack (review only) with some comments below.

On 8/9/16 7:07 pm, praveen.malv...@oracle.com wrote:
>   osaf/libs/common/amf/n2avamsg.c |   5 +-
>   osaf/services/saf/amf/amfd/csiattr.cc   |   1 +
>   osaf/services/saf/amf/amfd/util.cc  |  49 
> 
>   osaf/services/saf/amf/amfnd/comp.cc |   7 +--
>   osaf/services/saf/amf/amfnd/include/avnd_util.h |   2 +
>   osaf/services/saf/amf/amfnd/mds.cc  |   6 +++
>   osaf/services/saf/amf/amfnd/su.cc   |   2 +-
>   osaf/services/saf/amf/amfnd/util.cc |  27 +
>   8 files changed, 83 insertions(+), 16 deletions(-)
>
>
> Patch uses osaf_extended_name_alloc() APIs for manipulation of CSI attributes
> in SUSI and COMPCSI assignment messages.
>
> diff --git a/osaf/libs/common/amf/n2avamsg.c b/osaf/libs/common/amf/n2avamsg.c
> --- a/osaf/libs/common/amf/n2avamsg.c
> +++ b/osaf/libs/common/amf/n2avamsg.c
> @@ -358,7 +358,8 @@ uint32_t avsv_amf_cbk_copy(AVSV_AMF_CBK_
>   
> osaf_extended_name_alloc(osaf_extended_name_borrow(>param.csi_attr_change.csi_name),
>&(*o_dcbk)->param.csi_attr_change.csi_name);
>   /* memset avsv & amf csi attr lists */
> -memset(&(*o_dcbk)->param.csi_attr_change.attrs, 0, 
> sizeof(AVSV_CSI_ATTRS));
> + memset(&(*o_dcbk)->param.csi_attr_change.attrs, 0, 
> sizeof(AVSV_CSI_ATTRS));
> + memset(&(*o_dcbk)->param.csi_attr_change.csiAttr, 0, 
> sizeof(SaAmfCSIAttributeListT));
>   /* copy the avsv csi attr list */
>   if (scbk->param.csi_attr_change.attrs.number > 0) {
>   (*o_dcbk)->param.csi_attr_change.attrs.list =
> @@ -371,7 +372,7 @@ uint32_t avsv_amf_cbk_copy(AVSV_AMF_CBK_
>   memcpy((*o_dcbk)->param.csi_attr_change.attrs.list,
>   scbk->param.csi_attr_change.attrs.list,
>   sizeof(AVSV_ATTR_NAME_VAL) * 
> scbk->param.csi_attr_change.attrs.number);
> - for (i = 0; i < scbk->param.csi_set.attrs.number; i++) {
> + for (i = 0; i < 
> scbk->param.csi_attr_change.attrs.number; i++) {
>   
> osaf_extended_name_alloc(osaf_extended_name_borrow(>param.csi_attr_change.attrs.list[i].name),
>   
>  &(*o_dcbk)->param.csi_attr_change.attrs.list[i].name);
>   
> osaf_extended_name_alloc(osaf_extended_name_borrow(>param.csi_attr_change.attrs.list[i].value),
> diff --git a/osaf/services/saf/amf/amfd/csiattr.cc 
> b/osaf/services/saf/amf/amfd/csiattr.cc
> --- a/osaf/services/saf/amf/amfd/csiattr.cc
> +++ b/osaf/services/saf/amf/amfd/csiattr.cc
> @@ -577,6 +577,7 @@ static void csiattr_modify_apply(CcbUtil
>   
> osaf_extended_name_alloc(csi_attr_name.c_str(), >name_value.name);
>   csiattr->name_value.string_ptr = new 
> char[strlen(value)+1]();
>   memcpy(csiattr->name_value.string_ptr, 
> value, strlen(value)+1 );
> + 
> osaf_extended_name_alloc(csiattr->name_value.string_ptr, 
> >name_value.value);
>   } /* for  */
>   }
>   /* add the modified csiattr values to parent csi */
> diff --git a/osaf/services/saf/amf/amfd/util.cc 
> b/osaf/services/saf/amf/amfd/util.cc
> --- a/osaf/services/saf/amf/amfd/util.cc
> +++ b/osaf/services/saf/amf/amfd/util.cc
> @@ -660,11 +660,21 @@ static uint32_t avd_prep_csi_attr_info(A
>   /* Scan the list of attributes for the CSI and add it to the message */
>   while ((attr_ptr != nullptr) && (compcsi_info->attrs.number < 
> compcsi->csi->num_attributes)) {
>   memcpy(i_ptr, _ptr->name_value, 
> sizeof(AVSV_ATTR_NAME_VAL));
> + 
> osaf_extended_name_alloc(osaf_extended_name_borrow(_ptr->name_value.name),
> + _ptr->name);
> + 
> osaf_extended_name_alloc(osaf_extended_name_borrow(_ptr->name_value.value),
> + _ptr->value);
> + if (attr_ptr->name_value.string_ptr != nullptr) {
> + i_ptr->string_ptr = new 
> char[strlen(attr_ptr->name_value.string_ptr)+1];
> + memcpy(i_ptr->string_ptr, 
> attr_ptr->name_value.string_ptr,
> + 
> strlen(attr_ptr->name_value.string_ptr)+1);
> + } else {
> + i_ptr->string_ptr = nullptr;
> + }
>   compcsi_info->attrs.number++;
>   i_ptr = i_ptr + 1;
>   attr_ptr = attr_ptr->attr_next;
>   }
> -
>   TRACE_LEAVE();
>   return NCSCC_RC_SUCCESS;
>   }
> @@ -1684,6 +1694,7 @@ static 

Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread Vu Minh Nguyen
Hi Lennart,

Thanks for your comments.

Yesterday, I sent out the V2 patch as attached. 
Can you have a look to see it could cover your comments #1 and #3?

I will handle your comment #2 before pushing the code.

Regards, Vu

> -Original Message-
> From: Lennart Lund [mailto:lennart.l...@ericsson.com]
> Sent: Wednesday, September 21, 2016 9:49 PM
> To: Vu Minh Nguyen ;
> mahesh.va...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: RE: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
> 
> Hi Vu
> 
> I have a few comments. There are no comments inline.
> 
> 1)
> In several places the following (or almost the same)code can be found:
> 
>   uint32_t count = 0, stream_id = 0;
>   uint32_t num = get_number_of_streams();
>   stream = log_stream_get_by_id(stream_id);
>   while (count < num) {
> if (stream == nullptr) goto next;
> 
> count++;
> if (log_stream_file_close(stream) != 0)
>   LOG_WA("Could not close file for stream %s", stream->name.c_str());
> 
>  next:
> stream = log_stream_get_by_id(++stream_id);
>   }
> 
> The while loop could look like:
>

-
> --
> while (count < num) {
>   if (stream == nullptr) {
> stream = log_stream_get_by_id(stream_id);
> stream_id++;
> continue;
>   }
> 
>   count++;
>   if (log_stream_file_close(stream) != 0)
> LOG_WA("Could not close file for stream %s", stream->name.c_str());
> }
> 
> 2)
> Try to avoid more than one operation per code line. In this case separate
> increasing the stream_id and getting the stream pointer.
> 
> 3)
> Since this code (or almost the same) can be found in several places a
> common function could be created e.g. a function that could be used
> to iterate over all existing streams and return the stream pointers
> 
> Thanks
> Lennart
> 
> > -Original Message-
> > From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> > Sent: den 19 september 2016 11:08
> > To: Lennart Lund ; mahesh.va...@oracle.com
> > Cc: opensaf-devel@lists.sourceforge.net
> > Subject: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
> >
> >  osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
> >  osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
> >  osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
> >  osaf/services/saf/logsv/lgs/lgs_imm.cc|  70 ++-
> -
> > --
> >  osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
> >  osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
> >  6 files changed, 120 insertions(+), 51 deletions(-)
> >
> >
> > The `number of streams` refers to total existing log streams in cluster.
> > And `stream_array` is the database holding all existing log streams.
> > When interating all log streams, logsv first started at the index
`number of
> > streams`,
> > if getting NULL, logsv considered that case as `no stream`. This is
> absolutely
> > wrong.
> >
> > This patch provides other way to iterate all log streams.
> >
> > diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > @@ -26,13 +26,18 @@
> >
> >  static void close_all_files() {
> >log_stream_t *stream;
> > -  int num = get_number_of_streams();
> > -  stream = log_stream_get_by_id(--num);
> > -  while (stream != NULL) {
> > +  uint32_t count = 0, stream_id = 0;
> > +  uint32_t num = get_number_of_streams();
> > +  stream = log_stream_get_by_id(stream_id);
> > +  while (count < num) {
> > +if (stream == nullptr) goto next;
> > +
> > +count++;
> >  if (log_stream_file_close(stream) != 0)
> >LOG_WA("Could not close file for stream %s",
stream->name.c_str());
> >
> > -stream = log_stream_get_by_id(--num);
> > + next:
> > +stream = log_stream_get_by_id(++stream_id);
> >}
> >  }
> >
> > @@ -52,7 +57,8 @@ static void close_all_files() {
> >  static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT
> > invocation) {
> >log_stream_t *stream;
> >SaAisErrorT error = SA_AIS_OK;
> > -  int num;
> > +  uint32_t num;
> > +  uint32_t count = 0, stream_id = 0;
> >
> >TRACE_ENTER2("HA ACTIVE request");
> >
> > @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
> >
> >/* check existing streams */
> >num = get_number_of_streams();
> > -  stream = log_stream_get_by_id(--num);
> > +  stream = log_stream_get_by_id(stream_id);
> >if (!stream)
> >  LOG_ER("No streams exist!");
> > -  while (stream != NULL) {
> > +  while (count < num) {
> > +if (stream == nullptr) goto next;
> > +
> > +count++;
> >  *stream->p_fd = -1; /* First Initialize fd */
> > -stream = log_stream_get_by_id(--num);
> > +
> > + next:
> > +stream = log_stream_get_by_id(++stream_id);
> >}
> >
> >  done:
> > 

[devel] [PATCH 1 of 2] NTF: Update PR doc to uniformly use SC Absence [#1890]

2016-09-21 Thread Minh Hon Chau


Link to updated document for review
https://sourceforge.net/p/opensaf/tickets/_discuss/thread/74fb31a7/c923/attachment/OpenSAF_NTFSv_PR_1890.odt


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


[devel] [PATCH 2 of 2] NTF: Update README to uniformly use SC Absence [#1890]

2016-09-21 Thread Minh Hon Chau
 osaf/services/saf/ntfsv/README.HYDRA |  26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)


diff --git a/osaf/services/saf/ntfsv/README.HYDRA 
b/osaf/services/saf/ntfsv/README_SC_ABSENCE
rename from osaf/services/saf/ntfsv/README.HYDRA
rename to osaf/services/saf/ntfsv/README_SC_ABSENCE
--- a/osaf/services/saf/ntfsv/README.HYDRA
+++ b/osaf/services/saf/ntfsv/README_SC_ABSENCE
@@ -1,4 +1,4 @@
-SCs outage support in NTF
+SCs absence support in NTF
 ===
 https://sourceforge.net/p/opensaf/tickets/1180/
 
@@ -6,19 +6,19 @@ General
 ---
 
 As support of cloud deployment use case which both SCs possibly are brought 
down,
-the NTF service does not have to provide its full functionality during SCs 
outage
-but it must responsively maintain the interface toward NTF client. It's aimed 
to 
-make the NTF client not being aware of SCs outage, some APIs provided to 
client 
-are just temporarily unavailable. Finally, NTF functionality as well as all 
NTF 
-APIs can resume operationally after one of SCs comes up. This requires the NTF 
-client incorporates to implement retry mechanism, which has already been 
+the NTF service does not have to provide its full functionality during SC 
absence
+period but it must responsively maintain the interface toward NTF client. It's 
+aimed to make the NTF client not being aware of absence of SCs, some APIs 
provided
+to client are just temporarily unavailable. Finally, NTF functionality as well 
as
+all NTF APIs can resume operationally after one of SCs comes up. This requires 
the
+NTF client incorporates to implement retry mechanism, which has already been 
 documented in NTF Programmer Guide (4.5).
 
 Solution
 
 
 The proposed solution must have the following implementation:
-1. NTF Agent must return SA_AIS_ERR_TRY_AGAIN during SCs outage in most of 
APIs 
+1. NTF Agent must return SA_AIS_ERR_TRY_AGAIN during SCs absence period in 
most of APIs 
 required to communicate with NTF server.
 
 2. Once SC comes up (also known as NTF server is started), NTF Agent will 
silently
@@ -84,7 +84,7 @@ 7. saNtfNotificationReadNext
can be considered as the last notification successfully been read, from 
which 
NTF Agent can use to find the next notification that the client wishes. 
However,
this continuous read is not supported since notifications are not preserved 
-   after SC outage.
+   after SC absence period.
 
 8. saNtfNotificationReadFinalize
Return SA_AIS_ERR_TRY_AGAIN if NTF server is unavailable.
@@ -93,16 +93,16 @@ 8. saNtfNotificationReadFinalize
all invalid clients and return SA_AIS_OK if all operations succeed.

 9. saNtfDispatch
-   Once NTF Agent detects that the NTF Server is up after period of outage, 
NTF Agent
-   will send dummy callback to subscriber's mailbox to trigger saNtfDispatch 
call. From
-   saNtfDispatch, Agent silently registers all invalid clients and subscribe 
for 
+   Once NTF Agent detects that the NTF Server is up after absence period of 
SCs, NTF
+   Agent will send dummy callback to subscriber's mailbox to trigger 
saNtfDispatch call.
+   From saNtfDispatch, Agent silently registers all invalid clients and 
subscribe for
notification if the client is a subscriber.
 
 Non-affected APIs and explanations
 --
 The following APIs do not require communication with NTF server, also the 
information
 these APIs manipulate are cached locally in NTF Agent. Therefore they can be 
performed
-normally despite of NTF server state.
+normally regardless NTF server state.
  
 1. Notification allocation APIs for Producer
 2. Filter allocation APIs for Consumer

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


[devel] [PATCH 0 of 2] Review Request for NTF: Update documenation to uniformly use SC Absence [#1890]

2016-09-21 Thread Minh Hon Chau
Summary: NTF: Update documentation to uniformly use SC Absence [#1890]
Review request for Trac Ticket(s): 1890
Peer Reviewer(s): Mathi, Anders W, Lennart, Praveen
Pull request to: <>
Affected branch(es): 5.1, default
Development branch: default


Impacted area   Impact y/n

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


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

changeset 4774e94ecfc2545202bc8f58b53f60b89ed8d32a
Author: minh-chau 
Date:   Thu, 22 Sep 2016 09:49:18 +1000

NTF: Update PR doc to uniformly use SC Absence [#1890] Link to updated
document for review 
https://sourceforge.net/p/opensaf/tickets/_discuss/threa
d/74fb31a7/c923/attachment/OpenSAF_NTFSv_PR_1890.odt

changeset e3a4f69fbedab611a3399110907389554ad3b737
Author: minh-chau 
Date:   Thu, 22 Sep 2016 09:49:18 +1000

NTF: Update README to uniformly use SC Absence [#1890]


Complete diffstat:
--
 osaf/services/saf/ntfsv/README.HYDRA |  26 +-
 1 files changed, 13 insertions(+), 13 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 ack from reviewer


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread Lennart Lund
Hi Vu

I have a few comments. There are no comments inline.

1)
In several places the following (or almost the same)code can be found:

  uint32_t count = 0, stream_id = 0;
  uint32_t num = get_number_of_streams();
  stream = log_stream_get_by_id(stream_id);
  while (count < num) {
if (stream == nullptr) goto next;

count++;
if (log_stream_file_close(stream) != 0)
  LOG_WA("Could not close file for stream %s", stream->name.c_str());

 next:
stream = log_stream_get_by_id(++stream_id);
  }

The while loop could look like:
---
while (count < num) {
  if (stream == nullptr) {
stream = log_stream_get_by_id(stream_id);
stream_id++;
continue;
  }

  count++;
  if (log_stream_file_close(stream) != 0)
LOG_WA("Could not close file for stream %s", stream->name.c_str()); 
}

2)
Try to avoid more than one operation per code line. In this case separate 
increasing the stream_id and getting the stream pointer.

3)
Since this code (or almost the same) can be found in several places a common 
function could be created e.g. a function that could be used
to iterate over all existing streams and return the stream pointers

Thanks
Lennart

> -Original Message-
> From: Vu Minh Nguyen [mailto:vu.m.ngu...@dektech.com.au]
> Sent: den 19 september 2016 11:08
> To: Lennart Lund ; mahesh.va...@oracle.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
> 
>  osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
>  osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
>  osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
>  osaf/services/saf/logsv/lgs/lgs_imm.cc|  70 ++--
> --
>  osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
>  osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
>  6 files changed, 120 insertions(+), 51 deletions(-)
> 
> 
> The `number of streams` refers to total existing log streams in cluster.
> And `stream_array` is the database holding all existing log streams.
> When interating all log streams, logsv first started at the index `number of
> streams`,
> if getting NULL, logsv considered that case as `no stream`. This is absolutely
> wrong.
> 
> This patch provides other way to iterate all log streams.
> 
> diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> @@ -26,13 +26,18 @@
> 
>  static void close_all_files() {
>log_stream_t *stream;
> -  int num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  uint32_t count = 0, stream_id = 0;
> +  uint32_t num = get_number_of_streams();
> +  stream = log_stream_get_by_id(stream_id);
> +  while (count < num) {
> +if (stream == nullptr) goto next;
> +
> +count++;
>  if (log_stream_file_close(stream) != 0)
>LOG_WA("Could not close file for stream %s", stream->name.c_str());
> 
> -stream = log_stream_get_by_id(--num);
> + next:
> +stream = log_stream_get_by_id(++stream_id);
>}
>  }
> 
> @@ -52,7 +57,8 @@ static void close_all_files() {
>  static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT
> invocation) {
>log_stream_t *stream;
>SaAisErrorT error = SA_AIS_OK;
> -  int num;
> +  uint32_t num;
> +  uint32_t count = 0, stream_id = 0;
> 
>TRACE_ENTER2("HA ACTIVE request");
> 
> @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
> 
>/* check existing streams */
>num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> +  stream = log_stream_get_by_id(stream_id);
>if (!stream)
>  LOG_ER("No streams exist!");
> -  while (stream != NULL) {
> +  while (count < num) {
> +if (stream == nullptr) goto next;
> +
> +count++;
>  *stream->p_fd = -1; /* First Initialize fd */
> -stream = log_stream_get_by_id(--num);
> +
> + next:
> +stream = log_stream_get_by_id(++stream_id);
>}
> 
>  done:
> diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc
> b/osaf/services/saf/logsv/lgs/lgs_config.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_config.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
> @@ -458,7 +458,8 @@ int lgs_cfg_verify_root_dir(const std::s
>int rc = 0;
>log_stream_t *stream = NULL;
>size_t n = root_str_in.size();
> -  int num;
> +  uint32_t num;
> +  uint32_t count = 0, stream_id = 0;
> 
>if (n > PATH_MAX) {
>  LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
> @@ -471,8 +472,11 @@ int lgs_cfg_verify_root_dir(const std::s
> * must not be larger than PATH_MAX.
> */
>num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  stream = log_stream_get_by_id(stream_id);
> +  while (count < num) {
> +if 

[devel] [PATCH 1 of 1] dtm: Convert transport monitor script to a daemon [#2035]

2016-09-21 Thread Anders Widell
 configure.ac|  
  3 +-
 osaf/services/infrastructure/dtms/Makefile.am   |  
  3 +-
 osaf/services/infrastructure/dtms/scripts/Makefile.am   |  
  3 +-
 osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in |  
 82 ---
 osaf/services/infrastructure/dtms/scripts/osaf-transport.in |  
 22 +-
 osaf/services/infrastructure/dtms/transport/Makefile.am |  
 41 +++
 osaf/services/infrastructure/dtms/transport/main.cc |  
 52 
 osaf/services/infrastructure/dtms/transport/tests/Makefile.am   |  
 45 
 osaf/services/infrastructure/dtms/transport/tests/mock_logtrace.cc  |  
 34 +++
 osaf/services/infrastructure/dtms/transport/tests/mock_logtrace.h   |  
 23 ++
 osaf/services/infrastructure/dtms/transport/tests/mock_osaf_poll.cc |  
 26 ++
 osaf/services/infrastructure/dtms/transport/tests/mock_osaf_poll.h  |  
 38 +++
 osaf/services/infrastructure/dtms/transport/tests/transport_monitor_test.cc |  
109 ++
 osaf/services/infrastructure/dtms/transport/transport_monitor.cc|  
 95 
 osaf/services/infrastructure/dtms/transport/transport_monitor.h |  
 92 
 15 files changed, 571 insertions(+), 97 deletions(-)


Convert the osaf-transport-monitor shell script into a daemon called
osaftransportd. The functionality of this new daemon is (should be) exactly the
same as the functionality of the shell script that it replaces.

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -784,10 +784,11 @@ AC_CONFIG_FILES([
 osaf/services/infrastructure/Makefile
 osaf/services/infrastructure/dtms/Makefile
 osaf/services/infrastructure/dtms/dtm/Makefile
+osaf/services/infrastructure/dtms/transport/Makefile
+osaf/services/infrastructure/dtms/transport/tests/Makefile
 osaf/services/infrastructure/dtms/scripts/Makefile
 osaf/services/infrastructure/dtms/scripts/osaf-dtm
 osaf/services/infrastructure/dtms/scripts/osaf-transport
-osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor
 osaf/services/infrastructure/dtms/config/Makefile
 osaf/services/infrastructure/dtms/include/Makefile
 osaf/services/infrastructure/fm/Makefile
diff --git a/osaf/services/infrastructure/dtms/Makefile.am 
b/osaf/services/infrastructure/dtms/Makefile.am
--- a/osaf/services/infrastructure/dtms/Makefile.am
+++ b/osaf/services/infrastructure/dtms/Makefile.am
@@ -18,5 +18,4 @@ include $(top_srcdir)/Makefile.common
 
 MAINTAINERCLEANFILES = Makefile.in
 
-SUBDIRS =  config  dtm  include  scripts 
-
+SUBDIRS =  config  dtm  transport include  scripts
diff --git a/osaf/services/infrastructure/dtms/scripts/Makefile.am 
b/osaf/services/infrastructure/dtms/scripts/Makefile.am
--- a/osaf/services/infrastructure/dtms/scripts/Makefile.am
+++ b/osaf/services/infrastructure/dtms/scripts/Makefile.am
@@ -20,5 +20,4 @@ MAINTAINERCLEANFILES = Makefile.in
 
 nodist_pkgclccli_SCRIPTS = \
$(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-dtm \
-   
$(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-transport \
-
$(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor
+   $(top_builddir)/osaf/services/infrastructure/dtms/scripts/osaf-transport
diff --git 
a/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in 
b/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in
deleted file mode 100644
--- a/osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/sh
-#
-# (C) Copyright 2010 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): Oracle 
-#
-
-osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
-
-# Source LSB functions library
-. /lib/lsb/init-functions
-
-if [ ! -r $osafdirfile ]; then
-   logger -t $osafprog "can't read $osafdirfile, exiting."
-   exit 6
-else
-   . $osafdirfile
-   . $pkgsysconfdir/nid.conf
-fi
-
-if [ ! "$MDS_TRANSPORT" = "TIPC" ] ; then
-   osafprog="osafdtmd"
-
-   #Read the pid of dtmd.
-   count=0
-   while true
-   do
-   if [ $count -eq 15 ] ; then
-   logger -s -t $osafprog "dtmd failed to come up. "
-   

[devel] [PATCH 0 of 1] Review Request for dtm: Convert transport monitor script to a daemon [#2035]

2016-09-21 Thread Anders Widell
Summary: dtm: Convert transport monitor script to a daemon [#2035]
Review request for Trac Ticket(s): 2035
Peer Reviewer(s): Mahesh
Pull request to: 
Affected branch(es): default(5.2)
Development branch: default


Impacted area   Impact y/n

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


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

changeset c69a6955b2f5b137d4385a9d13187ca1ecdadad4
Author: Anders Widell 
Date:   Wed, 21 Sep 2016 15:37:09 +0200

dtm: Convert transport monitor script to a daemon [#2035]

Convert the osaf-transport-monitor shell script into a daemon called
osaftransportd. The functionality of this new daemon is (should be) 
exactly
the same as the functionality of the shell script that it replaces.


Complete diffstat:
--
 configure.ac|  
  3 ++-
 osaf/services/infrastructure/dtms/Makefile.am   |  
  3 +--
 osaf/services/infrastructure/dtms/scripts/Makefile.am   |  
  3 +--
 osaf/services/infrastructure/dtms/scripts/osaf-transport-monitor.in |  
 82 
--
 osaf/services/infrastructure/dtms/scripts/osaf-transport.in |  
 22 --
 osaf/services/infrastructure/dtms/transport/Makefile.am |  
 41 +
 osaf/services/infrastructure/dtms/transport/main.cc |  
 52 
 osaf/services/infrastructure/dtms/transport/tests/Makefile.am   |  
 45 +
 osaf/services/infrastructure/dtms/transport/tests/mock_logtrace.cc  |  
 34 ++
 osaf/services/infrastructure/dtms/transport/tests/mock_logtrace.h   |  
 23 +++
 osaf/services/infrastructure/dtms/transport/tests/mock_osaf_poll.cc |  
 26 ++
 osaf/services/infrastructure/dtms/transport/tests/mock_osaf_poll.h  |  
 38 ++
 osaf/services/infrastructure/dtms/transport/tests/transport_monitor_test.cc |  
109 
+
 osaf/services/infrastructure/dtms/transport/transport_monitor.cc|  
 95 
+++
 osaf/services/infrastructure/dtms/transport/transport_monitor.h |  
 92 

 15 files changed, 571 insertions(+), 97 deletions(-)


Testing Commands:
-
make check


Testing, Expected Results:
--
* No errors detected by the unit tests.
* MDS log rotation and dtm supervision should work as before.

Conditions of Submission:
-
Ack from reviewer(s)


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

___ You need to refactor 

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

2016-09-21 Thread Hoang Vo
Summary: cpd: coredump error while creating checkpoint after previous creating 
got error [#2055]
Review request for Trac Ticket(s): 2055
Peer Reviewer(s): mahesh.va...@oracle.com; anders.wid...@ericsson.com
Pull request to: mahesh.va...@oracle.com
Affected branch(es): default
Development branch: default


Impacted area   Impact y/n

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


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

changeset 5a008720463c765a471af1d435d7fa57937251f8
Author: Hoang Vo 
Date:   Wed, 21 Sep 2016 17:29:57 +0700

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

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

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


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


Testing Commands:
-
Run all osaftests test cases for ckpt

Testing, Expected Results:
--
All test cases passed

Conditions of Submission:
-
ACK from maintainer

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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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

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


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

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

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

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


[devel] [PATCH 0 of 1] Review Request for log: fix ER no stream exists in syslog [#2043] V2

2016-09-21 Thread Vu Minh Nguyen
Summary: log: fix ER no stream exists in syslog [#2043] V2
Review request for Trac Ticket(s): #2043
Peer Reviewer(s): Lennart, Mahesh
Pull request to: <>
Affected branch(es): 5.1, default
Development branch: default


Impacted area   Impact y/n

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


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

changeset 1ac54efe5c1f1634692bd88b3af88e1847362b08
Author: Vu Minh Nguyen 
Date:   Mon, 19 Sep 2016 14:15:58 +0700

log: fix ER no stream exists in syslog [#2043]

The `number of streams` refers to total existing log streams in 
cluster. And
`stream_array` is the database holding all existing log streams. When
interating all log streams, logsv first started at the index `number of
streams`, if getting NULL, logsv considered that case as `no stream`. 
This
is absolutely wrong.

This patch provides other way to iterate all log streams.


Complete diffstat:
--
 osaf/services/saf/logsv/lgs/lgs_amf.cc|  34 
++
 osaf/services/saf/logsv/lgs/lgs_config.cc |  12 +++-
 osaf/services/saf/logsv/lgs/lgs_evt.cc|  31 ---
 osaf/services/saf/logsv/lgs/lgs_imm.cc|  63 
---
 osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  29 +++--
 osaf/services/saf/logsv/lgs/lgs_stream.cc |  16 +---
 osaf/services/saf/logsv/lgs/lgs_stream.h  |   3 ++-
 7 files changed, 123 insertions(+), 65 deletions(-)


Testing Commands:
-
 <>


Testing, Expected Results:
--
 <>


Conditions of Submission:
-
 <>


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


--
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net

[devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread Vu Minh Nguyen
 osaf/services/saf/logsv/lgs/lgs_amf.cc|  34 ++-
 osaf/services/saf/logsv/lgs/lgs_config.cc |  12 +++--
 osaf/services/saf/logsv/lgs/lgs_evt.cc|  31 +-
 osaf/services/saf/logsv/lgs/lgs_imm.cc|  63 +++---
 osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  29 +
 osaf/services/saf/logsv/lgs/lgs_stream.cc |  16 ++-
 osaf/services/saf/logsv/lgs/lgs_stream.h  |   3 +-
 7 files changed, 123 insertions(+), 65 deletions(-)


The `number of streams` refers to total existing log streams in cluster.
And `stream_array` is the database holding all existing log streams.
When interating all log streams, logsv first started at the index `number of 
streams`,
if getting NULL, logsv considered that case as `no stream`. This is absolutely 
wrong.

This patch provides other way to iterate all log streams.

diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc 
b/osaf/services/saf/logsv/lgs/lgs_amf.cc
--- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
@@ -26,13 +26,19 @@
 
 static void close_all_files() {
   log_stream_t *stream;
-  int num = get_number_of_streams();
-  stream = log_stream_get_by_id(--num);
-  while (stream != NULL) {
+  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
+
+  num = get_number_of_streams();
+  max = get_max_number_of_streams();
+  // Iterate all existing log streams in cluster
+  // the condition `stream_id < max` to avoid blocking
+  while (count < num && stream_id < max) {
+stream = log_stream_get_by_id(stream_id++);
+if (stream == nullptr) continue;
+
+count++;
 if (log_stream_file_close(stream) != 0)
   LOG_WA("Could not close file for stream %s", stream->name.c_str());
-
-stream = log_stream_get_by_id(--num);
   }
 }
 
@@ -52,7 +58,7 @@ static void close_all_files() {
 static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT 
invocation) {
   log_stream_t *stream;
   SaAisErrorT error = SA_AIS_OK;
-  int num;
+  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
 
   TRACE_ENTER2("HA ACTIVE request");
 
@@ -67,13 +73,17 @@ static SaAisErrorT amf_active_state_hand
 
   /* check existing streams */
   num = get_number_of_streams();
-  stream = log_stream_get_by_id(--num);
-  if (!stream)
+  max = get_max_number_of_streams();
+  while (count < num && stream_id < max) {
+stream = log_stream_get_by_id(stream_id++);
+if (stream == nullptr) continue;
+
+count++;
+*stream->p_fd = -1; /* First Initialize fd */
+  }
+
+  if (count == 0)
 LOG_ER("No streams exist!");
-  while (stream != NULL) {
-*stream->p_fd = -1; /* First Initialize fd */
-stream = log_stream_get_by_id(--num);
-  }
 
 done:
   /* Update role independent of stream processing */
diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc 
b/osaf/services/saf/logsv/lgs/lgs_config.cc
--- a/osaf/services/saf/logsv/lgs/lgs_config.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
@@ -458,7 +458,7 @@ int lgs_cfg_verify_root_dir(const std::s
   int rc = 0;
   log_stream_t *stream = NULL;
   size_t n = root_str_in.size();
-  int num;
+  uint32_t count = 0, stream_id = 0, max = 0, num = 0;
 
   if (n > PATH_MAX) {
 LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
@@ -471,16 +471,18 @@ int lgs_cfg_verify_root_dir(const std::s
* must not be larger than PATH_MAX.
*/
   num = get_number_of_streams();
-  stream = log_stream_get_by_id(--num);
-  while (stream != NULL) {
+  max = get_max_number_of_streams();
+  while (count < num && stream_id < max) {
+stream = log_stream_get_by_id(stream_id++);
+if (stream == nullptr) continue;
+
+count++;
 if (lgs_is_valid_pathlength(stream->pathName, stream->fileName,
 root_str_in) == false) {
   TRACE("The rootPath is invalid (%s)", root_str_in.c_str());
   rc = -1;
   goto done;
 }
-
-stream = log_stream_get_by_id(--num);
   }
 
   if (lgs_path_is_writeable_dir_h(root_str_in) == false) {
diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.cc 
b/osaf/services/saf/logsv/lgs/lgs_evt.cc
--- a/osaf/services/saf/logsv/lgs/lgs_evt.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_evt.cc
@@ -532,14 +532,19 @@ static uint32_t proc_rda_cb_msg(lgsv_lgs
 lgs_process_lga_down_list();
 
 /* Check existing streams */
-int num = get_number_of_streams();
-stream = log_stream_get_by_id(--num);
-if (!stream)
+uint32_t count = 0, stream_id = 0, max = 0;
+uint32_t num = get_number_of_streams();
+max = get_max_number_of_streams();
+while (count < num && stream_id < max) {
+  stream = log_stream_get_by_id(stream_id++);
+  if (stream == nullptr) continue;
+
+  count++;
+  *stream->p_fd = -1; /* Initialize fd */
+}
+
+if (count == 0)
   LOG_ER("No streams exist!");
-while (stream != NULL) {
-  *stream->p_fd = -1; /* Initialize fd */
-  stream = log_stream_get_by_id(--num);
-}
   }
 
   TRACE_LEAVE();
@@ -800,7 +805,8 

Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread Vu Minh Nguyen
I will send the V2 patch soon.

Regards, Vu

> -Original Message-
> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
> Sent: Wednesday, September 21, 2016 4:13 PM
> To: Vu Minh Nguyen ;
> lennart.l...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
> 
> Hi VU,
> 
> Try**to have function **log_stream_get_next_by_id().
> 
> -AVM
> 
> On 9/21/2016 2:35 PM, Vu Minh Nguyen wrote:
> > Hi Mahesh,
> >
> > I do think about it but not yet found out the better way.
> > I can use the macro for this, somethings like
> > GET {
> > ..
> > } NEXT;
> >
> > but it will violate the coding rule - avoid using the macro.
> >
> > I would appreciate if you have any proposal for this. Thanks.
> >
> > Regards, Vu
> >
> >> -Original Message-
> >> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
> >> Sent: Wednesday, September 21, 2016 3:58 PM
> >> To: Vu Minh Nguyen ;
> >> lennart.l...@ericsson.com
> >> Cc: opensaf-devel@lists.sourceforge.net
> >> Subject: Re: [PATCH 1 of 1] log: fix ER no stream exists in syslog
[#2043]
> >>
> >> Hi Vu,
> >>
> >> You used this similar code logic  number of time in multiple file in
log
> >> service  code
> >>
> >> is it possibly to optimize this logic in single function , to make
> >> maintainability of code ,
> >>
> >> so that any bug fix will not trigger multiple places code changes
> >>
> >> 
> >>
> >> /* Verify that path and file are unique */
> >> num = get_number_of_streams();
> >> stream = log_stream_get_by_id(stream_id);
> >> while (count < num) {
> >>   if (stream == nullptr) goto next
> >>
> >>   
> >>
> >>  next:
> >> stream = log_stream_get_by_id(++stream_id);
> >>
> >> ===
> >>
> >> -AVM
> >>
> >>
> >> On 9/19/2016 2:38 PM, Vu Minh Nguyen wrote:
> >>>osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
> >>>osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
> >>>osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
> >>>osaf/services/saf/logsv/lgs/lgs_imm.cc|  70
> >> ++
> >>>osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
> >>>osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
> >>>6 files changed, 120 insertions(+), 51 deletions(-)
> >>>
> >>>
> >>> The `number of streams` refers to total existing log streams in
cluster.
> >>> And `stream_array` is the database holding all existing log streams.
> >>> When interating all log streams, logsv first started at the index
> > `number of
> >> streams`,
> >>> if getting NULL, logsv considered that case as `no stream`. This is
> >> absolutely wrong.
> >>> This patch provides other way to iterate all log streams.
> >>>
> >>> diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> >> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> >>> --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> >>> +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> >>> @@ -26,13 +26,18 @@
> >>>
> >>>static void close_all_files() {
> >>>  log_stream_t *stream;
> >>> -  int num = get_number_of_streams();
> >>> -  stream = log_stream_get_by_id(--num);
> >>> -  while (stream != NULL) {
> >>> +  uint32_t count = 0, stream_id = 0;
> >>> +  uint32_t num = get_number_of_streams();
> >>> +  stream = log_stream_get_by_id(stream_id);
> >>> +  while (count < num) {
> >>> +if (stream == nullptr) goto next;
> >>> +
> >>> +count++;
> >>>if (log_stream_file_close(stream) != 0)
> >>>  LOG_WA("Could not close file for stream %s",
> > stream->name.c_str());
> >>> -stream = log_stream_get_by_id(--num);
> >>> + next:
> >>> +stream = log_stream_get_by_id(++stream_id);
> >>>  }
> >>>}
> >>>
> >>> @@ -52,7 +57,8 @@ static void close_all_files() {
> >>>static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb,
> > SaInvocationT
> >> invocation) {
> >>>  log_stream_t *stream;
> >>>  SaAisErrorT error = SA_AIS_OK;
> >>> -  int num;
> >>> +  uint32_t num;
> >>> +  uint32_t count = 0, stream_id = 0;
> >>>
> >>>  TRACE_ENTER2("HA ACTIVE request");
> >>>
> >>> @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
> >>>
> >>>  /* check existing streams */
> >>>  num = get_number_of_streams();
> >>> -  stream = log_stream_get_by_id(--num);
> >>> +  stream = log_stream_get_by_id(stream_id);
> >>>  if (!stream)
> >>>LOG_ER("No streams exist!");
> >>> -  while (stream != NULL) {
> >>> +  while (count < num) {
> >>> +if (stream == nullptr) goto next;
> >>> +
> >>> +count++;
> >>>*stream->p_fd = -1; /* First Initialize fd */
> >>> -stream = log_stream_get_by_id(--num);
> >>> +
> >>> + next:
> >>> +stream = log_stream_get_by_id(++stream_id);
> >>>  }
> >>>
> >>>done:
> >>> diff --git 

Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread A V Mahesh
Hi VU,

Try**to have function **log_stream_get_next_by_id().

-AVM

On 9/21/2016 2:35 PM, Vu Minh Nguyen wrote:
> Hi Mahesh,
>
> I do think about it but not yet found out the better way.
> I can use the macro for this, somethings like
> GET {
> ..
> } NEXT;
>
> but it will violate the coding rule - avoid using the macro.
>
> I would appreciate if you have any proposal for this. Thanks.
>
> Regards, Vu
>
>> -Original Message-
>> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
>> Sent: Wednesday, September 21, 2016 3:58 PM
>> To: Vu Minh Nguyen ;
>> lennart.l...@ericsson.com
>> Cc: opensaf-devel@lists.sourceforge.net
>> Subject: Re: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
>>
>> Hi Vu,
>>
>> You used this similar code logic  number of time in multiple file in log
>> service  code
>>
>> is it possibly to optimize this logic in single function , to make
>> maintainability of code ,
>>
>> so that any bug fix will not trigger multiple places code changes
>>
>> 
>>
>> /* Verify that path and file are unique */
>> num = get_number_of_streams();
>> stream = log_stream_get_by_id(stream_id);
>> while (count < num) {
>>   if (stream == nullptr) goto next
>>
>>   
>>
>>  next:
>> stream = log_stream_get_by_id(++stream_id);
>>
>> ===
>>
>> -AVM
>>
>>
>> On 9/19/2016 2:38 PM, Vu Minh Nguyen wrote:
>>>osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
>>>osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
>>>osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
>>>osaf/services/saf/logsv/lgs/lgs_imm.cc|  70
>> ++
>>>osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
>>>osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
>>>6 files changed, 120 insertions(+), 51 deletions(-)
>>>
>>>
>>> The `number of streams` refers to total existing log streams in cluster.
>>> And `stream_array` is the database holding all existing log streams.
>>> When interating all log streams, logsv first started at the index
> `number of
>> streams`,
>>> if getting NULL, logsv considered that case as `no stream`. This is
>> absolutely wrong.
>>> This patch provides other way to iterate all log streams.
>>>
>>> diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc
>> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
>>> --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
>>> +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
>>> @@ -26,13 +26,18 @@
>>>
>>>static void close_all_files() {
>>>  log_stream_t *stream;
>>> -  int num = get_number_of_streams();
>>> -  stream = log_stream_get_by_id(--num);
>>> -  while (stream != NULL) {
>>> +  uint32_t count = 0, stream_id = 0;
>>> +  uint32_t num = get_number_of_streams();
>>> +  stream = log_stream_get_by_id(stream_id);
>>> +  while (count < num) {
>>> +if (stream == nullptr) goto next;
>>> +
>>> +count++;
>>>if (log_stream_file_close(stream) != 0)
>>>  LOG_WA("Could not close file for stream %s",
> stream->name.c_str());
>>> -stream = log_stream_get_by_id(--num);
>>> + next:
>>> +stream = log_stream_get_by_id(++stream_id);
>>>  }
>>>}
>>>
>>> @@ -52,7 +57,8 @@ static void close_all_files() {
>>>static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb,
> SaInvocationT
>> invocation) {
>>>  log_stream_t *stream;
>>>  SaAisErrorT error = SA_AIS_OK;
>>> -  int num;
>>> +  uint32_t num;
>>> +  uint32_t count = 0, stream_id = 0;
>>>
>>>  TRACE_ENTER2("HA ACTIVE request");
>>>
>>> @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
>>>
>>>  /* check existing streams */
>>>  num = get_number_of_streams();
>>> -  stream = log_stream_get_by_id(--num);
>>> +  stream = log_stream_get_by_id(stream_id);
>>>  if (!stream)
>>>LOG_ER("No streams exist!");
>>> -  while (stream != NULL) {
>>> +  while (count < num) {
>>> +if (stream == nullptr) goto next;
>>> +
>>> +count++;
>>>*stream->p_fd = -1; /* First Initialize fd */
>>> -stream = log_stream_get_by_id(--num);
>>> +
>>> + next:
>>> +stream = log_stream_get_by_id(++stream_id);
>>>  }
>>>
>>>done:
>>> diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc
>> b/osaf/services/saf/logsv/lgs/lgs_config.cc
>>> --- a/osaf/services/saf/logsv/lgs/lgs_config.cc
>>> +++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
>>> @@ -458,7 +458,8 @@ int lgs_cfg_verify_root_dir(const std::s
>>>  int rc = 0;
>>>  log_stream_t *stream = NULL;
>>>  size_t n = root_str_in.size();
>>> -  int num;
>>> +  uint32_t num;
>>> +  uint32_t count = 0, stream_id = 0;
>>>
>>>  if (n > PATH_MAX) {
>>>LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
>>> @@ -471,8 +472,11 @@ int lgs_cfg_verify_root_dir(const std::s
>>>   * must not be larger than PATH_MAX.
>>>   */
>>>  num = 

Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread Vu Minh Nguyen
Hi Mahesh,

I do think about it but not yet found out the better way.
I can use the macro for this, somethings like
GET {
..
} NEXT;

but it will violate the coding rule - avoid using the macro.

I would appreciate if you have any proposal for this. Thanks.

Regards, Vu

> -Original Message-
> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
> Sent: Wednesday, September 21, 2016 3:58 PM
> To: Vu Minh Nguyen ;
> lennart.l...@ericsson.com
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]
> 
> Hi Vu,
> 
> You used this similar code logic  number of time in multiple file in log
> service  code
> 
> is it possibly to optimize this logic in single function , to make
> maintainability of code ,
> 
> so that any bug fix will not trigger multiple places code changes
> 
> 
> 
> /* Verify that path and file are unique */
>num = get_number_of_streams();
>stream = log_stream_get_by_id(stream_id);
>while (count < num) {
>  if (stream == nullptr) goto next
> 
>  
> 
> next:
>stream = log_stream_get_by_id(++stream_id);
> 
> ===
> 
> -AVM
> 
> 
> On 9/19/2016 2:38 PM, Vu Minh Nguyen wrote:
> >   osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
> >   osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
> >   osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
> >   osaf/services/saf/logsv/lgs/lgs_imm.cc|  70
> ++
> >   osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
> >   osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
> >   6 files changed, 120 insertions(+), 51 deletions(-)
> >
> >
> > The `number of streams` refers to total existing log streams in cluster.
> > And `stream_array` is the database holding all existing log streams.
> > When interating all log streams, logsv first started at the index
`number of
> streams`,
> > if getting NULL, logsv considered that case as `no stream`. This is
> absolutely wrong.
> >
> > This patch provides other way to iterate all log streams.
> >
> > diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> > @@ -26,13 +26,18 @@
> >
> >   static void close_all_files() {
> > log_stream_t *stream;
> > -  int num = get_number_of_streams();
> > -  stream = log_stream_get_by_id(--num);
> > -  while (stream != NULL) {
> > +  uint32_t count = 0, stream_id = 0;
> > +  uint32_t num = get_number_of_streams();
> > +  stream = log_stream_get_by_id(stream_id);
> > +  while (count < num) {
> > +if (stream == nullptr) goto next;
> > +
> > +count++;
> >   if (log_stream_file_close(stream) != 0)
> > LOG_WA("Could not close file for stream %s",
stream->name.c_str());
> >
> > -stream = log_stream_get_by_id(--num);
> > + next:
> > +stream = log_stream_get_by_id(++stream_id);
> > }
> >   }
> >
> > @@ -52,7 +57,8 @@ static void close_all_files() {
> >   static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb,
SaInvocationT
> invocation) {
> > log_stream_t *stream;
> > SaAisErrorT error = SA_AIS_OK;
> > -  int num;
> > +  uint32_t num;
> > +  uint32_t count = 0, stream_id = 0;
> >
> > TRACE_ENTER2("HA ACTIVE request");
> >
> > @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
> >
> > /* check existing streams */
> > num = get_number_of_streams();
> > -  stream = log_stream_get_by_id(--num);
> > +  stream = log_stream_get_by_id(stream_id);
> > if (!stream)
> >   LOG_ER("No streams exist!");
> > -  while (stream != NULL) {
> > +  while (count < num) {
> > +if (stream == nullptr) goto next;
> > +
> > +count++;
> >   *stream->p_fd = -1; /* First Initialize fd */
> > -stream = log_stream_get_by_id(--num);
> > +
> > + next:
> > +stream = log_stream_get_by_id(++stream_id);
> > }
> >
> >   done:
> > diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc
> b/osaf/services/saf/logsv/lgs/lgs_config.cc
> > --- a/osaf/services/saf/logsv/lgs/lgs_config.cc
> > +++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
> > @@ -458,7 +458,8 @@ int lgs_cfg_verify_root_dir(const std::s
> > int rc = 0;
> > log_stream_t *stream = NULL;
> > size_t n = root_str_in.size();
> > -  int num;
> > +  uint32_t num;
> > +  uint32_t count = 0, stream_id = 0;
> >
> > if (n > PATH_MAX) {
> >   LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
> > @@ -471,8 +472,11 @@ int lgs_cfg_verify_root_dir(const std::s
> >  * must not be larger than PATH_MAX.
> >  */
> > num = get_number_of_streams();
> > -  stream = log_stream_get_by_id(--num);
> > -  while (stream != NULL) {
> > +  stream = log_stream_get_by_id(stream_id);
> > +  while (count < num) {
> > +if (stream == nullptr) goto 

Re: [devel] [PATCH 1 of 1] log: fix ER no stream exists in syslog [#2043]

2016-09-21 Thread A V Mahesh
Hi Vu,

You used this similar code logic  number of time in multiple file in log 
service  code

is it possibly to optimize this logic in single function , to make   
maintainability of code ,

so that any bug fix will not trigger multiple places code changes



/* Verify that path and file are unique */
   num = get_number_of_streams();
   stream = log_stream_get_by_id(stream_id);
   while (count < num) {
 if (stream == nullptr) goto next

 

next:
   stream = log_stream_get_by_id(++stream_id);

===

-AVM


On 9/19/2016 2:38 PM, Vu Minh Nguyen wrote:
>   osaf/services/saf/logsv/lgs/lgs_amf.cc|  27 ---
>   osaf/services/saf/logsv/lgs/lgs_config.cc |  13 +++-
>   osaf/services/saf/logsv/lgs/lgs_evt.cc|  28 ---
>   osaf/services/saf/logsv/lgs/lgs_imm.cc|  70 
> ++
>   osaf/services/saf/logsv/lgs/lgs_mbcsv.cc  |  27 ---
>   osaf/services/saf/logsv/lgs/lgs_stream.cc |   6 +-
>   6 files changed, 120 insertions(+), 51 deletions(-)
>
>
> The `number of streams` refers to total existing log streams in cluster.
> And `stream_array` is the database holding all existing log streams.
> When interating all log streams, logsv first started at the index `number of 
> streams`,
> if getting NULL, logsv considered that case as `no stream`. This is 
> absolutely wrong.
>
> This patch provides other way to iterate all log streams.
>
> diff --git a/osaf/services/saf/logsv/lgs/lgs_amf.cc 
> b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_amf.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_amf.cc
> @@ -26,13 +26,18 @@
>   
>   static void close_all_files() {
> log_stream_t *stream;
> -  int num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  uint32_t count = 0, stream_id = 0;
> +  uint32_t num = get_number_of_streams();
> +  stream = log_stream_get_by_id(stream_id);
> +  while (count < num) {
> +if (stream == nullptr) goto next;
> +
> +count++;
>   if (log_stream_file_close(stream) != 0)
> LOG_WA("Could not close file for stream %s", stream->name.c_str());
>   
> -stream = log_stream_get_by_id(--num);
> + next:
> +stream = log_stream_get_by_id(++stream_id);
> }
>   }
>   
> @@ -52,7 +57,8 @@ static void close_all_files() {
>   static SaAisErrorT amf_active_state_handler(lgs_cb_t *cb, SaInvocationT 
> invocation) {
> log_stream_t *stream;
> SaAisErrorT error = SA_AIS_OK;
> -  int num;
> +  uint32_t num;
> +  uint32_t count = 0, stream_id = 0;
>   
> TRACE_ENTER2("HA ACTIVE request");
>   
> @@ -67,12 +73,17 @@ static SaAisErrorT amf_active_state_hand
>   
> /* check existing streams */
> num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> +  stream = log_stream_get_by_id(stream_id);
> if (!stream)
>   LOG_ER("No streams exist!");
> -  while (stream != NULL) {
> +  while (count < num) {
> +if (stream == nullptr) goto next;
> +
> +count++;
>   *stream->p_fd = -1; /* First Initialize fd */
> -stream = log_stream_get_by_id(--num);
> +
> + next:
> +stream = log_stream_get_by_id(++stream_id);
> }
>   
>   done:
> diff --git a/osaf/services/saf/logsv/lgs/lgs_config.cc 
> b/osaf/services/saf/logsv/lgs/lgs_config.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_config.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_config.cc
> @@ -458,7 +458,8 @@ int lgs_cfg_verify_root_dir(const std::s
> int rc = 0;
> log_stream_t *stream = NULL;
> size_t n = root_str_in.size();
> -  int num;
> +  uint32_t num;
> +  uint32_t count = 0, stream_id = 0;
>   
> if (n > PATH_MAX) {
>   LOG_NO("verify_root_dir Fail. Path > PATH_MAX");
> @@ -471,8 +472,11 @@ int lgs_cfg_verify_root_dir(const std::s
>  * must not be larger than PATH_MAX.
>  */
> num = get_number_of_streams();
> -  stream = log_stream_get_by_id(--num);
> -  while (stream != NULL) {
> +  stream = log_stream_get_by_id(stream_id);
> +  while (count < num) {
> +if (stream == nullptr) goto next;
> +
> +count++;
>   if (lgs_is_valid_pathlength(stream->pathName, stream->fileName,
>   root_str_in) == false) {
> TRACE("The rootPath is invalid (%s)", root_str_in.c_str());
> @@ -480,7 +484,8 @@ int lgs_cfg_verify_root_dir(const std::s
> goto done;
>   }
>   
> -stream = log_stream_get_by_id(--num);
> + next:
> +stream = log_stream_get_by_id(++stream_id);
> }
>   
> if (lgs_path_is_writeable_dir_h(root_str_in) == false) {
> diff --git a/osaf/services/saf/logsv/lgs/lgs_evt.cc 
> b/osaf/services/saf/logsv/lgs/lgs_evt.cc
> --- a/osaf/services/saf/logsv/lgs/lgs_evt.cc
> +++ b/osaf/services/saf/logsv/lgs/lgs_evt.cc
> @@ -532,13 +532,19 @@ static uint32_t proc_rda_cb_msg(lgsv_lgs
>   lgs_process_lga_down_list();
>   
>   

[devel] [PATCH 0 of 1] Review Request for log: fix failure to create directory when changing logRootDirectory [#2054]

2016-09-21 Thread Vu Minh Nguyen
Summary: log: fix failure to create directory when changing logRootDirectory 
[#2054]
Review request for Trac Ticket(s): 2054
Peer Reviewer(s): Lennart, Mahesh
Pull request to: <>
Affected branch(es): all
Development branch: default


Impacted area   Impact y/n

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


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

changeset d997edf3838698445628142d8050719026092982
Author: Vu Minh Nguyen 
Date:   Wed, 21 Sep 2016 13:56:33 +0700

log: fix failure to create directory when changing logRootDirectory 
[#2054]

When changing `logRootDirectory`, the new directory was not updated to
global `lgs_conf.logRootDirectory`, therefore all refering to new 
directory
got the old value.

This patch adds code to make sure new directory updated. And one test 
case
#03 of suite #5 are added to verify this case.


Complete diffstat:
--
 osaf/services/saf/logsv/lgs/lgs_imm.cc |   3 +++
 tests/logsv/tet_LogOiOps.c |  82 
++
 2 files changed, 85 insertions(+), 0 deletions(-)


Testing Commands:
-
 Run added test case: logtest 5 3


Testing, Expected Results:
--
 The test PASS


Conditions of Submission:
-
 Get 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 ~/.hgrc file (i.e. username, email etc)

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

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

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


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


[devel] [PATCH 1 of 1] log: fix failure to create directory when changing logRootDirectory [#2054]

2016-09-21 Thread Vu Minh Nguyen
 osaf/services/saf/logsv/lgs/lgs_imm.cc |   3 +
 tests/logsv/tet_LogOiOps.c |  82 ++
 2 files changed, 85 insertions(+), 0 deletions(-)


When changing `logRootDirectory`, the new directory was not updated to
global `lgs_conf.logRootDirectory`, therefore all refering to new directory
got the old value.

This patch adds code to make sure new directory updated.
And one test case #03 of suite #5 are added to verify this case.

diff --git a/osaf/services/saf/logsv/lgs/lgs_imm.cc 
b/osaf/services/saf/logsv/lgs/lgs_imm.cc
--- a/osaf/services/saf/logsv/lgs/lgs_imm.cc
+++ b/osaf/services/saf/logsv/lgs/lgs_imm.cc
@@ -1858,6 +1858,9 @@ void logRootDirectory_filemove(
 stream = log_stream_get_by_id(--num);
   }
 
+  // Change logrootDirectory to new_logRootDirectory
+  lgs_rootpathconf_set(new_logRootDirectory);
+
   /* Create new files at new path
*/
   num = get_number_of_streams();
diff --git a/tests/logsv/tet_LogOiOps.c b/tests/logsv/tet_LogOiOps.c
--- a/tests/logsv/tet_LogOiOps.c
+++ b/tests/logsv/tet_LogOiOps.c
@@ -1023,6 +1023,87 @@ done:
 }
 
 /**
+ * CCB Object Modify, root directory. Path exist. OK
+ * Result shall be OK
+ */
+void change_root_path(void)
+{
+   int rc = 0, tst_stat = 0;
+   char command[256];
+   char tstdir[256];
+
+   /* Path to test directory */
+   sprintf(tstdir, "%s/croot", log_root_path);
+
+   // Remove if the test folder is exist
+   sprintf(command, "rm -rf %s/", tstdir);
+   rc = tet_system(command);
+
+   /* Create test directory */
+   sprintf(command, "mkdir -p %s", tstdir);
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail rc=%d\n", command, rc);
+   tst_stat = 1;
+   goto done;
+   }
+
+   /* Make sure it can be accessed by server */
+   sprintf(command, "chmod ugo+w,ugo+r %s", tstdir);
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail rc=%d\n", command, rc);
+   tst_stat = 1;
+   goto done;
+   }
+
+   sprintf(command, "immcfg -c SaLogStreamConfig safLgStrCfg=testRoot "
+   "-a saLogStreamPathName=./testRoot -a 
saLogStreamFileName=testRoot");
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail rc=%d\n", command, rc);
+   tst_stat = 1;
+   goto done;
+   }
+
+   /* Change to xxtest */
+   sprintf(command, "immcfg -a logRootDirectory=%s 
logConfig=1,safApp=safLogService", tstdir);
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail rc=%d\n", command, rc);
+   tst_stat = 1;
+   goto free;
+   }
+
+   // Verify if the directory and subdirectly are created successfully
+   usleep(100*1000); // to make sure logsv done processing of directories 
creation
+   sprintf(command, "ls %s/testRoot 1>/dev/null", tstdir);
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail rc=%d\n", command, rc);
+   tst_stat = 1;
+   }
+
+   /* Change back */
+   sprintf(command, "immcfg -a logRootDirectory=%s 
logConfig=1,safApp=safLogService", log_root_path);
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail to restore rc=%d\n", command, rc);
+   }
+
+free:
+   // Delete test app stream
+   sprintf(command, "immcfg -d safLgStrCfg=testRoot");;
+   rc = tet_system(command);
+   if (rc != 0) {
+   fprintf(stderr, "'%s' Fail to restore  rc=%d\n", command, rc);
+   }
+
+done:
+   rc_validate(tst_stat, 0);
+}
+
+/**
  * CCB Object Modify, data group. Group does not exist. Not allowed
  * Result shall be reject
  */
@@ -3776,6 +3857,7 @@ done:
test_suite_add(5, "LOG OI tests, Service configuration object");
test_case_add(5, saLogOi_52, "CCB Object Modify, root directory. Path 
does not exist. Not allowed");
test_case_add(5, saLogOi_48, "CCB Object Modify, root directory. Path 
exist. OK");
+   test_case_add(5, change_root_path, "CCB Object Modify, change root 
directory. Path exist. OK");
test_case_add(5, saLogOi_79, "CCB Object Modify, data group. Group does 
not exist. Not allowed");
test_case_add(5, saLogOi_80, "CCB Object Modify, data group. Group 
exists. OK");
test_case_add(5, saLogOi_81, "CCB Object Modify, delete data group. 
OK");

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


Re: [devel] [PATCH 1 of 1] MDS: Log TIPC dropped messages [#1957]

2016-09-21 Thread A V Mahesh
Hi HansN,

 >> any  how GA is tagged.

Sorry I mean  RC2 tagged

-AVM

On 9/21/2016 12:41 PM, A V Mahesh wrote:
> Hi HansN,
>
> I just tested with uniform buffer sizes in all nodes and sending 
> messages with normal phase the results looks OK,
> even after hitting the TIPC_ERR_OVERLOAD.
>
> So my conclusion is, in general all node will have same buffer sizes 
> let us go with V2  patch,  any  how GA is tagged ,
> so we have enough time for testing and if we get some issues we can 
> resolve them by next release.
>
> ==
>  
>
>
> Sep 21 11:51:40 SC-1 osafamfd[15792]: NO Node 'PL-4' joined the cluster
> Sep 21 11:51:40 SC-1 osafimmnd[15741]: NO Implementer connected: 17 
> (MsgQueueService132111) <0, 2040f>
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
> Sep 21 11:52:41 SC-1 osafimmd[15730]: 77 MDTM: undelivered message 
> condition ancillary data size: 0 : TIPC_ERR_OVERLOAD
> Sep 21 11:52:41 SC-1 osafimmd[15730]:  MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA
>
> ==
>  
>
>
>
> On 9/21/2016 11:37 AM, A 

Re: [devel] [PATCH 1 of 1] MDS: Log TIPC dropped messages V2 [#1957]

2016-09-21 Thread A V Mahesh
Hi HansN,

Ack tested .

Please  add  Steps to test  as :

1)  send continuous messages to process say  
2)  Pause receiver process(# kill -STOP 
 )
3)  once we hit  TIPC_ERR_OVERLOAD
4)  Continues a stopped osafimmnd  process(#kill -CONT 
 )

-AVM

On 8/19/2016 1:50 PM, Hans Nordeback wrote:
>   osaf/libs/core/mds/mds_dt_tipc.c |  36 +++-
>   1 files changed, 23 insertions(+), 13 deletions(-)
>
>
> diff --git a/osaf/libs/core/mds/mds_dt_tipc.c 
> b/osaf/libs/core/mds/mds_dt_tipc.c
> --- a/osaf/libs/core/mds/mds_dt_tipc.c
> +++ b/osaf/libs/core/mds/mds_dt_tipc.c
> @@ -320,6 +320,15 @@ uint32_t mdtm_tipc_init(NODE_ID nodeid,
>   m_MDS_LOG_INFO("MDTM: Successfully set default socket 
> option TIPC_IMP = %d", TIPCIMPORTANCE);
>   }
>   
> +int droppable = 0;
> +if (setsockopt(tipc_cb.BSRsock, SOL_TIPC, TIPC_DEST_DROPPABLE, 
> , sizeof(droppable)) != 0) {
> +LOG_ER("MDTM: Can't set TIPC_DEST_DROPPABLE to zero err 
> :%s\n", strerror(errno));
> +m_MDS_LOG_ERR("MDTM: Can't set TIPC_DEST_DROPPABLE to zero 
> err :%s\n", strerror(errno));
> +osafassert(0);
> +} else {
> +m_MDS_LOG_NOTIFY("MDTM: Successfully set TIPC_DEST_DROPPABLE 
> to zero");
> +}
> +
>   return NCSCC_RC_SUCCESS;
>   }
>   
> @@ -560,9 +569,9 @@ ssize_t recvfrom_connectionless (int sd,
>   struct iovec iov;
>   char anc_buf[CMSG_SPACE(8) + CMSG_SPACE(1024) + CMSG_SPACE(12)];
>   struct cmsghdr *anc;
> - unsigned char *cptr;
> - int i;
>   int has_addr;
> + int anc_data[2];
> +
>   ssize_t sz;
>   
>   has_addr = (from != NULL) && (addrlen != NULL);
> @@ -584,26 +593,27 @@ ssize_t recvfrom_connectionless (int sd,
>   m_MDS_LOG_DBG("MDTM: size: %d  anc is NULL", (int)sz);
>   }
>   while (anc != NULL) {
> - cptr = CMSG_DATA(anc);
>   
>   /* Receipt of a normal data message never creates the 
> TIPC_ERRINFO
>  and TIPC_RETDATA objects, and only creates the 
> TIPC_DESTNAME object
>  if the message was sent using a TIPC name or name 
> sequence as the
>  destination rather than a TIPC port ID So abort for 
> TIPC_ERRINFO and TIPC_RETDATA*/
>   if (anc->cmsg_type == TIPC_ERRINFO) {
> - /* TIPC_ERRINFO - TIPC error code associated 
> with a returned data message or a connection termination message  so abort */
> - m_MDS_LOG_CRITICAL("MDTM: undelivered message 
> condition ancillary data: TIPC_ERRINFO abort err :%s", strerror(errno) );
> - abort();
> + anc_data[0] = *((unsigned int*)(CMSG_DATA(anc) 
> + 0));
> + if (anc_data[0] == TIPC_ERR_OVERLOAD) {
> + LOG_CR("MDTM: undelivered message 
> condition ancillary data: TIPC_ERR_OVERLOAD");
> + m_MDS_LOG_CRITICAL("MDTM: undelivered 
> message condition ancillary data: TIPC_ERR_OVERLOAD");
> + } else {
> + /* TIPC_ERRINFO - TIPC error code 
> associated with a returned data message or a connection termination message  
> so abort */
> + LOG_CR("MDTM: undelivered message 
> condition ancillary data: TIPC_ERRINFO abort err : %d", anc_data[0]);
> + m_MDS_LOG_CRITICAL("MDTM: undelivered 
> message condition ancillary data: TIPC_ERRINFO abort err : %d", anc_data[0]);
> + }
>   } else if (anc->cmsg_type == TIPC_RETDATA) {
> - /* If we set TIPC_DEST_DROPPABLE off messge 
> (configure TIPC to return rejected messages to the sender )
> + /* If we set TIPC_DEST_DROPPABLE off message 
> (configure TIPC to return rejected messages to the sender )
>  we will hit this when we implement MDS 
> retransmit lost messages  abort can be replaced with flow control logic*/
> - for (i = anc->cmsg_len - sizeof(*anc); i > 0; 
> i--) {
> - m_MDS_LOG_DBG("MDTM: returned byte 
> 0x%02x\n", *cptr);
> - cptr++;
> - }
>   /* TIPC_RETDATA -The contents of a returned 
> data message  so abort */
> - m_MDS_LOG_CRITICAL("MDTM: undelivered message 
> condition ancillary data: TIPC_RETDATA abort err :%s", strerror(errno) );
> - abort();
> + LOG_CR("MDTM: undelivered message condition 
> ancillary data: TIPC_RETDATA");
> +  

Re: [devel] [PATCH 1 of 1] MDS: Log TIPC dropped messages [#1957]

2016-09-21 Thread A V Mahesh
Hi HansN,

On 9/20/2016 4:17 PM, Hans Nordebäck wrote:
> Hi Mahesh,
>
> I think only logging is needed as proposed in the patch, as some services are 
> already handling dropped messages. This logging will help in
> trouble shooting. Keeping TIPC_DEST_DROPPABLE to true will only make TIPC to 
> silently drop messages, the original problem persists and needs investigation,
> i.e. why the socket receive buffer is overloaded, one reason may be that the 
> MDS poll/receive loop together with the "big" mutex lock, (ticket #520).
[AVM]   One valid reason could be, in case of  TIPC_ERR_OVERLOAD 
recd_bytes is NOT zero ,  so buffer is overloaded can occur at TIPC or 
MDS level ,
   I  will investigate more and update.

> Did you check why MDS message loss mechanism doesn't detect on TIPC dropped 
> messages, AMF
> do detect this via e.g "out of sync", "msg id mismatch" and so on?
[AVM]  You mean  IMMD  message loss mechanism ?

-AVM
>
> /Regards HansN
>
> -Original Message-
> From: A V Mahesh [mailto:mahesh.va...@oracle.com]
> Sent: den 20 september 2016 12:29
> To: Anders Widell ; Hans Nordebäck 
> 
> Cc: opensaf-devel@lists.sourceforge.net; mathi.naic...@oracle.com
> Subject: Re: [PATCH 1 of 1] MDS: Log TIPC dropped messages [#1957]
>
> HI Anders Widell / HansN,
>
> On 9/16/2016 2:03 PM, Anders Widell wrote:
>> The idea was to just log reception of error info messages, for
>> trouble-shooting purposes.
> After multiple attempts,  i manged to simulate TIPC_ERR_OVERLOAD
> error.After  TIPC_ERR_OVERLOAD error is hit
> the cluster going to UN-recoverable state , because the send buffers are full.
>
> So we have two options :
>
> 1)  Set  TIPC_DEST_DROPPABLE to false ,  log TIPC_ERR_OVERLOAD error and then 
>  graceful  exist of sender,
>which allows remaining nodes to be survived.
>
> 2)  keep the current configuration as it is ( TIPC_DEST_DROPPABLE to true )
>
> =
> Sep 20 15:14:09 SC-1 osafamfd[3759]: NO Received node_up from 2040f:
> msg_id 1
> Sep 20 15:14:09 SC-1 osafamfd[3759]: NO Node 'PL-4' joined the cluster Sep 20 
> 15:14:09 SC-1 osafimmnd[3695]: NO Implementer connected: 19
> (MsgQueueService132111) <0, 2040f>
> *Sep 20 15:16:59 SC-1 osafimmd[3684]: 77 MDTM: undelivered message condition 
> ancillary data: TIPC_ERR_OVERLOAD* Sep 20 15:17:00 SC-1 osafimmnd[3695]: WA 
> Director Service in NOACTIVE state - fevs replies pending:1 fevs highest 
> processed:218744 Sep 20 15:17:00 SC-1 osafamfnd[3773]: NO 
> 'safComp=IMMD,safSu=SC-1,safSg=2N,safApp=OpenSAF' faulted due to 'avaDown' : 
> Recovery is 'nodeFailfast'
> Sep 20 15:17:00 SC-1 osafamfnd[3773]: ER 
> safComp=IMMD,safSu=SC-1,safSg=2N,safApp=OpenSAF Faulted due to:avaDown 
> Recovery is:nodeFailfast Sep 20 15:17:00 SC-1 osafamfnd[3773]: Rebooting 
> OpenSAF NodeId = 131343 EE Name = , Reason: Component faulted: recovery is 
> node failfast, OwnNodeId = 131343, SupervisionTime = 60 Sep 20 15:17:00 SC-1 
> osafimmnd[3695]: WA DISCARD DUPLICATE FEVS
> message:218744
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: WA Error code 2 returned for message 
> type 82 - ignoring Sep 20 15:17:00 SC-1 opensaf_reboot: Rebooting local node; 
> timeout=60 Sep 20 15:17:00 SC-1 osafimmnd[3695]: WA SC Absence IS allowed:900 
> IMMD service is DOWN Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO IMMD SERVICE IS 
> DOWN, HYDRA IS CONFIGURED => UNREGISTERING IMMND form MDS Sep 20 15:17:00 
> SC-1 osafntfimcnd[3742]: NO saImmOiDispatch() Fail SA_AIS_ERR_BAD_HANDLE (9) 
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:20002010f
> sv_id:27
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Implementer disconnected 1 <2,
> 2010f> (safLogService)
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:d0d0002010f
> sv_id:26
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:12010f
> sv_id:27
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Implementer disconnected 2 <16,
> 2010f> (@safLogService_appl)
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:130002010f
> sv_id:27
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Implementer disconnected 3 <19,
> 2010f> (@OpenSafImmReplicatorA)
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:140002010f
> sv_id:26
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:150002010f
> sv_id:27
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Implementer disconnected 4 <21,
> 2010f> (safClmService)
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:1a0002010f
> sv_id:27
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Implementer disconnected 5 <26,
> 2010f> (safAmfService)
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:1b0002010f
> sv_id:26
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:5bc0002010f
> sv_id:26
> Sep 20 15:17:00 SC-1 osafimmnd[3695]: NO Removing client id:5bd0002010f
>