Re: [devel] [PATCH 1/1] imm: fix immnd crash when authenticate non-local user [#3305]

2022-02-08 Thread Thanh Nguyen
Hello Thien,
Ack.
Regards, Thanh

-Original Message-
From: thien.m.huynh  
Sent: Tuesday, 8 February 2022 7:59 PM
To: Minh Hon Chau ; Thang Duc Nguyen 
; Hieu Hong Hoang 
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] imm: fix immnd crash when authenticate non-local 
user [#3305]

Correct length of buffer and init memory when allocate memory
---
 src/base/osaf_secutil.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/base/osaf_secutil.c b/src/base/osaf_secutil.c index 
3d3e32fbd..3a90b0f1c 100644
--- a/src/base/osaf_secutil.c
+++ b/src/base/osaf_secutil.c
@@ -225,8 +225,8 @@ static char *get_supplementary_group_list(pid_t pid)
// Exclude 'Groups:' string and a following tab
size_t len = strlen(line_buf) - groups_len - 1;
assert(len && "Invalid sumplementary group list");
-   group_list = (char *)malloc(len);
-   strcpy(group_list, line_buf + groups_len + 1);
+   group_list = (char *)calloc(len, sizeof(char));
+   memcpy(group_list, line_buf + groups_len + 1, len);
 
// Remove a character 'new line' at the end of the string
group_list[len - 1] = '\0';
--
2.25.1



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


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


Re: [devel] [PATCH 1/1] build: adaptive python version for rpm build [#3270]

2021-09-13 Thread Thanh Nguyen
Hello Thien,
Ack from me.
Best Regards, Thanh

-Original Message-
From: thien.m.huynh  
Sent: Tuesday, 17 August 2021 7:26 PM
To: Thang Duc Nguyen ; Minh Hon Chau 
; Hieu Hong Hoang 
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] build: adaptive python version for rpm build 
[#3270]

The unversioned macros, %{__python}, %{python_sitelib} are deprecated.
This patch make specific version python during byte compilation.
---
 opensaf.spec.in | 71 ++---
 1 file changed, 49 insertions(+), 22 deletions(-)

diff --git a/opensaf.spec.in b/opensaf.spec.in index 289e67d0d..3f8df2e7c 100644
--- a/opensaf.spec.in
+++ b/opensaf.spec.in
@@ -2,6 +2,7 @@
 %define opensaf_group opensaf
 
 %define is_python %(test "@PYTHON_ENABLED@" = "yes" && echo 1 || echo 0)
+%define is_python3 %([[ "@PYTHON_VERSION@" = 3.* ]] && echo 1 || echo 
+0)
 %define is_java %(test "@JAVA_ENABLED@" = "yes" && echo 1 || echo 0)  %define 
is_am4j %(test "@AM4J_ENABLED@" = "yes" && echo 1 || echo 0)  %define is_tests 
%(test "@TESTS_ENABLED@" = "yes" && echo 1 || echo 0) @@ -700,7 +701,11 @@ 
Requires: %{name}-clm-libs = %{version}-%{release}  %package python
 Group: Development/Libraries
 Summary: The Python AIS Bindings for SAF Services
-BuildRequires: python-devel
+%if %is_python3
+BuildRequires: python3-devel
+%else
+BuildRequires: python2-devel
+%endif
 Requires: %{name}-amf-libs = %{version}-%{release}
 Requires: %{name}-clm-libs = %{version}-%{release}
 Requires: %{name}-imm-libs = %{version}-%{release} @@ -745,6 +750,10 @@ 
Requires: %{name}-controller = %{version}-%{release}
 
 %prep
 %setup -q
+%if %is_python
+%define major_version %(echo @PYTHON_VERSION@ | head -c1) grep -rE 
+"^#!(.+?)python$" %{_topdir}/BUILD | cut -d ':' -f 1 | xargs -I '{}' sed -i '1 
s/python$/python%major_version/g' '{}'
+%endif
 
 
 %build
@@ -1553,27 +1562,45 @@ fi
 %if %is_python
 %files python
 %defattr(-,root,root)
-%{python_sitelib}/pyosaf/*.py
-%{python_sitelib}/pyosaf/*.pyc
-%{python_sitelib}/pyosaf/*.pyo
-%{python_sitelib}/pyosaf/utils/*.py
-%{python_sitelib}/pyosaf/utils/*.pyc
-%{python_sitelib}/pyosaf/utils/*.pyo
-%{python_sitelib}/pyosaf/utils/immom/*.py
-%{python_sitelib}/pyosaf/utils/immom/*.pyc
-%{python_sitelib}/pyosaf/utils/immom/*.pyo
-%{python_sitelib}/pyosaf/utils/clm/*.py
-%{python_sitelib}/pyosaf/utils/clm/*.pyc
-%{python_sitelib}/pyosaf/utils/clm/*.pyo
-%{python_sitelib}/pyosaf/utils/log/*.py
-%{python_sitelib}/pyosaf/utils/log/*.pyc
-%{python_sitelib}/pyosaf/utils/log/*.pyo
-%{python_sitelib}/pyosaf/utils/ntf/*.py
-%{python_sitelib}/pyosaf/utils/ntf/*.pyc
-%{python_sitelib}/pyosaf/utils/ntf/*.pyo
-%{python_sitelib}/pyosaf/utils/immoi/*.py
-%{python_sitelib}/pyosaf/utils/immoi/*.pyc
-%{python_sitelib}/pyosaf/utils/immoi/*.pyo
+%if %is_python3
+%{python3_sitelib}/pyosaf/*.py
+%{python3_sitelib}/pyosaf/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/*.py
+%{python3_sitelib}/pyosaf/utils/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/immom/*.py
+%{python3_sitelib}/pyosaf/utils/immom/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/immoi/*.py
+%{python3_sitelib}/pyosaf/utils/immoi/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/ntf/*.py
+%{python3_sitelib}/pyosaf/utils/ntf/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/log/*.py
+%{python3_sitelib}/pyosaf/utils/log/__pycache__/*.pyc
+%{python3_sitelib}/pyosaf/utils/clm/*.py
+%{python3_sitelib}/pyosaf/utils/clm/__pycache__/*.pyc
+%else
+%{python2_sitelib}/pyosaf/*.py
+%{python2_sitelib}/pyosaf/*.pyc
+%{python2_sitelib}/pyosaf/*.pyo
+%{python2_sitelib}/pyosaf/utils/*.py
+%{python2_sitelib}/pyosaf/utils/*.pyc
+%{python2_sitelib}/pyosaf/utils/*.pyo
+%{python2_sitelib}/pyosaf/utils/immom/*.py
+%{python2_sitelib}/pyosaf/utils/immom/*.pyc
+%{python2_sitelib}/pyosaf/utils/immom/*.pyo
+%{python2_sitelib}/pyosaf/utils/clm/*.py
+%{python2_sitelib}/pyosaf/utils/clm/*.pyc
+%{python2_sitelib}/pyosaf/utils/clm/*.pyo
+%{python2_sitelib}/pyosaf/utils/log/*.py
+%{python2_sitelib}/pyosaf/utils/log/*.pyc
+%{python2_sitelib}/pyosaf/utils/log/*.pyo
+%{python2_sitelib}/pyosaf/utils/ntf/*.py
+%{python2_sitelib}/pyosaf/utils/ntf/*.pyc
+%{python2_sitelib}/pyosaf/utils/ntf/*.pyo
+%{python2_sitelib}/pyosaf/utils/immoi/*.py
+%{python2_sitelib}/pyosaf/utils/immoi/*.pyc
+%{python2_sitelib}/pyosaf/utils/immoi/*.pyo
+%endif
+
 %endif
 
 
--
2.25.1



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


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


[devel] [PATCH 0/1] Review Request for ntf: Fix compilation errors for 32 bit machine

2021-08-26 Thread Thanh Nguyen
Summary: ntf: Fix compilation errors for 32 bit machine [#3279]
Review request for Ticket(s): 3279
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3279
Base revision: c0f7603a4a7354d30099898d005bf474b78e3d6e
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 472831daf2169a3fd42f0719a5116bc9b2916fbe
Author: Thanh Nguyen 
Date:   Fri, 27 Aug 2021 10:17:53 +1000

ntf: Fix compilation errors for 32 bit machine [#3279]

Patch for ticket 3277 failed compilation for 32 bit machine.
This patch fixes these compilation errors.



Complete diffstat:
--
 src/ntf/ntfd/NtfSubscription.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] ntf: Fix compilation errors for 32 bit machine [#3279]

2021-08-26 Thread Thanh Nguyen
Patch for ticket 3277 failed compilation for 32 bit machine.
This patch fixes these compilation errors.
---
 src/ntf/ntfd/NtfSubscription.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ntf/ntfd/NtfSubscription.cc b/src/ntf/ntfd/NtfSubscription.cc
index 95b22ac84..4e42a3a35 100644
--- a/src/ntf/ntfd/NtfSubscription.cc
+++ b/src/ntf/ntfd/NtfSubscription.cc
@@ -302,7 +302,7 @@ void NtfSubscription::sendNotification(NtfSmartPtr& 
notification,
 evt->info.mds_info.node_id =
   m_NTFS_GET_NODE_ID_FROM_ADEST(client->getMdsDest());
 evt->info.mds_info.mds_dest_id = client->getMdsDest();
-TRACE("Nodeid: %u, MdsDest: %lu", evt->info.mds_info.node_id,
+TRACE("Nodeid: %u, MdsDest: %" PRIu64, evt->info.mds_info.node_id,
 evt->info.mds_info.mds_dest_id);
 TRACE("mdsDest: %" PRIu64, evt->info.mds_info.mds_dest_id);
 
@@ -313,7 +313,8 @@ void NtfSubscription::sendNotification(NtfSmartPtr& 
notification,
   free(evt);
   goto done;
 }
-LOG_ER("Down event missed for app with mdsdest: %lu on node: %u",
+LOG_ER(
+"Down event missed for app with mdsdest: %" PRIu64 " on node: %u",
 evt->info.mds_info.mds_dest_id, evt->info.mds_info.node_id);
   }  // End
   }
-- 
2.25.0



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


Re: [devel] [PATCH 1/1] ntf: Enhance periodic logging alarm notification when queue available [#2911]

2021-05-26 Thread Thanh Nguyen
Hello Thien,

Ack from me.
I have no further comments.
Best Regards,
Thanh

-Original Message-
From: Thien Minh Huynh  
Sent: Wednesday, 26 May 2021 3:17 PM
To: Thanh Nguyen ; Minh Hon Chau 

Cc: opensaf-devel@lists.sourceforge.net; Thien Minh Huynh 

Subject: [PATCH 1/1] ntf: Enhance periodic logging alarm notification when 
queue available [#2911]

This ticket addresses two issues:
 - Ntfd queues alarm notifications forever until a new alarm
   notification arrives.
 - Logger buffer in NTFD has no limit when resilience feature is enabled.

The enhancement introduces a periodic handling of notification queue.
Another change is that alarm notification is removed from the queue when 
writing to the log is  successful. The base functionality added notification to 
the queue when writing to the log failed.
---
 src/ntf/ntfd/NtfAdmin.cc| 34 +
 src/ntf/ntfd/NtfAdmin.h |  2 +
 src/ntf/ntfd/NtfLogger.cc   | 88 +++--
 src/ntf/ntfd/NtfLogger.h|  4 ++
 src/ntf/ntfd/NtfNotification.cc |  1 +
 src/ntf/ntfd/NtfNotification.h  |  3 ++
 src/ntf/ntfd/ntfs.h |  5 ++
 src/ntf/ntfd/ntfs_com.h |  2 +
 src/ntf/ntfd/ntfs_main.c| 24 -
 9 files changed, 113 insertions(+), 50 deletions(-)

diff --git a/src/ntf/ntfd/NtfAdmin.cc b/src/ntf/ntfd/NtfAdmin.cc index 
8bbee69c5..bde30be8c 100644
--- a/src/ntf/ntfd/NtfAdmin.cc
+++ b/src/ntf/ntfd/NtfAdmin.cc
@@ -31,9 +31,12 @@
 #include "base/logtrace.h"
 #include "base/osaf_utility.h"
 #include "ntf/common/ntfsv_mem.h"
+#include "base/time.h"
 
 NtfAdmin *NtfAdmin::theNtfAdmin = NULL;
 
+static const unsigned kTimeoutMs = 
+NTFSV_LOGGER_PERODIC_POLL_TIMEOUT_MS;
+
 /**
  * This is the constructor. The cluster-wide unique counter for
  * notifications and the local counter for the clients are @@ -743,6 +746,26 
@@ void NtfAdmin::checkNotificationList() {
   TRACE_LEAVE();
 }
 
+/**
+ * Calculate timeout periodic checking
+ */
+int NtfAdmin::GeneratePollTimeout(struct timespec last) {
+  if (logger.isLoggerBufferEmpty() || !activeController()) return -1;
+  struct timespec passed_time;
+  struct timespec current = base::ReadMonotonicClock();
+  osaf_timespec_subtract(, , _time);
+  auto passed_time_ms = osaf_timespec_to_millis(_time);
+  return (passed_time_ms < kTimeoutMs) ? (kTimeoutMs - passed_time_ms) 
+: 0; }
+
+/**
+ * Periodic logging alarm notification when queue available  */ void 
+NtfAdmin::PeriodicCheck() {
+  if (logger.isLoggerBufferEmpty() || !activeController()) return;
+  logger.logQueuedNotification();
+}
+
 /**
  * Check if a certain client exists.
  *
@@ -1265,6 +1288,17 @@ void discardedClear(unsigned int clientId,
   return NtfAdmin::theNtfAdmin->discardedClear(clientId, subscriptionId);  }
 
+void PeriodicCheck() {
+  osafassert(NtfAdmin::theNtfAdmin != NULL);
+  return NtfAdmin::theNtfAdmin->PeriodicCheck();
+}
+
+int GeneratePollTimeout(struct timespec last) {
+  if (!activeController()) return -1;
+  osafassert(NtfAdmin::theNtfAdmin != NULL);
+  return NtfAdmin::theNtfAdmin->GeneratePollTimeout(last);
+}
+
 /C Wrappers related to CLM Integration
  * **/
 void add_member_node(NODE_ID node_id) { diff --git a/src/ntf/ntfd/NtfAdmin.h 
b/src/ntf/ntfd/NtfAdmin.h index 4808ca94d..a75e389e7 100644
--- a/src/ntf/ntfd/NtfAdmin.h
+++ b/src/ntf/ntfd/NtfAdmin.h
@@ -109,6 +109,8 @@ class NtfAdmin {
   uint32_t send_cluster_membership_msg_to_clients(
   SaClmClusterChangesT cluster_change, NODE_ID node_id);
   bool is_stale_client(unsigned int clientId);
+  void PeriodicCheck();
+  int GeneratePollTimeout(struct timespec last);
 
  private:
   void processNotification(unsigned int clientId, diff --git 
a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc index 
f272a9a5a..c0ecc4cb7 100644
--- a/src/ntf/ntfd/NtfLogger.cc
+++ b/src/ntf/ntfd/NtfLogger.cc
@@ -108,33 +108,17 @@ void saLogStreamOpenCallback(SaInvocationT invocation,
 
 void saLogWriteLogCallback(SaInvocationT invocation, SaAisErrorT error) {
   TRACE_ENTER2("Callback for notificationId %llu", invocation);
-
   if (SA_AIS_OK != error) {
-NtfSmartPtr notification;
-
-TRACE_1("Error when logging (%d), queue for relogging", error);
-
-notification = NtfAdmin::theNtfAdmin->getNotificationById(
-(SaNtfIdentifierT)invocation);
-
-osafassert(notification != NULL);
-
-if (!notification->loggedOk()) {
-  NtfAdmin::theNtfAdmin->logger.queueNotifcation(notification);
-  TRACE_LEAVE();
-  return;
-} else {
-  LOG_ER("Already marked as logged notificationId: %d", (int)invocation);
-  /* this should not happen */
-  osafassert(0);
-}
+TRACE_1("Error when logging (%d)", error);
+NtfAdmin::theNtfAdmin->logger.disableAckWaiting();
+  } else {
+// Reset logger buffer full flag. If the flag is s

Re: [devel] [PATCH 1/1] ntf: periodic logging alarm notification when queue available [#2911]

2021-05-20 Thread Thanh Nguyen
Hello Thien,

I have a question. The patch introduces two constants
static const unsigned kTimeoutMs = 5000;
const int kMaxEvent = 50;

These are significant constants which are as significant as 
NTFSV_LOGGER_BUFFER_CAPACITY.
My question is that if these two constants are to be described and treated as 
NTFSV_LOGGER_BUFFER_CAPACITY.
Best Regards,
Thanh

-Original Message-
From: Thien Minh Huynh  
Sent: Thursday, 6 May 2021 6:05 PM
To: Thanh Nguyen ; Minh Hon Chau 

Cc: opensaf-devel@lists.sourceforge.net; Thien Minh Huynh 

Subject: [PATCH 1/1] ntf: periodic logging alarm notification when queue 
available [#2911]

Two problem in this ticket:
 - Ntfd will queue alarm notifications forever if don't have any notifications 
arrive.
 - Logger buffer in NTFD no longer limited when enable resilience feature.

The fix is adding periodic checking and writing alarm notifications in a queue 
and remove log in `queuedNotificationList` when write log success instead of 
adding to queue when write log fail.
---
 src/ntf/ntfd/NtfAdmin.cc| 33 +
 src/ntf/ntfd/NtfAdmin.h |  2 +
 src/ntf/ntfd/NtfLogger.cc   | 88 +++--
 src/ntf/ntfd/NtfLogger.h|  4 ++
 src/ntf/ntfd/NtfNotification.cc |  1 +
 src/ntf/ntfd/NtfNotification.h  |  3 ++
 src/ntf/ntfd/ntfs_com.h |  2 +
 src/ntf/ntfd/ntfs_main.c| 23 -
 8 files changed, 106 insertions(+), 50 deletions(-)

diff --git a/src/ntf/ntfd/NtfAdmin.cc b/src/ntf/ntfd/NtfAdmin.cc index 
8bbee69c5..68e2c173f 100644
--- a/src/ntf/ntfd/NtfAdmin.cc
+++ b/src/ntf/ntfd/NtfAdmin.cc
@@ -31,8 +31,10 @@
 #include "base/logtrace.h"
 #include "base/osaf_utility.h"
 #include "ntf/common/ntfsv_mem.h"
+#include "base/time.h"
 
 NtfAdmin *NtfAdmin::theNtfAdmin = NULL;
+static const unsigned kTimeoutMs = 5000;
 
 /**
  * This is the constructor. The cluster-wide unique counter for @@ -743,6 
+745,26 @@ void NtfAdmin::checkNotificationList() {
   TRACE_LEAVE();
 }
 
+/**
+ * Calculate timeout periodic checking
+ */
+int NtfAdmin::GeneratePollTimeout(struct timespec last) {
+  if (logger.isLoggerBufferEmpty() || !activeController()) return -1;
+  struct timespec passed_time;
+  struct timespec current = base::ReadMonotonicClock();
+  osaf_timespec_subtract(, , _time);
+  auto passed_time_ms = osaf_timespec_to_millis(_time);
+  return (passed_time_ms < kTimeoutMs) ? (kTimeoutMs - passed_time_ms) 
+: 0; }
+
+/**
+ * Periodic logging alarm notification when queue available  */ void 
+NtfAdmin::PeriodicCheck() {
+  if (logger.isLoggerBufferEmpty() || !activeController()) return;
+  logger.dequeueLoggerBuffer();
+}
+
 /**
  * Check if a certain client exists.
  *
@@ -1265,6 +1287,17 @@ void discardedClear(unsigned int clientId,
   return NtfAdmin::theNtfAdmin->discardedClear(clientId, subscriptionId);  }
 
+void PeriodicCheck() {
+  osafassert(NtfAdmin::theNtfAdmin != NULL);
+  return NtfAdmin::theNtfAdmin->PeriodicCheck();
+}
+
+int GeneratePollTimeout(struct timespec last) {
+  if (!activeController()) return -1;
+  osafassert(NtfAdmin::theNtfAdmin != NULL);
+  return NtfAdmin::theNtfAdmin->GeneratePollTimeout(last);
+}
+
 /C Wrappers related to CLM Integration
  * **/
 void add_member_node(NODE_ID node_id) { diff --git a/src/ntf/ntfd/NtfAdmin.h 
b/src/ntf/ntfd/NtfAdmin.h index 4808ca94d..a75e389e7 100644
--- a/src/ntf/ntfd/NtfAdmin.h
+++ b/src/ntf/ntfd/NtfAdmin.h
@@ -109,6 +109,8 @@ class NtfAdmin {
   uint32_t send_cluster_membership_msg_to_clients(
   SaClmClusterChangesT cluster_change, NODE_ID node_id);
   bool is_stale_client(unsigned int clientId);
+  void PeriodicCheck();
+  int GeneratePollTimeout(struct timespec last);
 
  private:
   void processNotification(unsigned int clientId, diff --git 
a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc index 
f272a9a5a..640bac4fe 100644
--- a/src/ntf/ntfd/NtfLogger.cc
+++ b/src/ntf/ntfd/NtfLogger.cc
@@ -108,33 +108,17 @@ void saLogStreamOpenCallback(SaInvocationT invocation,
 
 void saLogWriteLogCallback(SaInvocationT invocation, SaAisErrorT error) {
   TRACE_ENTER2("Callback for notificationId %llu", invocation);
-
   if (SA_AIS_OK != error) {
-NtfSmartPtr notification;
-
-TRACE_1("Error when logging (%d), queue for relogging", error);
-
-notification = NtfAdmin::theNtfAdmin->getNotificationById(
-(SaNtfIdentifierT)invocation);
-
-osafassert(notification != NULL);
-
-if (!notification->loggedOk()) {
-  NtfAdmin::theNtfAdmin->logger.queueNotifcation(notification);
-  TRACE_LEAVE();
-  return;
-} else {
-  LOG_ER("Already marked as logged notificationId: %d", (int)invocation);
-  /* this should not happen */
-  osafassert(0);
-}
+TRACE_1("Error when logging (%d)", error);
+NtfAdmin::theNtfAdmin->logger.disableAckWating();
+  } else {
+

Re: [devel] [PATCH 1/1] pyosaf: support for amf api version b4.02 [#3256]

2021-04-25 Thread Thanh Nguyen
Hi Anh and Thang,
Ack. No comment from me.


-Original Message-
From: Thang Duc Nguyen  
Sent: Monday, 26 April 2021 1:07 PM
To: Anh Tuan Le ; Thanh Nguyen 
; Hieu Hong Hoang 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: support for amf api version b4.02 [#3256]

Ack. No comment from me.

-Original Message-
From: Anh Tuan Le  
Sent: Tuesday, April 20, 2021 9:41 AM
To: Thang Duc Nguyen ; Thanh Nguyen 
; Hieu Hong Hoang 
Cc: opensaf-devel@lists.sourceforge.net; Anh Tuan Le 
Subject: [PATCH 1/1] pyosaf: support for amf api version b4.02 [#3256]

---
 python/pyosaf/saAmf.py | 57 +-
 1 file changed, 56 insertions(+), 1 deletion(-)

diff --git a/python/pyosaf/saAmf.py b/python/pyosaf/saAmf.py index 
ff9265d22..b3ae55f7f 100644
--- a/python/pyosaf/saAmf.py
+++ b/python/pyosaf/saAmf.py
@@ -392,7 +392,11 @@ SaAmfContainedComponentInstantiateCallbackT = 
CFUNCTYPE(None,  SaAmfContainedComponentCleanupCallbackT = CFUNCTYPE(None,
SaInvocationT, POINTER(SaNameT))
 
-#if defined(SA_AMF_B01) || defined(SA_AMF_B02)
+SaAmfCsiAttributeChangeCallbackT = CFUNCTYPE(None, SaInvocationT,
+ POINTER(SaNameT),
+ SaAmfCSIAttributeListT)
+
+# if defined(SA_AMF_B01) || defined(SA_AMF_B02)
 class SaAmfCallbacksT(Structure):
"""Contain various callbacks AMF may invoke on a component.
"""
@@ -691,6 +695,57 @@ def saAmfInitialize_4(amfHandle, amfCallbacks, version):
return amfdll.saAmfInitialize_4(BYREF(amfHandle),
BYREF(amfCallbacks), BYREF(version))
 
+
+# pylint: disable-msg=R0903
+class SaAmfCallbacksTB0402(Structure):
+"""Contain various callbacks AMF may invoke on a component.
+"""
+_fields_ = [('saAmfHealthcheckCallback',
+ SaAmfHealthcheckCallbackT),
+('saAmfComponentTerminateCallback',
+ SaAmfComponentTerminateCallbackT),
+('saAmfCSISetCallback',
+ SaAmfCSISetCallbackT),
+('saAmfCSIRemoveCallback',
+ SaAmfCSIRemoveCallbackT),
+('saAmfProtectionGroupTrackCallback',
+ SaAmfProtectionGroupTrackCallbackT_4),
+('saAmfProxiedComponentInstantiateCallback',
+ SaAmfProxiedComponentInstantiateCallbackT),
+('saAmfProxiedComponentCleanupCallback',
+ SaAmfProxiedComponentCleanupCallbackT),
+('saAmfContainedComponentInstantiateCallback',
+ SaAmfContainedComponentInstantiateCallbackT),
+('saAmfContainedComponentCleanupCallback',
+ SaAmfContainedComponentCleanupCallbackT),
+('osafCsiAttributeChangeCallback',
+ SaAmfCsiAttributeChangeCallbackT)]
+# pylint: enable-msg=R0903
+
+
+def saAmfInitialize_o4(amfHandle, amfCallbacks, version):
+"""Register invoking process with AMF.
+
+type arguments:
+SaAmfHandleT amfHandle
+SaAmfCallbacksT_o4 amfCallbacks
+SaVersionT version
+
+returns:
+SaAisErrorT
+
+"""
+
+amfdll.saAmfInitialize_o4.argtypes = [POINTER(SaAmfHandleT),
+  POINTER(SaAmfCallbacksTB0402),
+  POINTER(SaVersionT)]
+
+amfdll.saAmfInitialize_o4.restype = SaAisErrorT
+
+return amfdll.saAmfInitialize_o4(BYREF(amfHandle),
+ BYREF(amfCallbacks), 
+ BYREF(version))
+
+
 def saAmfSelectionObjectGet(amfHandle, selectionObject):
"""Return operating system handle associated with AMF handle to detect
pending callbacks.
--
2.17.1



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


[devel] [PATCH 1/1] smf: Enhance handling of global variables [#2726]

2021-03-30 Thread Thanh Nguyen
Appropriate global variables in smfnd are placed under mutex
protection: smfnd_cb_t::smfd_dest, smfnd_cb_t::agent_cnt
---
 src/smf/smfnd/smfnd.h | 1 +
 src/smf/smfnd/smfnd_evt.c | 7 +++
 src/smf/smfnd/smfnd_mds.c | 9 +
 3 files changed, 17 insertions(+)

diff --git a/src/smf/smfnd/smfnd.h b/src/smf/smfnd/smfnd.h
index 947745a40..d5c4ac81b 100644
--- a/src/smf/smfnd/smfnd.h
+++ b/src/smf/smfnd/smfnd.h
@@ -66,6 +66,7 @@ typedef struct {
   *cbk_list;  /* Mapping between inv_id and all the agents */
   uint32_t agent_cnt; /* Count of SMF Agents */
   MDS_DEST smfd_dest; /* MDS DEST of SMFD */
+  pthread_mutex_t cb_lock; /* Used by smfnd_cb_t lock/unlock functions */
 } smfnd_cb_t;
 
 extern smfnd_cb_t *smfnd_cb;
diff --git a/src/smf/smfnd/smfnd_evt.c b/src/smf/smfnd/smfnd_evt.c
index 552e11a37..48015fd5b 100644
--- a/src/smf/smfnd/smfnd_evt.c
+++ b/src/smf/smfnd/smfnd_evt.c
@@ -22,6 +22,7 @@
 #include "smfnd.h"
 #include "smf/common/smfsv_defs.h"
 #include "smf/common/smfsv_evt.h"
+#include "base/osaf_utility.h"
 
 /* This function is called in another threads context so be
careful with what you do here */
@@ -417,10 +418,12 @@ uint32_t smfnd_cbk_resp_err_proc(smfnd_cb_t *cb, 
SaInvocationT inv_id)
resp_evt.info.smfd.event.cbk_rsp.evt.resp_evt
.err = SA_AIS_ERR_FAILED_OPERATION;
 
+   osaf_mutex_lock_ordie(>cb_lock);
rc = smfsv_mds_msg_send(
cb->mds_handle, NCSMDS_SVC_ID_SMFD,
cb->smfd_dest, NCSMDS_SVC_ID_SMFND,
_evt);
+   osaf_mutex_unlock_ordie(>cb_lock);
}
break;
}
@@ -474,10 +477,12 @@ uint32_t smfnd_cbk_resp_ok_proc(smfnd_cb_t *cb, 
SaInvocationT inv_id,
resp_evt.info.smfd.event.cbk_rsp.evt
.resp_evt.err = resp;
 
+   osaf_mutex_lock_ordie(>cb_lock);
rc = smfsv_mds_msg_send(
cb->mds_handle, NCSMDS_SVC_ID_SMFD,
cb->smfd_dest, NCSMDS_SVC_ID_SMFND,
_evt);
+   osaf_mutex_unlock_ordie(>cb_lock);
}
/* Send resp to SMFD and break.*/
break;
@@ -536,7 +541,9 @@ static void proc_cbk_req_rsp(smfnd_cb_t *cb, SMFSV_EVT *evt)
TRACE_ENTER();
switch (evt->info.smfnd.event.cbk_req_rsp.evt_type) {
case SMF_CLBK_EVT: {
+   osaf_mutex_lock_ordie(>cb_lock);
smfnd_cbk_req_proc(cb, evt);
+   osaf_mutex_unlock_ordie(>cb_lock);
break;
}
case SMF_RSP_EVT: {
diff --git a/src/smf/smfnd/smfnd_mds.c b/src/smf/smfnd/smfnd_mds.c
index b49f5f1bd..8298bb4ca 100644
--- a/src/smf/smfnd/smfnd_mds.c
+++ b/src/smf/smfnd/smfnd_mds.c
@@ -19,6 +19,7 @@
 
 #include "smfnd.h"
 #include "smf/common/smfsv_evt.h"
+#include "base/osaf_utility.h"
 
 uint32_t mds_register(smfnd_cb_t *cb);
 void mds_unregister(smfnd_cb_t *cb);
@@ -242,14 +243,18 @@ static uint32_t mds_svc_event(struct ncsmds_callback_info 
*info)
case NCSMDS_UP:
/* TODO: No lock is taken. This might be dangerous.*/
if (NCSMDS_SVC_ID_SMFA == svc_evt->i_svc_id) {
+   osaf_mutex_lock_ordie(>cb_lock);
cb->agent_cnt++;
+   osaf_mutex_unlock_ordie(>cb_lock);
TRACE("Count of agents incremeted to : %d",
  cb->agent_cnt);
} else if (NCSMDS_SVC_ID_SMFD == svc_evt->i_svc_id) {
/* Catch the vdest of SMFD*/
if (m_MDS_DEST_IS_AN_ADEST(svc_evt->i_dest))
return NCSCC_RC_SUCCESS;
+   osaf_mutex_lock_ordie(>cb_lock);
cb->smfd_dest = svc_evt->i_dest;
+   osaf_mutex_unlock_ordie(>cb_lock);
LOG_NO("MDS %s: NCSMDS_SVC_ID_SMFD "
"dest = 0x%" PRIx64,
__FUNCTION__, svc_evt->i_dest);
@@ -263,13 +268,17 @@ static uint32_t mds_svc_event(struct ncsmds_callback_info 
*info)
 agents, not the adest of agents and hence it is not possible to
 clean up cbk_list.*/
if (NCSMDS_SVC_ID_SMFA == svc_evt->i_svc_id) {
+   osaf_mutex_lock_ordie(>cb_lock);
cb->agent_cnt--;
+   osaf_mutex_unlock_ordie(>cb_lock);
TRACE("Count of agents 

[devel] [PATCH 0/1] Review Request for smf: Enhance handling of global variables [#2726]

2021-03-30 Thread Thanh Nguyen
Summary: smf: Enhance handling of global variables [#2726]
Review request for Ticket(s): 2726
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2726
Base revision: e950938bfe98ab6b897c3f03ca73f3bbaca2be9e
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 8a37cdc5d686705ad5610269a55eb7e6be752f00
Author: Thanh Nguyen 
Date:   Wed, 31 Mar 2021 08:31:43 +1100

smf: Enhance handling of global variables [#2726]

Appropriate global variables in smfnd are placed under mutex
protection: smfnd_cb_t::smfd_dest, smfnd_cb_t::agent_cnt



Complete diffstat:
--
 src/smf/smfnd/smfnd.h | 1 +
 src/smf/smfnd/smfnd_evt.c | 7 +++
 src/smf/smfnd/smfnd_mds.c | 9 +
 3 files changed, 17 insertions(+)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


Re: [devel] [PATCH 1/1] clm: use calloc instead malloc to remove garbage value [#3251]

2021-02-03 Thread Thanh Nguyen
Hi Thien,
Ack.
Regards, 
Thanh

-Original Message-
From: Thien Minh Huynh  
Sent: Wednesday, 3 February 2021 7:42 PM
To: Thang Duc Nguyen ; Thanh Nguyen 

Cc: opensaf-devel@lists.sourceforge.net; Thien Minh Huynh 

Subject: [PATCH 1/1] clm: use calloc instead malloc to remove garbage value 
[#3251]

The buffer nodeAddress having the garbage value. That leading to pyosaf clma is 
stuck during decode byte-string.

The fix is make sure buffer clean before stored.
---
 src/clm/agent/clma_mds.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/clm/agent/clma_mds.cc b/src/clm/agent/clma_mds.cc index 
7b7d6a5c8..3e7cb7db2 100644
--- a/src/clm/agent/clma_mds.cc
+++ b/src/clm/agent/clma_mds.cc
@@ -502,7 +502,7 @@ static uint32_t clma_dec_cluster_ntf_buf_msg(
   total_bytes += 4;
 
   param->notification = static_cast(
-  malloc(sizeof(SaClmClusterNotificationT_4) * param->numberOfItems));
+  calloc(param->numberOfItems, 
+ sizeof(SaClmClusterNotificationT_4)));
   if (param->notification == nullptr) {
 TRACE("Can not allocate memory notification!!!\n");
 TRACE_LEAVE();
--
2.25.1



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


Re: [devel] [PATCH 1/1] smd: avoid smf stucked during admin op in parallel [#3248]

2021-01-21 Thread Thanh Nguyen
Ack from me.
The tile of the patch should start with "smf:" rather than "smd:".
Best Regards,
Thanh

-Original Message-
From: Thang Duc Nguyen  
Sent: Monday, 18 January 2021 2:32 PM
To: Thanh Nguyen ; Thien Minh Huynh 

Cc: opensaf-devel@lists.sourceforge.net; Thang Duc Nguyen 

Subject: [PATCH 1/1] smd: avoid smf stucked during admin op in parallel [#3248]

There is rare case that thread adminOperationAsyncThread done before the main 
thread continue. It caused the main thread stucked forever.

The fix is to correct this issue.
---
 src/smf/smfd/SmfUtils.cc | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc index 
a7f0cf895..45da44256 100644
--- a/src/smf/smfd/SmfUtils.cc
+++ b/src/smf/smfd/SmfUtils.cc
@@ -269,7 +269,7 @@ bool SmfImmUtils::initialize(void) {
   }
 
   m_asyncThreadRunning = false;
-  m_admOiReturn = SA_AIS_OK;
+  m_admOiReturn = SA_AIS_ERR_TRY_AGAIN;
 
   return true;
 }
@@ -649,6 +649,7 @@ void SmfImmUtils::adminOperationAsyncThread(void) {  // 
--
 void SmfImmUtils::callAdminOperationAsync(
 const std::string _dn, SaAmfAdminOperationIdT i_operationId) {
+  TRACE_ENTER();
   if (m_asyncThreadRunning) {
 LOG_ER("Already invoke admin async with this instance");
 return;
@@ -662,7 +663,11 @@ void SmfImmUtils::callAdminOperationAsync(
 LOG_ER("Failed to create thread adminOperationAsyncThread");
 exit(EXIT_FAILURE);
   }
-  while (!m_asyncThreadRunning) { base::Sleep(base::kOneMillisecond); }
+
+  while (!m_asyncThreadRunning && (m_admOiReturn == SA_AIS_ERR_TRY_AGAIN)) {
+base::Sleep(base::kOneMillisecond);
+  }
+  TRACE_LEAVE();
 }
 
 // 
--
--
2.25.1



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


Re: [devel] [PATCH 1/1] pyosaf: update pyosaf support python3 [#3247]

2021-01-18 Thread Thanh Nguyen
Ack

-Original Message-
From: Thang Duc Nguyen  
Sent: Monday, 18 January 2021 5:14 PM
To: Thien Minh Huynh ; Thanh Nguyen 

Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] pyosaf: update pyosaf support python3 [#3247]

Ack.


-Original Message-
From: Thien Minh Huynh 
Sent: Thursday, January 14, 2021 5:07 PM
To: Thang Duc Nguyen ; Thanh Nguyen 

Cc: opensaf-devel@lists.sourceforge.net; Thien Minh Huynh 

Subject: [PATCH 1/1] pyosaf: update pyosaf support python3 [#3247]

- check data type before implicit type conversion
- add more encode/decode byte-string
- update iterable dict items for python 2 and 3
---
 python/pyosaf/saClm.py   | 34 +---
 python/pyosaf/utils/clm/__init__.py  |  4 +--
 python/pyosaf/utils/immoi/agent.py   |  6 ++--
 python/pyosaf/utils/immoi/implementer.py | 14 
 python/pyosaf/utils/immom/agent.py   |  6 ++--
 python/pyosaf/utils/immom/iterator.py|  8 ++---
 python/pyosaf/utils/immom/object.py  | 10 +++---
 python/pyosaf/utils/ntf/subscriber.py|  7 ++--
 python/samples/imm-listener  |  2 +-
 python/samples/imm-listener-inheritance-impl |  2 +-
 python/samples/immbase.py|  4 +--
 python/samples/immlist   |  2 +-
 python/samples/scale_opensaf |  2 +-
 13 files changed, 58 insertions(+), 43 deletions(-)

diff --git a/python/pyosaf/saClm.py b/python/pyosaf/saClm.py index 
f140d4484..a044360a0 100644
--- a/python/pyosaf/saClm.py
+++ b/python/pyosaf/saClm.py
@@ -19,7 +19,7 @@ from ctypes import POINTER, CDLL, Structure, CFUNCTYPE  from 
pyosaf.saAis import SaUint64T, SaUint32T, Const, SaEnumT, Enumeration, \
 SaBoolT, SaTimeT, SaNameT, SaAisErrorT, SaInvocationT, BYREF, \
 SaVersionT, SaSelectionObjectT, SaInt8T, SaDispatchFlagsT, SaUint8T, \
-SaUint16T
+SaUint16T, PY3
 from pyosaf import saNtf
 
 clmdll = CDLL('libSaClm.so.0')
@@ -81,17 +81,27 @@ eSaClmAdditionalInfoIdT_4 = Enumeration((
 ))
 
 class SaClmNodeAddressT(Structure):
-   """Contain string representation of communication address associated
-   with cluster node.
-   """
-   _fields_ = [('family', SaClmNodeAddressFamilyT),
-   ('length', SaUint16T),
-   ('value', SaInt8T*saClm.SA_CLM_MAX_ADDRESS_LENGTH)]
-   def __init__(self, family=0, address=''):
-   """Construct instance of 'family' with contents of 'name'.
-   """
-   super(SaClmNodeAddressT, self).__init__(family,
-   len(address), address)
+"""Contain string representation of communication address associated
+with cluster node.
+"""
+_fields_ = [('family', SaClmNodeAddressFamilyT),
+('length', SaUint16T),
+('value', SaInt8T * saClm.SA_CLM_MAX_ADDRESS_LENGTH)]
+
+def __init__(self, family=0, address=''):
+"""Construct instance of 'family' with contents of 'name'.
+"""
+if PY3:
+address = address.encode('utf-8')
+super(SaClmNodeAddressT, self).__init__(family,
+len(address), address)
+
+def __str__(self):
+"""Returns the content of SaClmNodeAddressT
+"""
+if PY3:
+return self.value.decode('utf-8')
+return self.value
 
 SaClmChangeStepT = SaEnumT
 eSaClmChangeStepT = Enumeration((
diff --git a/python/pyosaf/utils/clm/__init__.py 
b/python/pyosaf/utils/clm/__init__.py
index 5461d4a3c..496f4be2a 100644
--- a/python/pyosaf/utils/clm/__init__.py
+++ b/python/pyosaf/utils/clm/__init__.py
@@ -67,9 +67,9 @@ class ClusterNode(object):
 cluster membership
 """
 self.node_id = node_id
-self.node_address_value = node_address.value
+self.node_address_value = str(node_address)
 self.node_address_family = node_address.family
-self.node_name = node_name.value
+self.node_name = str(node_name)
 self.execution_environment = execution_environment
 self.member = member
 self.boot_timestamp = boot_timestamp diff --git 
a/python/pyosaf/utils/immoi/agent.py b/python/pyosaf/utils/immoi/agent.py
index e0697b1ef..19c453fa2 100644
--- a/python/pyosaf/utils/immoi/agent.py
+++ b/python/pyosaf/utils/immoi/agent.py
@@ -26,7 +26,7 @@ Supported functions:
 """
 from __future__ import print_function
 from copy import deepcopy
-from ctypes import c_char_p, c_void_p, cast, pointer
+from ctypes import c_void_p, cast, pointer
 
 from pyosaf.saAis import SaStringT, SaVersionT, SaNameT, SaSelectionObjectT, \
 eSaDispatchFlagsT, eSaAisErrorT
@@ -386,9 +386,9 @@ class OiAgent(object):
 list: List of o

Re: [devel] [PATCH 1/1] ntf: fix memleak detected by valgrind [#3220]

2020-09-17 Thread Thanh Nguyen
Hi Thuan,
ACK from me.
Regards,
Thanh

-Original Message-
From: Thuan Tran  
Sent: Thursday, 17 September 2020 2:58 PM
To: Minh Hon Chau ; Thang Duc Nguyen 
; Thanh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net; Thuan Tran 
Subject: [PATCH 1/1] ntf: fix memleak detected by valgrind [#3220]

Solution #3215 mistakenly remove free() which cause this memleak
---
 src/ntf/ntfimcnd/ntfimcn_imm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c 
index deb75a072..8d73fb35a 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -287,6 +287,7 @@ static void free_ccb_data(CcbUtilCcbData_t *ccb_data) {
if (ccb_data != NULL) {
if (ccb_data->userData != NULL) {
osaf_extended_name_free(ccb_data->userData);
+   free(ccb_data->userData);
}
ccbutil_deleteCcbData(ccb_data);
}
--
2.17.1



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


[devel] [PATCH 1/1] imm: Enhance deep clone of Imm Attr values in immutil [#3215]

2020-09-03 Thread Thanh Nguyen
1) Reuse existing functionality for deep clone of Imm Attr values.
2) Publish immutil internal memory management for external use
---
 src/amf/amfd/imm.cc|  15 ++-
 src/amf/amfd/imm.h |   8 +-
 src/ntf/ntfimcnd/ntfimcn_imm.c |  52 +
 src/ntf/ntfimcnd/ntfimcn_imm.h |  18 
 src/osaf/immutil/immutil.c | 190 -
 src/osaf/immutil/immutil.h |  46 ++--
 6 files changed, 128 insertions(+), 201 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index 826e90d41..b2a17a10c 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -206,9 +206,19 @@ done:
   return res;
 }
 
+const size_t ImmObjCreate::INIT_MEMREF_SIZE;
+
+ImmObjCreate::ImmObjCreate() :
+className_(NULL),
+parentName_(),
+attrValues_(NULL),
+memRef(NULL)
+{
+  memRef = immutil_getMem(INIT_MEMREF_SIZE);
+}
 //
 ImmObjCreate::~ImmObjCreate() {
-  immutil_freeSaImmAttrValuesT(attrValues_);
+  immutil_freeMem(memRef);
   delete[] className_;
 }
 
@@ -1862,7 +1872,8 @@ void avd_saImmOiRtObjectCreate(const std::string 
,
   ajob->className_ = StrDup(className.c_str());
   osafassert(ajob->className_ != nullptr);
   ajob->parentName_ = parentName;
-  ajob->attrValues_ = immutil_dupSaImmAttrValuesT(attrValues);
+  ajob->attrValues_ = immutil_dupSaImmAttrValuesT_array(ajob->memRef,
+  attrValues);
   Fifo::queue(ajob);
 
   TRACE_LEAVE();
diff --git a/src/amf/amfd/imm.h b/src/amf/amfd/imm.h
index 99d47d313..797d7ac82 100644
--- a/src/amf/amfd/imm.h
+++ b/src/amf/amfd/imm.h
@@ -84,12 +84,18 @@ class ImmObjCreate : public ImmJob {
   SaImmClassNameT className_;
   std::string parentName_;
   SaImmAttrValuesT_2 **attrValues_;
+  // Memory used to deep clone SaImmAttrValuesT_2**
+  // memRef must be allocated by immutil_getMem() and free by immutil_freeMem()
+  void* memRef;
 
-  ImmObjCreate() : ImmJob(){};
+  ImmObjCreate();
   bool immobj_update_required();
   AvdJobDequeueResultT exec(AVD_CL_CB *cb);
 
   ~ImmObjCreate();
+
+ private:
+  static const size_t INIT_MEMREF_SIZE = 512;
 };
 
 //
diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c
index 2e515e22b..deb75a072 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -37,9 +37,8 @@
 
 #include 
 #include 
-#include "osaf/immutil/immutil.h"
 
-#include "ntfimcn_main.h"
+#include "ntfimcn_imm.h"
 #include "ntfimcn_notifier.h"
 
 /*
@@ -288,14 +287,6 @@ static void free_ccb_data(CcbUtilCcbData_t *ccb_data) {
if (ccb_data != NULL) {
if (ccb_data->userData != NULL) {
osaf_extended_name_free(ccb_data->userData);
-   free(ccb_data->userData);
-   }
-   // Free userData in CcbUtilOperationData
-   struct CcbUtilOperationData* oper_data =
-   ccb_data->operationListHead;
-   for (; oper_data!= NULL; oper_data = oper_data->next) {
-   immutil_freeSaImmAttrValuesT((SaImmAttrValuesT_2**)
-  oper_data->userData);
}
ccbutil_deleteCcbData(ccb_data);
}
@@ -578,7 +569,8 @@ saImmOiCcbObjectModifyCallback(SaImmOiHandleT immOiHandle, 
SaImmOiCcbIdT ccbId,
struct CcbUtilOperationData *ccbOperData;
ccbOperData = ccbUtilCcbData->operationListTail;
SaImmAttrValuesT_2 **curAttr;
-   rc = get_current_attrs(objectName, attrMods, );
+   rc = immutil_getCurrentAttrs(ccbUtilCcbData->memref,
+objectName, attrMods, );
if (SA_AIS_OK == rc) {
ccbOperData->userData = curAttr;
} else {
@@ -999,41 +991,3 @@ static void finalizeImmOmHandle(SaImmHandleT immOmHandle) {
   saf_error(ais_rc));
}
 }
-
-SaAisErrorT get_current_attrs(const SaNameT *objectName,
-const SaImmAttrModificationT_2 **attrMods,
-SaImmAttrValuesT_2 ***curAttr) {
-   TRACE_ENTER();
-   SaAisErrorT rc = SA_AIS_OK;
-   // There is no new attribute modifications
-   if (attrMods == NULL) {
-   *curAttr = NULL;
-   return SA_AIS_ERR_INVALID_PARAM;
-   }
-   int len;
-   for (len = 0; attrMods[len] != NULL; ++len) ;
-   SaImmAttrNameT *attrNames = calloc((len + 1), sizeof(SaImmAttrNameT));
-   if (attrNames == NULL) {
-   *curAttr = NULL;
-   return SA_AIS_ERR_NO_MEMORY;
-   }
-   for (int i = 0; i < len; ++i) {
-   attrNames[i] = attrMods[i]->modAttr.attrName;
-   }
-   attrNames[len] = NULL;
-   // Get current attributes for the given attribute names
-   SaImmAttrValuesT_2 **resAttr;
-   rc = immutil_saImmOmAccessorGet_2(ntfimcn_cb.immAccessorHandle,
-  objectName, attrNames, );
-   if (SA_AIS_OK == rc) {
-   *curAttr = immutil_dupSaImmAttrValuesT(
- 

[devel] [PATCH 0/1] Review Request for imm: Enhance deep clone of Imm Attr values in immutil [#3215]

2020-09-03 Thread Thanh Nguyen
Summary: imm: Enhance deep clone of Imm Attr values in immutil [#3215]
Review request for Ticket(s): 3215
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3215
Base revision: bac390b84eba94284fd41845aaa0161b82cb6865
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 6314ad769499dda4b4ad125da456a86a285ecd40
Author: Thanh Nguyen 
Date:   Thu, 3 Sep 2020 15:14:48 +1000

imm: Enhance deep clone of Imm Attr values in immutil [#3215]

1) Reuse existing functionality for deep clone of Imm Attr values.
2) Publish immutil internal memory management for external use



Complete diffstat:
--
 src/amf/amfd/imm.cc|  15 +++-
 src/amf/amfd/imm.h |   8 +-
 src/ntf/ntfimcnd/ntfimcn_imm.c |  52 +--
 src/ntf/ntfimcnd/ntfimcn_imm.h |  18 
 src/osaf/immutil/immutil.c | 190 +++--
 src/osaf/immutil/immutil.h |  46 +++---
 6 files changed, 128 insertions(+), 201 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] imm: Enhance deep clone of Imm Attr values in immutil [#3215]

2020-09-01 Thread Thanh Nguyen
1) Reuse existing functionality for deep clone of Imm Attr values.
2) Publish immutil internal memory management for external use
---
 src/amf/amfd/imm.cc|  15 ++-
 src/amf/amfd/imm.h |   8 +-
 src/ntf/ntfimcnd/ntfimcn_imm.c |  50 +
 src/ntf/ntfimcnd/ntfimcn_imm.h |  18 
 src/osaf/immutil/immutil.c | 190 -
 src/osaf/immutil/immutil.h |  48 ++---
 6 files changed, 127 insertions(+), 202 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index 826e90d41..b2a17a10c 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -206,9 +206,19 @@ done:
   return res;
 }
 
+const size_t ImmObjCreate::INIT_MEMREF_SIZE;
+
+ImmObjCreate::ImmObjCreate() :
+className_(NULL),
+parentName_(),
+attrValues_(NULL),
+memRef(NULL)
+{
+  memRef = immutil_getMem(INIT_MEMREF_SIZE);
+}
 //
 ImmObjCreate::~ImmObjCreate() {
-  immutil_freeSaImmAttrValuesT(attrValues_);
+  immutil_freeMem(memRef);
   delete[] className_;
 }
 
@@ -1862,7 +1872,8 @@ void avd_saImmOiRtObjectCreate(const std::string 
,
   ajob->className_ = StrDup(className.c_str());
   osafassert(ajob->className_ != nullptr);
   ajob->parentName_ = parentName;
-  ajob->attrValues_ = immutil_dupSaImmAttrValuesT(attrValues);
+  ajob->attrValues_ = immutil_dupSaImmAttrValuesT_array(ajob->memRef,
+  attrValues);
   Fifo::queue(ajob);
 
   TRACE_LEAVE();
diff --git a/src/amf/amfd/imm.h b/src/amf/amfd/imm.h
index 99d47d313..797d7ac82 100644
--- a/src/amf/amfd/imm.h
+++ b/src/amf/amfd/imm.h
@@ -84,12 +84,18 @@ class ImmObjCreate : public ImmJob {
   SaImmClassNameT className_;
   std::string parentName_;
   SaImmAttrValuesT_2 **attrValues_;
+  // Memory used to deep clone SaImmAttrValuesT_2**
+  // memRef must be allocated by immutil_getMem() and free by immutil_freeMem()
+  void* memRef;
 
-  ImmObjCreate() : ImmJob(){};
+  ImmObjCreate();
   bool immobj_update_required();
   AvdJobDequeueResultT exec(AVD_CL_CB *cb);
 
   ~ImmObjCreate();
+
+ private:
+  static const size_t INIT_MEMREF_SIZE = 512;
 };
 
 //
diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c
index 2e515e22b..2d04a8e2b 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -37,7 +37,6 @@
 
 #include 
 #include 
-#include "osaf/immutil/immutil.h"
 
 #include "ntfimcn_main.h"
 #include "ntfimcn_notifier.h"
@@ -288,14 +287,6 @@ static void free_ccb_data(CcbUtilCcbData_t *ccb_data) {
if (ccb_data != NULL) {
if (ccb_data->userData != NULL) {
osaf_extended_name_free(ccb_data->userData);
-   free(ccb_data->userData);
-   }
-   // Free userData in CcbUtilOperationData
-   struct CcbUtilOperationData* oper_data =
-   ccb_data->operationListHead;
-   for (; oper_data!= NULL; oper_data = oper_data->next) {
-   immutil_freeSaImmAttrValuesT((SaImmAttrValuesT_2**)
-  oper_data->userData);
}
ccbutil_deleteCcbData(ccb_data);
}
@@ -578,7 +569,8 @@ saImmOiCcbObjectModifyCallback(SaImmOiHandleT immOiHandle, 
SaImmOiCcbIdT ccbId,
struct CcbUtilOperationData *ccbOperData;
ccbOperData = ccbUtilCcbData->operationListTail;
SaImmAttrValuesT_2 **curAttr;
-   rc = get_current_attrs(objectName, attrMods, );
+   rc = immutil_get_currentAttributes(ccbUtilCcbData->memref,
+objectName, attrMods, );
if (SA_AIS_OK == rc) {
ccbOperData->userData = curAttr;
} else {
@@ -999,41 +991,3 @@ static void finalizeImmOmHandle(SaImmHandleT immOmHandle) {
   saf_error(ais_rc));
}
 }
-
-SaAisErrorT get_current_attrs(const SaNameT *objectName,
-const SaImmAttrModificationT_2 **attrMods,
-SaImmAttrValuesT_2 ***curAttr) {
-   TRACE_ENTER();
-   SaAisErrorT rc = SA_AIS_OK;
-   // There is no new attribute modifications
-   if (attrMods == NULL) {
-   *curAttr = NULL;
-   return SA_AIS_ERR_INVALID_PARAM;
-   }
-   int len;
-   for (len = 0; attrMods[len] != NULL; ++len) ;
-   SaImmAttrNameT *attrNames = calloc((len + 1), sizeof(SaImmAttrNameT));
-   if (attrNames == NULL) {
-   *curAttr = NULL;
-   return SA_AIS_ERR_NO_MEMORY;
-   }
-   for (int i = 0; i < len; ++i) {
-   attrNames[i] = attrMods[i]->modAttr.attrName;
-   }
-   attrNames[len] = NULL;
-   // Get current attributes for the given attribute names
-   SaImmAttrValuesT_2 **resAttr;
-   rc = immutil_saImmOmAccessorGet_2(ntfimcn_cb.immAccessorHandle,
-  objectName, attrNames, );
-   if (SA_AIS_OK == rc) {
-   *curAttr = immutil_dupSaImmAttrValuesT(
- (const 

[devel] [PATCH 0/1] Review Request for imm: Enhance deep clone of Imm Attr values in immutil [#3215]

2020-09-01 Thread Thanh Nguyen
Summary: imm: Enhance deep clone of Imm Attr values in immutil [#3215]
Review request for Ticket(s): 3215
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3215
Base revision: bac390b84eba94284fd41845aaa0161b82cb6865
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision a6bebd1e97602654fc24c3f625d731bc71e0afb3
Author: Thanh Nguyen 
Date:   Wed, 2 Sep 2020 11:27:35 +1000

imm: Enhance deep clone of Imm Attr values in immutil [#3215]

1) Reuse existing functionality for deep clone of Imm Attr values.
2) Publish immutil internal memory management for external use



Complete diffstat:
--
 src/amf/amfd/imm.cc|  15 +++-
 src/amf/amfd/imm.h |   8 +-
 src/ntf/ntfimcnd/ntfimcn_imm.c |  50 +--
 src/ntf/ntfimcnd/ntfimcn_imm.h |  18 
 src/osaf/immutil/immutil.c | 190 +++--
 src/osaf/immutil/immutil.h |  48 ---
 6 files changed, 127 insertions(+), 202 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


Re: [devel] [PATCH 1/1] mbc: fix agent crash inside ncs_mbcsv_null_func() [#3214]

2020-08-19 Thread Thanh Nguyen
Hi Thuan,
Ack.
Regards, Thanh

-Original Message-
From: Thang Duc Nguyen  
Sent: Wednesday, 19 August 2020 5:39 PM
To: Thuan Tran ; Minh Hon Chau 
; Thanh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] mbc: fix agent crash inside ncs_mbcsv_null_func() 
[#3214]

Hi Thuan,
Ack.
No more comment from me.

B.R/Thang

-Original Message-
From: Thuan Tran  
Sent: Tuesday, August 18, 2020 10:29 AM
To: Thang Duc Nguyen ; Minh Hon Chau 
; Thanh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] mbc: fix agent crash inside ncs_mbcsv_null_func() 
[#3214]

Hi Thang,

NULL is already checked inside m_MMGR_FREE_BUFR_LIST()

Best Regards,
ThuanTr

-Original Message-
From: Thang Duc Nguyen  
Sent: Tuesday, August 18, 2020 8:40 AM
To: Thuan Tran ; Minh Hon Chau 
; Thanh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] mbc: fix agent crash inside ncs_mbcsv_null_func() 
[#3214]

Hi Thuan,

I think in ncs_mbcsv_null_func() just add a check before freeing.
e.g,
if (evt->info.peer_msg.info.client_msg.uba.ub != NULL)
m_MMGR_FREE_BUFR_LIST(
evt->info.peer_msg.info.client_msg.uba.ub);

B.R/Thang
-Original Message-
From: Thuan Tran  
Sent: Friday, August 14, 2020 1:33 PM
To: Minh Hon Chau ; Thang Duc Nguyen 
; Thanh Nguyen 
Cc: opensaf-devel@lists.sourceforge.net; Thuan Tran 
Subject: [PATCH 1/1] mbc: fix agent crash inside ncs_mbcsv_null_func() [#3214]

---
 src/mbc/mbcsv_peer.c | 8 +++-
 src/mbc/mbcsv_util.c | 5 ++---
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/mbc/mbcsv_peer.c b/src/mbc/mbcsv_peer.c index 
1a9eeb125..e81352105 100644
--- a/src/mbc/mbcsv_peer.c
+++ b/src/mbc/mbcsv_peer.c
@@ -457,7 +457,6 @@ FSM. * Then depending on its current 
role it will start FSM.
 void mbcsv_clear_multiple_active_state(CKPT_INST *ckpt)  {
PEER_INST *peer;
-   MBCSV_EVT rcvd_evt;
TRACE_ENTER();
 
/*
@@ -470,8 +469,7 @@ void mbcsv_clear_multiple_active_state(CKPT_INST *ckpt)
peer = ckpt->peer_list;
TRACE("multiple ACTIVE peers");
 
-   m_NCS_MBCSV_FSM_DISPATCH(peer, NCSMBCSV_EVENT_MULTIPLE_ACTIVE,
-_evt);
+   m_NCS_MBCSV_FSM_DISPATCH(peer, NCSMBCSV_EVENT_MULTIPLE_ACTIVE, 
NULL);
 
TRACE_LEAVE();
return;
@@ -491,12 +489,12 @@ void mbcsv_clear_multiple_active_state(CKPT_INST *ckpt)
m_NCS_MBCSV_FSM_DISPATCH(
peer,
NCSMBCSV_EVENT_STATE_TO_KEEP_STBY_SYNC,
-   _evt);
+   NULL);
else
m_NCS_MBCSV_FSM_DISPATCH(
peer,
NCSMBCSV_EVENT_STATE_TO_WAIT_FOR_CW_SYNC,
-   _evt);
+   NULL);
}
 
peer = peer->next;
diff --git a/src/mbc/mbcsv_util.c b/src/mbc/mbcsv_util.c index 
dafa268ba..9ce79243f 100644
--- a/src/mbc/mbcsv_util.c
+++ b/src/mbc/mbcsv_util.c
@@ -409,8 +409,7 @@ uint32_t 
mbcsv_send_ckpt_data_to_all_peers(NCS_MBCSV_SEND_CKPT *msg_to_send,
continue;
}
TRACE("dispatching FSM for NCSMBCSV_SEND_ASYNC_UPDATE");
-   m_NCS_MBCSV_FSM_DISPATCH(peer_ptr, NCSMBCSV_SEND_ASYNC_UPDATE,
-_msg);
+   m_NCS_MBCSV_FSM_DISPATCH(peer_ptr, NCSMBCSV_SEND_ASYNC_UPDATE, 
NULL);
 
if (false == peer_ptr->okay_to_async_updt) {
peer_ptr->ckpt_msg_sent = true;
@@ -471,7 +470,7 @@ uint32_t 
mbcsv_send_ckpt_data_to_all_peers(NCS_MBCSV_SEND_CKPT *msg_to_send,
while (NULL != tmp_ptr) {
TRACE("dispatching FSM for NCSMBCSV_SEND_ASYNC_UPDATE");
m_NCS_MBCSV_FSM_DISPATCH(
-   tmp_ptr, NCSMBCSV_SEND_ASYNC_UPDATE, _msg);
+   tmp_ptr, NCSMBCSV_SEND_ASYNC_UPDATE, NULL);
 
if (false == tmp_ptr->okay_to_async_updt) {
tmp_ptr->ckpt_msg_sent = true;
--
2.17.1



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


Re: [devel] [PATCH 1/1] osaf: move common functions into immutil [#3211]

2020-08-16 Thread Thanh Nguyen
Hi Thuan,

ACK from me.

As we discussed, this is followed up with a ticket to use internal memory 
management.
Best Regards,
Thanh

-Original Message-
From: Thuan Tran  
Sent: Monday, 17 August 2020 1:40 PM
To: Thanh Nguyen ; Thang Duc Nguyen 
; Minh Hon Chau 
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [PATCH 1/1] osaf: move common functions into immutil [#3211]

Hi Thanh,

Here is V2 patch.

Best Regards,
ThuanTr

-Original Message-
From: Thuan Tran 
Sent: Tuesday, August 11, 2020 1:08 PM
To: Thanh Nguyen ; Thang Duc Nguyen 
; Minh Hon Chau 
Cc: opensaf-devel@lists.sourceforge.net; Thuan Tran 
Subject: [PATCH 1/1] osaf: move common functions into immutil [#3211]

---
 src/amf/amfd/imm.cc | 187 ++--
 src/amf/amfd/imm.h  |   2 +-
 src/ntf/ntfimcnd/ntfimcn_imm.c  | 181 +--
 src/ntf/ntfimcnd/ntfimcn_imm.h  |  30 +---
 src/ntf/ntfimcnd/ntfimcn_notifier.c |   2 +-
 src/osaf/immutil/immutil.c  | 215 +++-
 src/osaf/immutil/immutil.h  |  36 +
 7 files changed, 263 insertions(+), 390 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc index 
d917b0d8b..826e90d41 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -178,7 +178,7 @@ AvdJobDequeueResultT ImmObjCreate::exec(AVD_CL_CB *cb) {
 goto done;
   }
   rc = saImmOiRtObjectCreate_2(immOiHandle, className_, parent_name,
-   attrValues_);
+   (const 
+ SaImmAttrValuesT_2**)attrValues_);
   cb->avd_imm_status = AVD_IMM_INIT_DONE;
 
   if ((rc == SA_AIS_OK) || (rc == SA_AIS_ERR_EXIST)) { @@ -208,31 +208,8 @@ 
done:
 
 //
 ImmObjCreate::~ImmObjCreate() {
-  unsigned int i, j;
-
-  for (i = 0; attrValues_[i] != nullptr; i++) {
-SaImmAttrValuesT_2 *attrValue = (SaImmAttrValuesT_2 *)attrValues_[i];
-
-if (attrValue->attrValueType == SA_IMM_ATTR_SASTRINGT) {
-  for (j = 0; j < attrValue->attrValuesNumber; j++) {
-char *p = *((char **)attrValue->attrValues[j]);
-delete[] p;
-  }
-} else if (attrValue->attrValueType == SA_IMM_ATTR_SANAMET) {
-  for (j = 0; j < attrValue->attrValuesNumber; j++) {
-SaNameT *name = reinterpret_cast(attrValue->attrValues[i]);
-osaf_extended_name_free(name);
-  }
-}
-delete[] attrValue->attrName;
-delete[] static_cast(
-attrValue->attrValues[0]);  // free blob shared by all values
-delete[] attrValue->attrValues;
-delete attrValue;
-  }
-
+  immutil_freeSaImmAttrValuesT(attrValues_);
   delete[] className_;
-  delete[] attrValues_;
 }
 
 //
@@ -630,110 +607,18 @@ typedef struct avd_ccb_apply_ordered_list {
 
 static AvdCcbApplyOrderedListT *ccb_apply_list;
 
-/* 
- *   FUNCTION PROTOTYPES
- * 
- */
-
-static size_t value_size(SaImmValueTypeT attrValueType) {
-  size_t valueSize = 0;
-
-  switch (attrValueType) {
-case SA_IMM_ATTR_SAINT32T:
-  valueSize = sizeof(SaInt32T);
-  break;
-case SA_IMM_ATTR_SAUINT32T:
-  valueSize = sizeof(SaUint32T);
-  break;
-case SA_IMM_ATTR_SAINT64T:
-  valueSize = sizeof(SaInt64T);
-  break;
-case SA_IMM_ATTR_SAUINT64T:
-  valueSize = sizeof(SaUint64T);
-  break;
-case SA_IMM_ATTR_SATIMET:
-  valueSize = sizeof(SaTimeT);
-  break;
-case SA_IMM_ATTR_SANAMET:
-  valueSize = sizeof(SaNameT);
-  break;
-case SA_IMM_ATTR_SAFLOATT:
-  valueSize = sizeof(SaFloatT);
-  break;
-case SA_IMM_ATTR_SADOUBLET:
-  valueSize = sizeof(SaDoubleT);
-  break;
-case SA_IMM_ATTR_SASTRINGT:
-  valueSize = sizeof(SaStringT);
-  break;
-case SA_IMM_ATTR_SAANYT:
-  osafassert(0);
-  break;
-  }
-
-  return valueSize;
-}
-
-static void copySaImmAttrValuesT(SaImmAttrValuesT_2 *copy,
- const SaImmAttrValuesT_2 *original) {
-  size_t valueSize = 0;
-  unsigned int i, valueCount = original->attrValuesNumber;
-  char *databuffer;
-
-  copy->attrName = StrDup(original->attrName);
-
-  copy->attrValuesNumber = valueCount;
-  copy->attrValueType = original->attrValueType;
-  if (valueCount == 0) return; /* (just in case...) */
-
-  copy->attrValues = new SaImmAttrValueT[valueCount];
-
-  valueSize = value_size(original->attrValueType);
-
-  // alloc blob shared by all values
-  databuffer = new char[valueCount * valueSize];
-
-  for (i = 0; i < valueCount; i++) {
-copy->attrValues[i] = databuffer;
-if (original->attrValueType == SA_IMM_ATTR_SASTRINGT) {
-  char *cporig = *((char **)original->attrValues[i]);
-  char **cpp = (char **)databuffer;
-  *cpp = StrDup(cporig);
-} else if (original->attrValueType == SA_IMM_ATTR_SANAMET) {
-

Re: [devel] [PATCH 1/1] mbc: fix memleak detected by valgrind [#3208]

2020-08-11 Thread Thanh Nguyen
Hi Thuan,
ACK from me.
Regards, Thanh

-Original Message-
From: Thuan Tran  
Sent: Monday, 10 August 2020 6:14 PM
To: Minh Hon Chau ; Thang Duc Nguyen 
; Thanh Nguyen ; 
Thien Minh Huynh 
Cc: opensaf-devel@lists.sourceforge.net; Thuan Tran 
Subject: [PATCH 1/1] mbc: fix memleak detected by valgrind [#3208]

---
 src/mbc/mbcsv_act.c |  5 +
 src/mbc/mbcsv_evt_msg.h |  1 +
 src/mbc/mbcsv_mds.c | 15 ---
 src/mbc/mbcsv_pr_evts.c |  3 ++-
 src/mbc/mbcsv_queue.c   | 13 +
 src/mbc/mbcsv_util.c| 23 +++
 6 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/src/mbc/mbcsv_act.c b/src/mbc/mbcsv_act.c index 
d58f502d2..ae0e8e539 100644
--- a/src/mbc/mbcsv_act.c
+++ b/src/mbc/mbcsv_act.c
@@ -77,6 +77,11 @@ void ncs_mbcsv_null_func(PEER_INST *peer, MBCSV_EVT *evt)
  peer->my_ckpt_inst->my_role,
  peer->my_ckpt_inst->my_mbcsv_inst->svc_id,
  peer->my_ckpt_inst->pwe_hdl);
+   if ((evt) && (evt->msg_type == MBCSV_EVT_INTERNAL_RCV) &&
+   (evt->info.peer_msg.type == MBCSV_EVT_INTERNAL_CLIENT)) {
+   m_MMGR_FREE_BUFR_LIST(
+   evt->info.peer_msg.info.client_msg.uba.ub);
+   }
 }
 
 /*
diff --git a/src/mbc/mbcsv_evt_msg.h b/src/mbc/mbcsv_evt_msg.h index 
9eef74713..b9addb3a4 100644
--- a/src/mbc/mbcsv_evt_msg.h
+++ b/src/mbc/mbcsv_evt_msg.h
@@ -49,6 +49,7 @@ typedef enum {
   MBCSV_EVT_MDS_SUBSCR,
   MBCSV_EVT_TMR,
   MBCSV_EVT_INTERNAL,
+  MBCSV_EVT_INTERNAL_RCV,
 } MBCSV_EVT_TYPE;
 
 typedef struct mbcsv_evt_tmr_info {
diff --git a/src/mbc/mbcsv_mds.c b/src/mbc/mbcsv_mds.c index 
964e33542..afaf1fd1b 100644
--- a/src/mbc/mbcsv_mds.c
+++ b/src/mbc/mbcsv_mds.c
@@ -193,6 +193,7 @@ void mbcsv_mds_unreg(uint32_t pwe_hdl)  uint32_t 
mbcsv_mds_send_msg(uint32_t send_type, MBCSV_EVT *msg, CKPT_INST *ckpt,
MBCSV_ANCHOR anchor)
 {
+   uint32_t rc;
NCSMDS_INFO mds_info;
TRACE_ENTER2("sending to vdest:%" PRIx64, ckpt->my_vdest);
 
@@ -241,7 +242,7 @@ uint32_t mbcsv_mds_send_msg(uint32_t send_type, MBCSV_EVT 
*msg, CKPT_INST *ckpt,
return NCSCC_RC_FAILURE;
}
 
-   if (ncsmds_api(_info) == NCSCC_RC_SUCCESS) {
+   if ((rc = ncsmds_api(_info)) == NCSCC_RC_SUCCESS) {
/* If message is send resp  then free the message received in
 * response  */
if ((MDS_SENDTYPE_REDRSP == send_type) && @@ -253,7 +254,7 @@ 
uint32_t mbcsv_mds_send_msg(uint32_t send_type, MBCSV_EVT *msg, CKPT_INST *ckpt,
return NCSCC_RC_SUCCESS;
} else {
TRACE_LEAVE2("failure");
-   return NCSCC_RC_FAILURE;
+   return rc;
}
 }
 
@@ -379,7 +380,7 @@ uint32_t mbcsv_mds_rcv(NCSMDS_CALLBACK_INFO *cbinfo)
 * We found out the mailbox to which we can post a message. Now
 * construct and send this message to the mailbox.
 */
-   msg->msg_type = MBCSV_EVT_INTERNAL;
+   msg->msg_type = MBCSV_EVT_INTERNAL_RCV;
 
if (msg->info.peer_msg.type == MBCSV_EVT_INTERNAL_PEER_DISC) {
send_pri = NCS_IPC_PRIORITY_HIGH;
@@ -387,11 +388,19 @@ uint32_t mbcsv_mds_rcv(NCSMDS_CALLBACK_INFO *cbinfo)
send_pri = NCS_IPC_PRIORITY_NORMAL;
 
if (NCSCC_RC_SUCCESS != m_MBCSV_SND_MSG(, msg, send_pri)) {
+   if (msg->info.peer_msg.type == 
MBCSV_EVT_INTERNAL_CLIENT) {
+   m_MMGR_FREE_BUFR_LIST(
+   msg->info.peer_msg.info.client_msg.uba.ub);
+   }
m_MMGR_FREE_MBCSV_EVT(msg);
TRACE_LEAVE2("ipc send failed");
return NCSCC_RC_FAILURE;
}
} else {
+   if (msg->info.peer_msg.type == MBCSV_EVT_INTERNAL_CLIENT) {
+   m_MMGR_FREE_BUFR_LIST(
+   msg->info.peer_msg.info.client_msg.uba.ub);
+   }
m_MMGR_FREE_MBCSV_EVT(msg);
}
 
diff --git a/src/mbc/mbcsv_pr_evts.c b/src/mbc/mbcsv_pr_evts.c index 
0deb5f25b..72dce61b5 100644
--- a/src/mbc/mbcsv_pr_evts.c
+++ b/src/mbc/mbcsv_pr_evts.c
@@ -147,7 +147,8 @@ uint32_t mbcsv_process_events(MBCSV_EVT *rcvd_evt, uint32_t 
mbcsv_hdl)
goto pr_done;
}
} break;
-   case MBCSV_EVT_INTERNAL: {
+   case MBCSV_EVT_INTERNAL:
+   case MBCSV_EVT_INTERNAL_RCV: {
/*
 * Process all the received events.
 */
diff --git a/src/mbc/mbcsv_queue.c b/src/mbc/mbcsv_queue.c index 
c0a41fce0..25ae13f5f 100644
--- a/src/mbc/mbcsv

[devel] [PATCH 1/1] ntf: Update README for NTF notification enhancement [#3201]

2020-07-16 Thread Thanh Nguyen
The README file is update to reflect the implementation
in [#3169] and [#3200]
---
 src/ntf/ntfimcnd/README | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/ntf/ntfimcnd/README b/src/ntf/ntfimcnd/README
index 2809e7eb9..507e57071 100644
--- a/src/ntf/ntfimcnd/README
+++ b/src/ntf/ntfimcnd/README
@@ -2,6 +2,7 @@
 #  -*- OpenSAF  -*-
 #
 # (C) Copyright 2013 The OpenSAF Foundation
+# Copyright Ericsson AB 2020 - All Rights Reserved.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -31,6 +32,12 @@ If Runtime data the notification(s) are sent when the first 
callback is
 invoked. No more callbacks will be invoked.
 If Config data the CCB data is saved and notification(s) are sent when the
 Apply callback is invoked.
+The old attribute values are fetched from IMM, if exists, are included in
+notifications. For multiple value attributes, if the number of old attributes
+values is greater than the number of new attribute values, the old attribute
+values will not be included in notification.
+This has the advantage of avoiding the ambiguity that otherwise would publish
+some old attribute values but not all.
 For more information about the special applier see README files in immsv.
 
 Code
-- 
2.25.0



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


[devel] [PATCH 0/1] Review Request for ntf: Update README for NTF notification enhancement [#3201]

2020-07-16 Thread Thanh Nguyen
Summary: ntf: Update README for NTF notification enhancement [#3201]
Review request for Ticket(s): 3201
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3201
Base revision: 581b6b2e8d466c7ee5759b6893e83065459d36ba
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision b77ab1b842c2e37f2699605dc0416a02e9f7a08b
Author: Thanh Nguyen 
Date:   Fri, 17 Jul 2020 09:52:04 +1000

ntf: Update README for NTF notification enhancement [#3201]

The README file is update to reflect the implementation
in [#3169] and [#3200]



Complete diffstat:
--
 src/ntf/ntfimcnd/README | 7 +++
 1 file changed, 7 insertions(+)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 0/1] Review Request for ntf: Handle IMM multiple value attribute in notification [#3200]

2020-07-16 Thread Thanh Nguyen
Summary: ntf: Handle IMM multiple value attribute in notification [#3200]
Review request for Ticket(s): 3200
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3200
Base revision: 581b6b2e8d466c7ee5759b6893e83065459d36ba
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 8531981f36b5474f1b189e753bbbc9ab3a1f27dd
Author: Thanh Nguyen 
Date:   Thu, 16 Jul 2020 18:49:42 +1000

ntf: Handle IMM multiple value attribute in notification [#3200]

When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
ntfimcn also fetches the old attribute values, corresponding to
the changed attribute values, if exist in IMM, and include the old
attribute values in notification data.

1) With this enahanement, for IMM atrribute with multiple values,
if the number of old attribute values is greater than the number
of new attribute values, the old attribute values will not be
published in the notification data
2) ntftest suite is update



Complete diffstat:
--
 src/ntf/apitest/test_ntf_imcn.cc| 72 ++---
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 12 +--
 2 files changed, 37 insertions(+), 47 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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

[devel] [PATCH 1/1] ntf: Handle IMM multiple value attribute in notification [#3200]

2020-07-16 Thread Thanh Nguyen
When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
ntfimcn also fetches the old attribute values, corresponding to
the changed attribute values, if exist in IMM, and include the old
attribute values in notification data.

1) With this enahanement, for IMM atrribute with multiple values,
if the number of old attribute values is greater than the number
of new attribute values, the old attribute values will not be
published in the notification data
2) ntftest suite is update
---
 src/ntf/apitest/test_ntf_imcn.cc| 72 +++--
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 12 -
 2 files changed, 37 insertions(+), 47 deletions(-)

diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 0443491a9..082f69c46 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -61,6 +61,19 @@ static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
 #define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
 
+/*
+ *  Ticket-3200
+ *  For IMM attributes with multiple values, if the number old attribute
+ *  values is greater than the number of new attribute values the old values
+ *  are not included in the notification data
+ *  The following test cases are changed, not to expect old attribute values
+ *  objectModifyTest_33
+ *  objectModifyTest_34
+ *  objectModifyTest_36
+ *  objectMultiCcbTest_38
+ *  objectMultiCcbTest_39
+ *
+ */
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -4400,9 +4413,7 @@ void objectModifyTest_33(void) {
 
   /* modify an object */
   SaStringT svar = STRINGVAR3;
-  SaStringT svarOld = STRINGVAR1;
   SaDoubleT dvar = DOUBLEVAR3;
-  SaDoubleT dvarOld = DOUBLEVAR1;
   snprintf(command, MAX_DATA,
 "immcfg -t 20 -a testStringCfg=%s -a testDoubleCfg=%lf %s",
 svar, dvar, DNTESTCFG);
@@ -,12 +4455,9 @@ void objectModifyTest_33(void) {
 SaUint32T ccbLast = 1;
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
-safassert(set_attr_change_str(_exp, 4, 4, svar,
-SA_TRUE, svarOld), SA_AIS_OK);
+safassert(set_attr_change_str(_exp, 4, 4, svar), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 5, 5,
- SA_NTF_VALUE_DOUBLE, , SA_TRUE, ),
-SA_AIS_OK);
-
+ SA_NTF_VALUE_DOUBLE, ), SA_AIS_OK);
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
   print_notif(_notif_data);
@@ -4478,7 +4486,6 @@ void objectModifyTest_34(void) {
 
   /* modify an object */
   SaTimeT tvar = TIMEVAR3;
-  SaTimeT tvarOld = TIMEVAR1;
   snprintf(command, MAX_DATA, "immcfg -t 20 -a testTimeCfg=%lld %s",
(SaInt64T)tvar,  DNTESTCFG);
   assert(system(command) != -1);
@@ -4517,8 +4524,7 @@ void objectModifyTest_34(void) {
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 4, 4,
- SA_NTF_VALUE_INT64, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT64, ), SA_AIS_OK);
 
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
@@ -4680,14 +4686,11 @@ void objectModifyTest_36(void) {
 SaUint32T ccbLast = 1;
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
-safassert(set_attr_change_str(_exp, 4, 4, soldvar, SA_TRUE, soldvar),
-SA_AIS_OK);
+safassert(set_attr_change_str(_exp, 4, 4, soldvar), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 5, 5,
- SA_NTF_VALUE_INT32, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT32, ), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 6, 5,
- SA_NTF_VALUE_INT32, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT32, ), SA_AIS_OK);
 
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
@@ -4917,12 +4920,8 @@ void objectMultiCcbTest_38(void) {
   /* modify an object */
   SaUint32T var1 = 32000;
   SaInt32T var2 = -32000;
-  SaUint32T var1old = UINT32VAR2;
-  SaInt32T var2old = INT32VAR1;
   SaUint64T var3 = 64000;
   SaInt64T var4 = -64000;
-  SaUint64T var3old = UINT64VAR1;
-  SaInt64T var4old = INT64VAR1;
   SaImmHandleT omHandle = 0;
   SaImmAdminOwnerHandleT ownerHandle = 0;
   SaImmCcbHandleT immCcbHandle = 0;
@@ -5034,15 +5033,10 @@ void objectMultiCcbTest_38(void) {
   safassert(set_attr_change_scalar(_exp, 3, 3,
SA_NTF_VALUE_UINT32,
), SA_AIS_OK);
-
   safassert(set_attr_change_scalar(
-  _exp, 4, 4, SA_NTF_VALUE_UINT32, , SA_TRUE,
-  reinterpret_cast()),
-  SA_AIS_OK);
- safassert(set_attr_change_scalar(
-  _exp, 5, 5, SA_NTF_VALUE_INT32, , SA_TRUE,
-  reinterpret_cast()),
-  SA_AIS_OK);
+  _exp, 4, 4, SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
+  safassert(set_attr_change_scalar(
+ 

[devel] [PATCH 0/1] Review Request for ntf: Update README for NTF notification enhancement [#3201]

2020-07-15 Thread Thanh Nguyen
Summary: ntf: Update README for NTF notification enhancement [#3201]
Review request for Ticket(s): 3201
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3201
Base revision: 581b6b2e8d466c7ee5759b6893e83065459d36ba
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision f62824a37455117f5ff1eb36fa0e19d78b993f03
Author: Thanh Nguyen 
Date:   Thu, 16 Jul 2020 14:22:31 +1000

ntf: Update README for NTF notification enhancement [#3201]

The README file is update to reflect the implementation
in [#3169] and [#3200]



Complete diffstat:
--
 src/ntf/ntfimcnd/README | 6 ++
 1 file changed, 6 insertions(+)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] ntf: Update README for NTF notification enhancement [#3201]

2020-07-15 Thread Thanh Nguyen
The README file is update to reflect the implementation
in [#3169] and [#3200]
---
 src/ntf/ntfimcnd/README | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/ntf/ntfimcnd/README b/src/ntf/ntfimcnd/README
index 2809e7eb9..cf0619979 100644
--- a/src/ntf/ntfimcnd/README
+++ b/src/ntf/ntfimcnd/README
@@ -31,6 +31,12 @@ If Runtime data the notification(s) are sent when the first 
callback is
 invoked. No more callbacks will be invoked.
 If Config data the CCB data is saved and notification(s) are sent when the
 Apply callback is invoked.
+The old attribute values are fetched from IMM if exists and included in
+notifications. For multiple value attributes, if the number of old attribute
+values is greater than the number of new attribute values, the old attribute
+values will not be included in notification.
+This has the advantage of avoiding the ambiguity that otherwise would publish
+some old attribute values but not all.
 For more information about the special applier see README files in immsv.
 
 Code
-- 
2.25.0



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


Re: [devel] [PATCH 1/1] ntf: Handle IMM multiple value attribute in notification [#3200]

2020-07-15 Thread Thanh Nguyen
Thx Minh,

When it gets ACKs from others, please help to merge.
In the mean time, I will update the MR with pro/cons. This kind of discussion 
will also go to read me file.
Cheers,
Thanh

-Original Message-
From: Minh Hon Chau  
Sent: Wednesday, 15 July 2020 10:29 PM
To: Thanh Nguyen ; Thang Duc Nguyen 
; Thuan Tran 
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] ntf: Handle IMM multiple value attribute in 
notification [#3200]

Hi aThanh,

Ack from me.

I guess we will document the README with this change to mention the pros/cons 
of either not to fill any old values or just to fill some of them, so that the 
reason of this change can be clarified?

Thanks

Minh

On 14/7/20 10:57 am, Thanh Nguyen wrote:
> When IMM changes an attribute with NOTIFY flag, ntfimcn currently 
> sends the changed attribute values in notification data.
> ntfimcn also fetches the old attribute values, corresponding to the 
> changed attribute values, if exist in IMM, and include the old 
> attribute values in notification data.
>
> 1) With this enahanement, for IMM atrribute with multiple values, if 
> the number of old attribute values is greater than the number of new 
> attribute values, the old attribute values will not be published in 
> the notification data
> 2) ntftest suite is update
> ---
>   src/ntf/apitest/test_ntf_imcn.cc| 72 +++--
>   src/ntf/ntfimcnd/ntfimcn_notifier.c | 13 +-
>   2 files changed, 38 insertions(+), 47 deletions(-)
>
> diff --git a/src/ntf/apitest/test_ntf_imcn.cc 
> b/src/ntf/apitest/test_ntf_imcn.cc
> index 0443491a9..082f69c46 100644
> --- a/src/ntf/apitest/test_ntf_imcn.cc
> +++ b/src/ntf/apitest/test_ntf_imcn.cc
> @@ -61,6 +61,19 @@ static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
>   
>   #define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
>   
> +/*
> + *  Ticket-3200
> + *  For IMM attributes with multiple values, if the number old 
> +attribute
> + *  values is greater than the number of new attribute values the old 
> +values
> + *  are not included in the notification data
> + *  The following test cases are changed, not to expect old attribute 
> +values
> + *  objectModifyTest_33
> + *  objectModifyTest_34
> + *  objectModifyTest_36
> + *  objectMultiCcbTest_38
> + *  objectMultiCcbTest_39
> + *
> + */
>   /**
>* Callback routine, called when subscribed notification arrives.
>*/
> @@ -4400,9 +4413,7 @@ void objectModifyTest_33(void) {
>   
> /* modify an object */
> SaStringT svar = STRINGVAR3;
> -  SaStringT svarOld = STRINGVAR1;
> SaDoubleT dvar = DOUBLEVAR3;
> -  SaDoubleT dvarOld = DOUBLEVAR1;
> snprintf(command, MAX_DATA,
>   "immcfg -t 20 -a testStringCfg=%s -a testDoubleCfg=%lf %s",
>   svar, dvar, DNTESTCFG);
> @@ -,12 +4455,9 @@ void objectModifyTest_33(void) {
>   SaUint32T ccbLast = 1;
>   safassert(set_attr_change_scalar(_exp, 3, 3,
>SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
> -safassert(set_attr_change_str(_exp, 4, 4, svar,
> -SA_TRUE, svarOld), SA_AIS_OK);
> +safassert(set_attr_change_str(_exp, 4, 4, svar), SA_AIS_OK);
>   safassert(set_attr_change_scalar(_exp, 5, 5,
> - SA_NTF_VALUE_DOUBLE, , SA_TRUE, ),
> -SA_AIS_OK);
> -
> + SA_NTF_VALUE_DOUBLE, ), SA_AIS_OK);
>   if (!compare_notifs(_exp, _notif_data)) {
> print_notif(_exp);
> print_notif(_notif_data);
> @@ -4478,7 +4486,6 @@ void objectModifyTest_34(void) {
>   
> /* modify an object */
> SaTimeT tvar = TIMEVAR3;
> -  SaTimeT tvarOld = TIMEVAR1;
> snprintf(command, MAX_DATA, "immcfg -t 20 -a testTimeCfg=%lld %s",
>  (SaInt64T)tvar,  DNTESTCFG);
> assert(system(command) != -1);
> @@ -4517,8 +4524,7 @@ void objectModifyTest_34(void) {
>   safassert(set_attr_change_scalar(_exp, 3, 3,
>SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
>   safassert(set_attr_change_scalar(_exp, 4, 4,
> - SA_NTF_VALUE_INT64, , SA_TRUE, ),
> -SA_AIS_OK);
> + SA_NTF_VALUE_INT64, ), SA_AIS_OK);
>   
>   if (!compare_notifs(_exp, _notif_data)) {
> print_notif(_exp);
> @@ -4680,14 +4686,11 @@ void objectModifyTest_36(void) {
>   SaUint32T ccbLast = 1;
>   safassert(set_attr_change_scalar(_exp, 3, 3,
>SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
> -safassert(set_attr_change_str(_exp, 4, 4, soldvar, SA_TRUE, soldvar),
> -SA_AIS_OK);
> +safassert(set_attr_change_str(_exp, 4, 4, soldvar), SA_AIS_OK);
>   safassert(set_attr_change_scalar(_exp, 5, 5,
> - SA_NTF_VALUE_INT32, , SA_TRUE, ),
> -SA_AIS_OK);
> + SA_NTF_VALU

[devel] [PATCH 1/1] ntf: Handle IMM multiple value attribute in notification [#3200]

2020-07-13 Thread Thanh Nguyen
When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
ntfimcn also fetches the old attribute values, corresponding to
the changed attribute values, if exist in IMM, and include the old
attribute values in notification data.

1) With this enahanement, for IMM atrribute with multiple values,
if the number of old attribute values is greater than the number
of new attribute values, the old attribute values will not be
published in the notification data
2) ntftest suite is update
---
 src/ntf/apitest/test_ntf_imcn.cc| 72 +++--
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 13 +-
 2 files changed, 38 insertions(+), 47 deletions(-)

diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 0443491a9..082f69c46 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -61,6 +61,19 @@ static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
 #define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
 
+/*
+ *  Ticket-3200
+ *  For IMM attributes with multiple values, if the number old attribute
+ *  values is greater than the number of new attribute values the old values
+ *  are not included in the notification data
+ *  The following test cases are changed, not to expect old attribute values
+ *  objectModifyTest_33
+ *  objectModifyTest_34
+ *  objectModifyTest_36
+ *  objectMultiCcbTest_38
+ *  objectMultiCcbTest_39
+ *
+ */
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -4400,9 +4413,7 @@ void objectModifyTest_33(void) {
 
   /* modify an object */
   SaStringT svar = STRINGVAR3;
-  SaStringT svarOld = STRINGVAR1;
   SaDoubleT dvar = DOUBLEVAR3;
-  SaDoubleT dvarOld = DOUBLEVAR1;
   snprintf(command, MAX_DATA,
 "immcfg -t 20 -a testStringCfg=%s -a testDoubleCfg=%lf %s",
 svar, dvar, DNTESTCFG);
@@ -,12 +4455,9 @@ void objectModifyTest_33(void) {
 SaUint32T ccbLast = 1;
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
-safassert(set_attr_change_str(_exp, 4, 4, svar,
-SA_TRUE, svarOld), SA_AIS_OK);
+safassert(set_attr_change_str(_exp, 4, 4, svar), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 5, 5,
- SA_NTF_VALUE_DOUBLE, , SA_TRUE, ),
-SA_AIS_OK);
-
+ SA_NTF_VALUE_DOUBLE, ), SA_AIS_OK);
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
   print_notif(_notif_data);
@@ -4478,7 +4486,6 @@ void objectModifyTest_34(void) {
 
   /* modify an object */
   SaTimeT tvar = TIMEVAR3;
-  SaTimeT tvarOld = TIMEVAR1;
   snprintf(command, MAX_DATA, "immcfg -t 20 -a testTimeCfg=%lld %s",
(SaInt64T)tvar,  DNTESTCFG);
   assert(system(command) != -1);
@@ -4517,8 +4524,7 @@ void objectModifyTest_34(void) {
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 4, 4,
- SA_NTF_VALUE_INT64, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT64, ), SA_AIS_OK);
 
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
@@ -4680,14 +4686,11 @@ void objectModifyTest_36(void) {
 SaUint32T ccbLast = 1;
 safassert(set_attr_change_scalar(_exp, 3, 3,
  SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
-safassert(set_attr_change_str(_exp, 4, 4, soldvar, SA_TRUE, soldvar),
-SA_AIS_OK);
+safassert(set_attr_change_str(_exp, 4, 4, soldvar), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 5, 5,
- SA_NTF_VALUE_INT32, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT32, ), SA_AIS_OK);
 safassert(set_attr_change_scalar(_exp, 6, 5,
- SA_NTF_VALUE_INT32, , SA_TRUE, ),
-SA_AIS_OK);
+ SA_NTF_VALUE_INT32, ), SA_AIS_OK);
 
 if (!compare_notifs(_exp, _notif_data)) {
   print_notif(_exp);
@@ -4917,12 +4920,8 @@ void objectMultiCcbTest_38(void) {
   /* modify an object */
   SaUint32T var1 = 32000;
   SaInt32T var2 = -32000;
-  SaUint32T var1old = UINT32VAR2;
-  SaInt32T var2old = INT32VAR1;
   SaUint64T var3 = 64000;
   SaInt64T var4 = -64000;
-  SaUint64T var3old = UINT64VAR1;
-  SaInt64T var4old = INT64VAR1;
   SaImmHandleT omHandle = 0;
   SaImmAdminOwnerHandleT ownerHandle = 0;
   SaImmCcbHandleT immCcbHandle = 0;
@@ -5034,15 +5033,10 @@ void objectMultiCcbTest_38(void) {
   safassert(set_attr_change_scalar(_exp, 3, 3,
SA_NTF_VALUE_UINT32,
), SA_AIS_OK);
-
   safassert(set_attr_change_scalar(
-  _exp, 4, 4, SA_NTF_VALUE_UINT32, , SA_TRUE,
-  reinterpret_cast()),
-  SA_AIS_OK);
- safassert(set_attr_change_scalar(
-  _exp, 5, 5, SA_NTF_VALUE_INT32, , SA_TRUE,
-  reinterpret_cast()),
-  SA_AIS_OK);
+  _exp, 4, 4, SA_NTF_VALUE_UINT32, ), SA_AIS_OK);
+  safassert(set_attr_change_scalar(

[devel] [PATCH 0/1] Review Request for ntf: Handle IMM multiple value attribute in notification [#3200]

2020-07-13 Thread Thanh Nguyen
Summary: ntf: Handle IMM multiple value attribute in notification [#3200]
Review request for Ticket(s): 3200
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3200
Base revision: 693b8ad847a34e0f2ecfbf1390444d81892d87a3
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 4d0de8b21ce4033ace884c116089f8187f06ac53
Author: Thanh Nguyen 
Date:   Tue, 14 Jul 2020 10:44:26 +1000

ntf: Handle IMM multiple value attribute in notification [#3200]

When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
ntfimcn also fetches the old attribute values, corresponding to
the changed attribute values, if exist in IMM, and include the old
attribute values in notification data.

1) With this enahanement, for IMM atrribute with multiple values,
if the number of old attribute values is greater than the number
of new attribute values, the old attribute values will not be
published in the notification data
2) ntftest suite is update



Complete diffstat:
--
 src/ntf/apitest/test_ntf_imcn.cc| 72 ++---
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 13 +--
 2 files changed, 38 insertions(+), 47 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-07-10 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: b0086e3c5da87fad844e76c8c648f6dc6e7ae73a
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 991fbfd4fce0d400cf5bfb92af55fa2d4948d882
Author: Thanh Nguyen 
Date:   Fri, 10 Jul 2020 16:09:33 +1000

ntf: Enhance attribute change notification [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Complete diffstat:
--
 src/ntf/apitest/test_ntf_imcn.cc| 1100 ---
 src/ntf/apitest/tet_ntf_common.cc   |   83 +++
 src/ntf/apitest/tet_ntf_common.h|3 +
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  244 +++-
 src/ntf/ntfimcnd/ntfimcn_imm.h  |   44 ++
 src/ntf/ntfimcnd/ntfimcn_main.h |3 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |   44 +-
 7 files changed, 1060 insertions(+), 461 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-07-10 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/apitest/test_ntf_imcn.cc| 1100 ---
 src/ntf/apitest/tet_ntf_common.cc   |   83 ++
 src/ntf/apitest/tet_ntf_common.h|3 +
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  244 +-
 src/ntf/ntfimcnd/ntfimcn_imm.h  |   44 ++
 src/ntf/ntfimcnd/ntfimcn_main.h |3 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |   44 +-
 7 files changed, 1060 insertions(+), 461 deletions(-)

diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..0443491a9 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -1,6 +1,7 @@
 /*  -*- OpenSAF  -*-
  *
  * (C) Copyright 2013 The OpenSAF Foundation
+ * Copyright Ericsson AB 2020 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -24,10 +25,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include "base/time.h"
 #include "osaf/immutil/immutil.h"
 #include "osaf/apitest/util.h"
@@ -55,6 +59,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +174,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  printf("Num possible old attributes: %d\n", numAttributes);
+  for (int i = 0; i < numAttributes; ++i) {
+if (attrChange[i].oldAttributePresent == SA_FALSE) {
+  printf("[%d]: Old Attribute not present\n", i);
+  continue;
+}
+print_notification_attr(nHandle,
+attrChange[i].attributeId,
+attrChange[i].attributeType,
+[i].oldAttributeValue, i);
+  }
+}
+

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification V2 [#3196]

2020-07-08 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification V2 [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: b0086e3c5da87fad844e76c8c648f6dc6e7ae73a
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision e7930bf61e3f54fa829f018ab069ee4918cc2f3c
Author: Thanh Nguyen 
Date:   Wed, 8 Jul 2020 17:11:51 +1000

ntf: Enhance attribute change notification V2 [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Complete diffstat:
--
 src/ntf/apitest/test_ntf_imcn.cc| 1100 ---
 src/ntf/apitest/tet_ntf_common.cc   |   83 +++
 src/ntf/apitest/tet_ntf_common.h|3 +
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  245 +++-
 src/ntf/ntfimcnd/ntfimcn_imm.h  |   44 ++
 src/ntf/ntfimcnd/ntfimcn_main.h |3 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |   44 +-
 7 files changed, 1060 insertions(+), 462 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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

[devel] [PATCH 1/1] ntf: Enhance attribute change notification V2 [#3196]

2020-07-08 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/apitest/test_ntf_imcn.cc| 1100 ---
 src/ntf/apitest/tet_ntf_common.cc   |   83 ++
 src/ntf/apitest/tet_ntf_common.h|3 +
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  245 +-
 src/ntf/ntfimcnd/ntfimcn_imm.h  |   44 ++
 src/ntf/ntfimcnd/ntfimcn_main.h |3 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |   44 +-
 7 files changed, 1060 insertions(+), 462 deletions(-)

diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..0443491a9 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -1,6 +1,7 @@
 /*  -*- OpenSAF  -*-
  *
  * (C) Copyright 2013 The OpenSAF Foundation
+ * Copyright Ericsson AB 2020 - All Rights Reserved.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -24,10 +25,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include "base/time.h"
 #include "osaf/immutil/immutil.h"
 #include "osaf/apitest/util.h"
@@ -55,6 +59,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +174,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  printf("Num possible old attributes: %d\n", numAttributes);
+  for (int i = 0; i < numAttributes; ++i) {
+if (attrChange[i].oldAttributePresent == SA_FALSE) {
+  printf("[%d]: Old Attribute not present\n", i);
+  continue;
+}
+print_notification_attr(nHandle,
+attrChange[i].attributeId,
+attrChange[i].attributeType,
+[i].oldAttributeValue, i);
+  }
+}
+

Re: [devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-07-07 Thread Thanh Nguyen
Hi Minh,
Regard Id:2 and Id:3, I remove the old values.
I implement all comments.
Best Regards,
Thanh


-Original Message-
From: Minh Hon Chau  
Sent: Tuesday, 7 July 2020 11:43 AM
To: Thanh Nguyen ; Thang Duc Nguyen 
; Thuan Tran 
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

Hi a Thanh

Some comments inline.

Thanks

Minh

On 6/7/20 10:59 am, Thanh Nguyen wrote:
> 1) When IMM changes an attribute with NOTIFY flag, ntfimcn
> currently sends the changed attribute values in notification data.
> With the enhancement, ntfimcn fetches the old attribute values,
> corresponding to the changed attribute values, if exist in IMM,
> and include the old attribute values in notification data.
> 2) Test suite ntftest is updated.
> ---
>   src/ntf/Makefile.am |2 +
>   src/ntf/apitest/test_ntf_imcn.cc| 1051 ---
>   src/ntf/apitest/tet_ntf_common.cc   |   82 +++
>   src/ntf/apitest/tet_ntf_common.h|2 +
>   src/ntf/ntfimcnd/ntfimcn_common.c   |  221 ++
>   src/ntf/ntfimcnd/ntfimcn_common.h   |   65 ++
>   src/ntf/ntfimcnd/ntfimcn_imm.c  |   31 +-
>   src/ntf/ntfimcnd/ntfimcn_main.h |2 +
>   src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +-
>   9 files changed, 1259 insertions(+), 416 deletions(-)
>   create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
>   create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h
>
> diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
> index a03eab10c..95210ae5d 100644
> --- a/src/ntf/Makefile.am
> +++ b/src/ntf/Makefile.am
> @@ -108,6 +108,7 @@ noinst_HEADERS += \
>   src/ntf/ntfimcnd/ntfimcn_imm.h \
>   src/ntf/ntfimcnd/ntfimcn_main.h \
>   src/ntf/ntfimcnd/ntfimcn_notifier.h \
> + src/ntf/ntfimcnd/ntfimcn_common.h \
>   src/ntf/tools/ntfclient.h \
>   src/ntf/tools/ntfconsumer.h
>   
> @@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
>   bin_osafntfimcnd_SOURCES = \
>   src/ntf/ntfimcnd/ntfimcn_main.c \
>   src/ntf/ntfimcnd/ntfimcn_notifier.c \
> + src/ntf/ntfimcnd/ntfimcn_common.c \
>   src/ntf/ntfimcnd/ntfimcn_imm.c
>   
>   bin_osafntfimcnd_LDADD = \
> diff --git a/src/ntf/apitest/test_ntf_imcn.cc 
> b/src/ntf/apitest/test_ntf_imcn.cc
> index 6fc5fc831..d06c60dd5 100644
> --- a/src/ntf/apitest/test_ntf_imcn.cc
> +++ b/src/ntf/apitest/test_ntf_imcn.cc
> @@ -24,10 +24,13 @@
>   #include 
>   #include 
>   #include 
> +#include 
> +#include 
>   #include 
>   #include 
>   #include 
>   #include 
> +#include 
>   #include "base/time.h"
>   #include "osaf/immutil/immutil.h"
>   #include "osaf/apitest/util.h"
> @@ -55,6 +58,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
>   static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
>   static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
>   
> +#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
> +
>   /**
>* Callback routine, called when subscribed notification arrives.
>*/
> @@ -168,6 +173,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
> return rc;
>   }
>   
> +static void print_notification_attr(SaNtfNotificationHandleT nHandle,
> +SaNtfElementIdT attributeId,
> +SaNtfValueTypeT attributeType,
> +SaNtfValueT* value,
> +int idx) {
> +  SaUint16T numElem = 0;
> +  char *str = NULL;
> +  SaAisErrorT rc = SA_AIS_OK;
> +
> +  switch (attributeType) {
> +  case SA_NTF_VALUE_STRING: {
> +rc = saNtfPtrValGet(
> +nHandle,
> +value,
> +reinterpret_cast(), );
> +if (rc == SA_AIS_OK) {
> +  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
> +attributeId, attributeType, numElem, str);
> +} else {
> +  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
> +attributeId, attributeType, numElem, "");
> +}
> +break;
> +  }
> +  case SA_NTF_VALUE_UINT32: {
> +printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
> +attributeId, attributeType, value->uint32Val);
> +break;
> +  }
> +  case SA_NTF_VALUE_INT32: {
> +printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
> +attributeId, attributeType, value->int32Val);
> +break;
> +  }
> +  case SA_NTF_VALUE_UINT64: {
> +printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
> +attributeId, attributeType, value->uint64Val);
> +break;
> +  }
> +  case SA_NTF_VALUE_INT64: {
> +printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
> +attributeId, attributeType, value->int64Val);
> +break;
> +  }
> +  case SA_NTF_VALUE_FLOAT

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-07-05 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1051 ---
 src/ntf/apitest/tet_ntf_common.cc   |   82 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 ++
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 ++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   31 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +-
 9 files changed, 1259 insertions(+), 416 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..d06c60dd5 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -24,10 +24,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include "base/time.h"
 #include "osaf/immutil/immutil.h"
 #include "osaf/apitest/util.h"
@@ -55,6 +58,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +173,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// 

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-07-05 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: d28ee50720d5e57edba6ee5c27e8b2bebb0638fa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision e3eb3f02f5dd76d8bbf190b6420db3b364138e01
Author: Thanh Nguyen 
Date:   Mon, 6 Jul 2020 07:11:08 +1000

ntf: Enhance attribute change notification [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1051 +--
 src/ntf/apitest/tet_ntf_common.cc   |   82 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 +++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   31 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +++-
 9 files changed, 1259 insertions(+), 416 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, your pa

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-07-03 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1036 +--
 src/ntf/apitest/tet_ntf_common.cc   |   85 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 ++
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 ++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   32 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +-
 9 files changed, 1261 insertions(+), 403 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..3a04ecb5d 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -55,6 +55,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +170,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  printf("Num 

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-07-03 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: d28ee50720d5e57edba6ee5c27e8b2bebb0638fa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision ee44982166d7d3d2102e5eb96ffd3f32f94a0182
Author: Thanh Nguyen 
Date:   Fri, 3 Jul 2020 18:27:59 +1000

ntf: Enhance attribute change notification [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1036 ++-
 src/ntf/apitest/tet_ntf_common.cc   |   85 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 +++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   32 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +++-
 9 files changed, 1261 insertions(+), 403 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, your pa

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-07-03 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1034 +--
 src/ntf/apitest/tet_ntf_common.cc   |   85 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 ++
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 ++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   32 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +-
 9 files changed, 1259 insertions(+), 403 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..0fa29e482 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -55,6 +55,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +170,123 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  printf("Num 

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-07-03 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: d28ee50720d5e57edba6ee5c27e8b2bebb0638fa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 227d2a0dd547ad38c62fdf24f335eba6e73d2ade
Author: Thanh Nguyen 
Date:   Fri, 3 Jul 2020 17:42:47 +1000

ntf: Enhance attribute change notification [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am |2 +
 src/ntf/apitest/test_ntf_imcn.cc| 1034 +--
 src/ntf/apitest/tet_ntf_common.cc   |   85 +++
 src/ntf/apitest/tet_ntf_common.h|2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   |  221 
 src/ntf/ntfimcnd/ntfimcn_common.h   |   65 +++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |   32 +-
 src/ntf/ntfimcnd/ntfimcn_main.h |2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c |  219 +++-
 9 files changed, 1259 insertions(+), 403 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, your pa

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-06-30 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: d28ee50720d5e57edba6ee5c27e8b2bebb0638fa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision f0ed54ab096dfc73afa070be37476e4a49eea080
Author: Thanh Nguyen 
Date:   Tue, 30 Jun 2020 21:18:56 +1000

ntf: Enhance attribute change notification [#3196]

1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am |   2 +
 src/ntf/apitest/test_ntf_imcn.cc| 838 
 src/ntf/apitest/tet_ntf_common.cc   |  85 
 src/ntf/apitest/tet_ntf_common.h|   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   | 398 +
 src/ntf/ntfimcnd/ntfimcn_common.h   | 123 ++
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  64 +++
 src/ntf/ntfimcnd/ntfimcn_main.h |   2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 234 +-
 9 files changed, 1457 insertions(+), 291 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, 

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-06-30 Thread Thanh Nguyen
1) When IMM changes an attribute with NOTIFY flag, ntfimcn
currently sends the changed attribute values in notification data.
With the enhancement, ntfimcn fetches the old attribute values,
corresponding to the changed attribute values, if exist in IMM,
and include the old attribute values in notification data.
2) Test suite ntftest is updated.
---
 src/ntf/Makefile.am |   2 +
 src/ntf/apitest/test_ntf_imcn.cc| 838 ++--
 src/ntf/apitest/tet_ntf_common.cc   |  85 +++
 src/ntf/apitest/tet_ntf_common.h|   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   | 398 +
 src/ntf/ntfimcnd/ntfimcn_common.h   | 123 
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  64 +++
 src/ntf/ntfimcnd/ntfimcn_main.h |   2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 234 +++-
 9 files changed, 1457 insertions(+), 291 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..284851e1d 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -55,6 +55,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +170,124 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-06-29 Thread Thanh Nguyen
When IMM changes an attribute with NOTIFY flag,
ntfimcn currently sends the changed attribute values
in notification data.
With the enhancement, ntfimcn fetches the old
attribute values, corresponding to the changed
attribute values, if exist in IMM, and include
the old attribute values in notification data

Test suite ntftest is also updated.
---
 src/ntf/Makefile.am |   2 +
 src/ntf/apitest/test_ntf_imcn.cc| 958 ++--
 src/ntf/apitest/tet_ntf_common.cc   |  85 +++
 src/ntf/apitest/tet_ntf_common.h|   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   | 398 
 src/ntf/ntfimcnd/ntfimcn_common.h   | 123 
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  64 ++
 src/ntf/ntfimcnd/ntfimcn_main.h |   2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 273 +++-
 9 files changed, 1579 insertions(+), 328 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/apitest/test_ntf_imcn.cc b/src/ntf/apitest/test_ntf_imcn.cc
index 6fc5fc831..51070915c 100644
--- a/src/ntf/apitest/test_ntf_imcn.cc
+++ b/src/ntf/apitest/test_ntf_imcn.cc
@@ -55,6 +55,8 @@ static char BUF1_STR[sizeof(BUF1) + 1] = { '\0' };
 static char BUF2_STR[sizeof(BUF2) + 1] = { '\0' };
 static char BUF3_STR[sizeof(BUF3) + 1] = { '\0' };
 
+#define OLD_ATTR_PRESENT_DEFAULT SA_FALSE
+
 /**
  * Callback routine, called when subscribed notification arrives.
  */
@@ -168,6 +170,124 @@ static SaBoolT bufs_equal1(const SaUint8T *recbuf,
   return rc;
 }
 
+
+static void print_notification_attr(SaNtfNotificationHandleT nHandle,
+SaNtfElementIdT attributeId,
+SaNtfValueTypeT attributeType,
+SaNtfValueT* value,
+int idx) {
+  SaUint16T numElem = 0;
+  char *str = NULL;
+  SaAisErrorT rc = SA_AIS_OK;
+
+  switch (attributeType) {
+  case SA_NTF_VALUE_STRING: {
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, str);
+} else {
+  printf("[%d]: Id:%d Type:%d Value:(%d)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  case SA_NTF_VALUE_UINT32: {
+printf("[%d]: Id:%d Type:%d Value:%u\n", idx,
+attributeId, attributeType, value->uint32Val);
+break;
+  }
+  case SA_NTF_VALUE_INT32: {
+printf("[%d]: Id:%d Type:%d Value:%d\n", idx,
+attributeId, attributeType, value->int32Val);
+break;
+  }
+  case SA_NTF_VALUE_UINT64: {
+printf("[%d]: Id:%d Type:%d Value:%llu\n", idx,
+attributeId, attributeType, value->uint64Val);
+break;
+  }
+  case SA_NTF_VALUE_INT64: {
+printf("[%d]: Id:%d Type:%d Value:%lld\n", idx,
+attributeId, attributeType, value->int64Val);
+break;
+  }
+  case SA_NTF_VALUE_FLOAT: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->floatVal);
+break;
+  }
+  case SA_NTF_VALUE_DOUBLE: {
+printf("[%d]: Id:%d Type:%d Value:%f\n", idx,
+attributeId, attributeType, value->doubleVal);
+break;
+  }
+  case SA_NTF_VALUE_LDAP_NAME:
+  case SA_NTF_VALUE_BINARY: {
+SaUint8T *binptr = NULL;
+rc = saNtfPtrValGet(
+nHandle,
+value,
+reinterpret_cast(), );
+if (rc == SA_AIS_OK) {
+  printf("[%d]: Id:%d Type:%d NumBytes:%u\n", idx,
+ attributeId, attributeType,
+ numElem);
+  print_mem((const unsigned char*) binptr, numElem);
+} else {
+  printf("[%d]: Id:%d Type:%d NumBytes:(%u)%s\n", idx,
+attributeId, attributeType, numElem, "");
+}
+break;
+  }
+  default:
+printf("Unsupported attribute type: %d\n",
+attributeType);
+break;
+  }
+}
+
+static void print_old_attrs(SaNtfNotificationHandleT nHandle,
+SaNtfAttributeChangeT* attrChange, SaUint16T numAttributes) {
+  // Skip of none of the attribute exist
+  int count = -1;
+  for (int i = 0; i < numAttributes; ++i) {
+// There is at least one old attribute value
+if (attrChange[i].oldAttributePresent == SA_TRUE) {
+  count = i;
+  break;
+}
+  }
+  // Nothing found, skip
+  if (count == -1)
+return;
+  printf("Num 

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-06-29 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: d28ee50720d5e57edba6ee5c27e8b2bebb0638fa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 9266a7c64afce76671f2619e3e9838bade4261c2
Author: Thanh Nguyen 
Date:   Mon, 29 Jun 2020 21:07:59 +1000

ntf: Enhance attribute change notification [#3196]

When IMM changes an attribute with NOTIFY flag,
ntfimcn currently sends the changed attribute values
in notification data.
With the enhancement, ntfimcn fetches the old
attribute values, corresponding to the changed
attribute values, if exist in IMM, and include
the old attribute values in notification data

Test suite ntftest is also updated.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am |   2 +
 src/ntf/apitest/test_ntf_imcn.cc| 958 
 src/ntf/apitest/tet_ntf_common.cc   |  85 
 src/ntf/apitest/tet_ntf_common.h|   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c   | 398 +++
 src/ntf/ntfimcnd/ntfimcn_common.h   | 123 +
 src/ntf/ntfimcnd/ntfimcn_imm.c  |  64 +++
 src/ntf/ntfimcnd/ntfimcn_main.h |   2 +
 src/ntf/ntfimcnd/ntfimcn_notifier.c | 273 +-
 9 files changed, 1579 insertions(+), 328 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, 

[devel] [PATCH 1/1] ntf: Enhance attribute change notification [#3196]

2020-06-14 Thread Thanh Nguyen
1) The trace showed that during saImmOiCcbCompletedCallback,
when exchanged messages to fetch the old values, message
IMMA_CALLBACK_OI_CCB_APPLY is posed in the mailbox.

It is concluded that the old values are no longer
available at saImmOiCcbObjectModifyCallback.

2) It also expect comments if major changes of implementaton
is needed.
---
 src/ntf/Makefile.am   |   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c | 378 ++
 src/ntf/ntfimcnd/ntfimcn_common.h |  40 
 src/ntf/ntfimcnd/ntfimcn_imm.c| 165 -
 src/ntf/ntfimcnd/ntfimcn_main.c   |  16 +-
 src/ntf/ntfimcnd/ntfimcn_main.h   |   2 +
 6 files changed, 597 insertions(+), 6 deletions(-)
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.c
 create mode 100755 src/ntf/ntfimcnd/ntfimcn_common.h

diff --git a/src/ntf/Makefile.am b/src/ntf/Makefile.am
index a03eab10c..95210ae5d 100644
--- a/src/ntf/Makefile.am
+++ b/src/ntf/Makefile.am
@@ -108,6 +108,7 @@ noinst_HEADERS += \
src/ntf/ntfimcnd/ntfimcn_imm.h \
src/ntf/ntfimcnd/ntfimcn_main.h \
src/ntf/ntfimcnd/ntfimcn_notifier.h \
+   src/ntf/ntfimcnd/ntfimcn_common.h \
src/ntf/tools/ntfclient.h \
src/ntf/tools/ntfconsumer.h
 
@@ -171,6 +172,7 @@ bin_osafntfimcnd_CPPFLAGS = \
 bin_osafntfimcnd_SOURCES = \
src/ntf/ntfimcnd/ntfimcn_main.c \
src/ntf/ntfimcnd/ntfimcn_notifier.c \
+   src/ntf/ntfimcnd/ntfimcn_common.c \
src/ntf/ntfimcnd/ntfimcn_imm.c
 
 bin_osafntfimcnd_LDADD = \
diff --git a/src/ntf/ntfimcnd/ntfimcn_common.c 
b/src/ntf/ntfimcnd/ntfimcn_common.c
new file mode 100755
index 0..f09da3f48
--- /dev/null
+++ b/src/ntf/ntfimcnd/ntfimcn_common.c
@@ -0,0 +1,378 @@
+#include 
+#include 
+#include 
+#include "ntfimcn_common.h"
+#include "osaf/immutil/immutil.h"
+#include "ntfimcn_main.h"
+
+#include "base/logtrace.h"
+
+const int DBG_MX_LEN = 1024;
+
+extern ntfimcn_cb_t ntfimcn_cb; /* See ntfimcn_main.c */
+
+const char *CcbUtilOperationType_Str[] = { "CCBUTIL_CREATE", "CCBUTIL_DELETE",
+"CCBUTIL_MODIFY" };
+
+void dbg_print_attr_value(SaImmValueTypeT attrValueType,
+SaImmAttrValueT *attrValue, char *outbuffer) {
+  switch (attrValueType) {
+  case SA_IMM_ATTR_SAINT32T:
+snprintf(outbuffer, DBG_MX_LEN, "%d (0x%x)", *((SaInt32T*) attrValue),
+*((SaInt32T*) attrValue));
+break;
+  case SA_IMM_ATTR_SAUINT32T:
+snprintf(outbuffer, DBG_MX_LEN, "%u (0x%x)", *((SaUint32T*) attrValue),
+*((SaUint32T*) attrValue));
+break;
+  case SA_IMM_ATTR_SAINT64T:
+snprintf(outbuffer, DBG_MX_LEN, "%lld (0x%llx)", *((SaInt64T*) attrValue),
+*((SaInt64T*) attrValue));
+break;
+  case SA_IMM_ATTR_SAUINT64T:
+snprintf(outbuffer, DBG_MX_LEN, "%llu (0x%llx)", *((SaUint64T*) attrValue),
+*((SaUint64T*) attrValue));
+break;
+  case SA_IMM_ATTR_SAFLOATT:
+snprintf(outbuffer, DBG_MX_LEN, "%.8g", *((SaFloatT*) attrValue));
+break;
+  case SA_IMM_ATTR_SADOUBLET:
+snprintf(outbuffer, DBG_MX_LEN, "%.17g", *((SaDoubleT*) attrValue));
+break;
+  case SA_IMM_ATTR_SANAMET: {
+SaNameT *myNameT = (SaNameT*) attrValue;
+snprintf(outbuffer, DBG_MX_LEN, "%s (%zu)", saAisNameBorrow(myNameT),
+strlen(saAisNameBorrow(myNameT)));
+break;
+  }
+  case SA_IMM_ATTR_SASTRINGT:
+snprintf(outbuffer, DBG_MX_LEN, "%s", *((char**) attrValue));
+break;
+  case SA_IMM_ATTR_SAANYT: {
+SaAnyT *anyp = (SaAnyT*) attrValue;
+char *cur = outbuffer;
+unsigned int i = 0;
+if (anyp->bufferSize) {
+  cur += snprintf(cur, DBG_MX_LEN, "%s", "0x");
+  for (; i < anyp->bufferSize; i++) {
+if (((int) anyp->bufferAddr[i]) < 0x10) {
+  cur += snprintf(cur, DBG_MX_LEN, "%s", "0");
+}
+cur += snprintf(cur, DBG_MX_LEN, "%x", (int) anyp->bufferAddr[i]);
+  }
+}
+cur += snprintf(cur, DBG_MX_LEN, " size(%u) ",
+(unsigned int) anyp->bufferSize);
+break;
+  }
+
+  default:
+snprintf(outbuffer, DBG_MX_LEN, "%s", "Unknown ");
+break;
+  }
+
+}
+
+char* dbg_get_attr_type_name(SaImmValueTypeT attrValueType) {
+  switch (attrValueType) {
+  case SA_IMM_ATTR_SAINT32T:
+return "SA_INT32_T";
+break;
+  case SA_IMM_ATTR_SAUINT32T:
+return "SA_UINT32_T";
+break;
+  case SA_IMM_ATTR_SAINT64T:
+return "SA_INT64_T";
+break;
+  case SA_IMM_ATTR_SAUINT64T:
+return "SA_UINT64_T";
+break;
+  case SA_IMM_ATTR_SATIMET:
+return "SA_TIME_T";
+break;
+  case SA_IMM_ATTR_SANAMET:
+return "SA_NAME_T";
+break;
+  case SA_IMM_ATTR_SAFLOATT:
+return "SA_FLOAT_T";
+break;
+  case SA_IMM_ATTR_SADOUBLET:
+return "SA_DOUBLE_T";
+break;
+  case SA_IMM_ATTR_SASTRINGT:
+return "SA_STRING_T";
+break;
+  case SA_IMM_ATTR_SAANYT:
+return "SA_ANY_T";
+break;
+  default:
+return "Unknown";
+break;
+  }
+}
+
+void dbg_trace_attr_mod(const SaImmAttrModificationT_2 **attrMods) {
+  TRACE_ENTER();
+  int i = 0;
+  

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3196]

2020-06-14 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: 1da817a659f4837cf721489aaf2073dc21901683
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 56f4cce71f6d0ba4eef57f1a1e6221c16c0067f7
Author: Thanh Nguyen 
Date:   Mon, 15 Jun 2020 10:34:29 +1000

ntf: Enhance attribute change notification [#3196]

1) The trace showed that during saImmOiCcbCompletedCallback,
when exchanged messages to fetch the old values, message
IMMA_CALLBACK_OI_CCB_APPLY is posed in the mailbox.

It is concluded that the old values are no longer
available at saImmOiCcbObjectModifyCallback.

2) It also expect comments if major changes of implementaton
is needed.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am   |   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c | 378 ++
 src/ntf/ntfimcnd/ntfimcn_common.h |  40 
 src/ntf/ntfimcnd/ntfimcn_imm.c| 165 -
 src/ntf/ntfimcnd/ntfimcn_main.c   |  16 +-
 src/ntf/ntfimcnd/ntfimcn_main.h   |   2 +
 6 files changed, 597 insertions(+), 6 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



___
Opensaf-devel mailing list
Ope

[devel] [PATCH 0/1] Review Request for ntf: Enhance attribute change notification [#3169]

2020-06-12 Thread Thanh Nguyen
Summary: ntf: Enhance attribute change notification [#3196]
Review request for Ticket(s): 3196
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3196
Base revision: 1da817a659f4837cf721489aaf2073dc21901683
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 271ba733c12db4d75f9da1c9d2f313d303ac3c61
Author: Thanh Nguyen 
Date:   Fri, 12 Jun 2020 18:56:59 +1000

ntf: Enhance attribute change notification [#3196]

The purpose of this interim patch is to indicate that
the old attributes can only be fetched at saImmOiCcbObjectModifyCallback.
At saImmOiCcbCompletedCallback, the old values are already overwritten.
This patch has code fetching at both of these callbacks for illustration.

It also expect comments if major changes of implementaton is needed.



Added Files:

 src/ntf/ntfimcnd/ntfimcn_common.c
 src/ntf/ntfimcnd/ntfimcn_common.h


Complete diffstat:
--
 src/ntf/Makefile.am   |   2 +
 src/ntf/ntfimcnd/ntfimcn_common.c | 353 ++
 src/ntf/ntfimcnd/ntfimcn_common.h |  41 +
 src/ntf/ntfimcnd/ntfimcn_imm.c| 166 +-
 src/ntf/ntfimcnd/ntfimcn_main.c   |  17 +-
 src/ntf/ntfimcnd/ntfimcn_main.h   |   2 +
 6 files changed, 575 insertions(+), 6 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



___
Opensaf-devel mailing list
Ope

Re: [devel] [PATCH 1/1] mds: fix mds_tipc_fctrl_shutdown() stuck forever [#3169]

2020-03-30 Thread Thanh Nguyen
Hi Thuan,

I have a minor comment and also an ACK.

Dealing with event interactions, we try not to introduce new variable such as 
running. We tend to use existing variable as much as we can. This will make 
further interactions update simpler.
The existing variable is_fctrl_enabled can be used without introducing the new 
variable running.

>From my observation of this code, on the logical side, 
is_fctrl_enabled == true ==> running == true
is_fctrl_enabled == false ==> running == false
and
running == true ==> is_fctrl_enabled == true
running == false ==> is_fctrl_enabled == false

Thus is_fctrl_enabled is identical to running.

Here is the practical side
1) is_fctrl_enabled == true; the process_all_events() loop runs.
is_fctrl_enable == false; the loop stops or does not start.
Instead of using while (running), it can just be while (is_fctrl_enabled). 
Surrounding code needs minor adjustment.

2) Initially is_fctrl_enable == false.
When the app call mds_tipc_fctrl_initialize(), it will call create_ncs_task() 
which set is_fctrl_enable to true and start the loop.

Best Regards,
Thanh

-Original Message-
From: thuan.tran  
Sent: Monday, 23 March 2020 8:59 PM
To: Minh Hon Chau ; Thang Duc Nguyen 

Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] mds: fix mds_tipc_fctrl_shutdown() stuck forever 
[#3169]

- Deadlock of portid_map_mutex locking: mds_tipc_fctrl_shutdown() take lock 
then wait for thread process_all_events() to be canceled.
But that thread also want get lock then it is keep waiting for lock.
- Create safe method to cancel process_all_events() thread similar as the way 
MDS destroy legacy receiving thread.
And getting portid_map_mutex lock only after that thread released.
---
 src/mds/mds_tipc_fctrl_intf.cc | 24 ++--
 src/mds/mds_tipc_fctrl_msg.h   |  8 
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/src/mds/mds_tipc_fctrl_intf.cc b/src/mds/mds_tipc_fctrl_intf.cc 
index 6ce00782e..93bfce51c 100644
--- a/src/mds/mds_tipc_fctrl_intf.cc
+++ b/src/mds/mds_tipc_fctrl_intf.cc
@@ -27,6 +27,8 @@
 
 #include "base/ncssysf_def.h"
 #include "base/ncssysf_tsk.h"
+#include "base/ncs_osprm.h"
+#include "base/osaf_poll.h"
 
 #include "mds/mds_log.h"
 #include "mds/mds_tipc_fctrl_portid.h"
@@ -194,6 +196,7 @@ bool mds_fctrl_mbx_cleanup(NCSCONTEXT arg, NCSCONTEXT msg) 
{  }
 
 uint32_t process_all_events(void) {
+  bool running = true;
   enum { FD_FCTRL = 0, NUM_FDS };
 
   int poll_tmo = chunk_ack_timeout;
@@ -203,7 +206,7 @@ uint32_t process_all_events(void) {
   ncs_ipc_get_sel_obj(_events).rmv_obj;
   pfd[FD_FCTRL].events = POLLIN;
 
-  while (true) {
+  while (running) {
 int pollres;
 
 pollres = poll(pfd, NUM_FDS, poll_tmo); @@ -231,9 +234,13 @@ uint32_t 
process_all_events(void) {
 if (evt->IsFlowEvent()) {
   process_flow_event(*evt);
 }
+if (evt->IsShutDownEvent()) {
+  running = false;
+}
 
 delete evt;
 portid_map_mutex.unlock();
+if (!running) m_NCS_SEL_OBJ_IND(>destroy_ack_obj_);
   }
 }
 // timeout, scan all portid and send ack msgs @@ -243,6 +250,7 @@ uint32_t 
process_all_events(void) {
   portid_map_mutex.unlock();
 }
   }  /* while */
+  m_MDS_LOG_DBG("FCTRL: process_all_events() thread end");
   return NCSCC_RC_SUCCESS;
 }
 
@@ -305,7 +313,18 @@ uint32_t mds_tipc_fctrl_initialize(int dgramsock, struct 
tipc_portid id,  uint32_t mds_tipc_fctrl_shutdown(void) {
   if (is_fctrl_enabled == false) return NCSCC_RC_SUCCESS;
 
-  portid_map_mutex.lock();
+  NCS_SEL_OBJ destroy_ack_obj;
+  m_NCS_SEL_OBJ_CREATE(_ack_obj);
+  Event* pevt = new Event(Event::Type::kEvtShutDown, destroy_ack_obj);  
+ if (m_NCS_IPC_SEND(_events, pevt,
+  NCS_IPC_PRIORITY_HIGH) != NCSCC_RC_SUCCESS) {
+m_MDS_LOG_ERR("FCTRL: Failed to send shutdown, Error[%s]",
+strerror(errno));
+abort();
+  }
+  osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(destroy_ack_obj), 1);  
+ m_NCS_SEL_OBJ_DESTROY(_ack_obj);
+  memset(_ack_obj, 0, sizeof(destroy_ack_obj));
 
   if (ncs_task_release(p_task_hdl) != NCSCC_RC_SUCCESS) {
 m_MDS_LOG_ERR("FCTRL: Stop of the Created Task-failed, Error[%s]", @@ 
-315,6 +334,7 @@ uint32_t mds_tipc_fctrl_shutdown(void) {
   m_NCS_IPC_DETACH(_events, mds_fctrl_mbx_cleanup, nullptr);
   m_NCS_IPC_RELEASE(_events, nullptr);
 
+  portid_map_mutex.lock();
   for (auto i : portid_map) delete i.second;
   portid_map.clear();
 
diff --git a/src/mds/mds_tipc_fctrl_msg.h b/src/mds/mds_tipc_fctrl_msg.h index 
c4641ed4e..1ba625650 100644
--- a/src/mds/mds_tipc_fctrl_msg.h
+++ b/src/mds/mds_tipc_fctrl_msg.h
@@ -49,10 +49,13 @@ class Event {
 kEvtTmrAll,
 kEvtTmrTxProb,// event that tx probation timer expired for once
 kEvtTmrChunkAck,  // event to send the chunk ack
+kEvtShutDown, // event to shutdown flow control thread
   };
   NCS_IPC_MSG next_{0};
   Type type_;
 
+  // Used for shutdown
+  NCS_SEL_OBJ 

Re: [devel] Review request log: update PR documentation for configurable facility ID [#3139 ]

2020-02-06 Thread Thanh Nguyen
Hello Thien,

We should mention that this is installation time configurable attribute. 
Best Regards,
Thanh

-Original Message-
From: Thanh Nguyen [mailto:thanh.ngu...@dektech.com.au] 
Sent: Friday, 7 February 2020 1:26 PM
To: 'Thien Minh Huynh'; 'Gary Lee'; 'Minh Chau'
Cc: 'opensaf-devel@lists.sourceforge.net'
Subject: RE: [devel] Review request log: update PR documentation for
configurable facility ID [#3139 ]

Hello Thien,

1) General comment. 
1.1) The document introduces concepts and entities such as Log Server, Log
Agent, log stream, log record, ... We should use these already introduced
terms. New terms should be introduced properly.

Chapter 6 uses the term "server" as in "The server is now able to
differentiate among types of log records ". Additionally the chapter
also uses the term "log record receiver". This has not been introduced in
this document. If this is needed, then the chapter should introduce the
concept of "log record receiver" properly.

My question is that is "log record receiver" the same as "log server"?
In this chapter, these two terms seem to be used inter-changeably. 

1.2) The table of content is not yet generated properly.

2) Details comments
2.1) Rephrase this sentence
"In legacy, streaming log records are packaged in RFC5424 format 
and they all carry a fixed facility ID (16)."

For example
"In the base functionality, streaming log records are packaged in RFC5424
format 
and they all carry a fixed facility ID (of numerical value 16)."

2.2 Rephrase this sentence
"Therefore, log record receiver i.e. rsyslogd is not able to 
filter log records on their facility id such as which ones 
are regular logs or which ones are security."

For example
"The log record receiver, i.e. rsyslogd, is not able
to differentiate regular log records to security log
records based on the fixed facility ID."

2.3) Rephrase the following
"It has 16 (local use 0) by default and a valid value is within the range [0
- 23]."

For example
"It has the numerical value of 16 (local use 0) by default ."

2.4) The following statement is not quite correct
"The attribute will go back to the default value when this attribute is
deleted."
Rephrase this to
"The facility ID will go back to the default value when this attribute is
deleted."

This is all from me.
Best Regards,
Thanh

-Original Message-
From: Thien Minh Huynh [mailto:thien.m.hu...@dektech.com.au] 
Sent: Tuesday, 21 January 2020 4:15 PM
To: 'Gary Lee'; 'Minh Chau'
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] Review request log: update PR documentation for
configurable facility ID [#3139 ]

Hi all,

 

This is the update of OpenSAF LOG PR documentation regarding the make
facility id configurable.

 

Please have a look and give me your comments.

 

Best Regards,

ThienHuynh




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


Re: [devel] Review request log: update PR documentation for configurable facility ID [#3139 ]

2020-02-06 Thread Thanh Nguyen
Hello Thien,

1) General comment. 
1.1) The document introduces concepts and entities such as Log Server, Log
Agent, log stream, log record, ... We should use these already introduced
terms. New terms should be introduced properly.

Chapter 6 uses the term "server" as in "The server is now able to
differentiate among types of log records ". Additionally the chapter
also uses the term "log record receiver". This has not been introduced in
this document. If this is needed, then the chapter should introduce the
concept of "log record receiver" properly.

My question is that is "log record receiver" the same as "log server"?
In this chapter, these two terms seem to be used inter-changeably. 

1.2) The table of content is not yet generated properly.

2) Details comments
2.1) Rephrase this sentence
"In legacy, streaming log records are packaged in RFC5424 format 
and they all carry a fixed facility ID (16)."

For example
"In the base functionality, streaming log records are packaged in RFC5424
format 
and they all carry a fixed facility ID (of numerical value 16)."

2.2 Rephrase this sentence
"Therefore, log record receiver i.e. rsyslogd is not able to 
filter log records on their facility id such as which ones 
are regular logs or which ones are security."

For example
"The log record receiver, i.e. rsyslogd, is not able
to differentiate regular log records to security log
records based on the fixed facility ID."

2.3) Rephrase the following
"It has 16 (local use 0) by default and a valid value is within the range [0
- 23]."

For example
"It has the numerical value of 16 (local use 0) by default ."

2.4) The following statement is not quite correct
"The attribute will go back to the default value when this attribute is
deleted."
Rephrase this to
"The facility ID will go back to the default value when this attribute is
deleted."

This is all from me.
Best Regards,
Thanh

-Original Message-
From: Thien Minh Huynh [mailto:thien.m.hu...@dektech.com.au] 
Sent: Tuesday, 21 January 2020 4:15 PM
To: 'Gary Lee'; 'Minh Chau'
Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] Review request log: update PR documentation for
configurable facility ID [#3139 ]

Hi all,

 

This is the update of OpenSAF LOG PR documentation regarding the make
facility id configurable.

 

Please have a look and give me your comments.

 

Best Regards,

ThienHuynh




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


[devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.
---
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 15 ---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index 8908c1ff3..9822879ab 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned 
priority,
 if (!entry) {
   entry = gl_local_thread_trace->CreateLogEntry(
   static_cast(priority),
-  preamble, ap);
+  base::ReadRealtimeClock(), preamble, ap);
 }
 gl_thread_buffer.WriteToBuffer(entry);
   }
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index e22112a43..104e08ce1 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,32 +96,33 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog,
 const char* LogTraceClient::Log(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   if (log_socket_ != nullptr && log_mutex_ != nullptr) {
-return LogInternal(severity, fmt, ap);
+return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap);
   }
   return nullptr;
 }
 
 const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  CreateLogEntryInternal(severity, fmt, ap);
+  CreateLogEntryInternal(severity, time_spec, fmt, ap);
   log_socket_->Send(buffer_.data(), buffer_.size());
   return buffer_.data();
 }
 
 const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  return CreateLogEntryInternal(severity, fmt, ap);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
 }
 
 const char* LogTraceClient::CreateLogEntryInternal(
-base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+base::LogMessage::Severity severity, timespec time_spec,
+const char *fmt, va_list ap) {
   uint32_t id = sequence_id_;
   sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
   buffer_.clear();
   base::LogMessage::Write(
-  base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(),
+  base::LogMessage::Facility::kLocal1, severity, time_spec,
   fqdn_, app_name_, proc_id_, msg_id_,
   {{base::LogMessage::SdName{"meta"},
 {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"},
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index 5b165e528..1ccb44d06 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -44,7 +44,7 @@ class LogTraceClient {
   const char* Log(base::LogMessage::Severity severity, const char *fmt,
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  timespec time_spec, const char *fmt, va_list ap);
   void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer);
   void RemoveExternalBuffer(int64_t tid);
   void RequestFlushExternalBuffer();
@@ -56,10 +56,11 @@ class LogTraceClient {
 
  private:
   bool Init(const char *msg_id, WriteMode mode);
-  const char* LogInternal(base::LogMessage::Severity severity, const char *fmt,
-  va_list ap);
+
+  const char* LogInternal(base::LogMessage::Severity severity,
+  timespec time_spec, const char *fmt, va_list ap);
   const char* CreateLogEntryInternal(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  timespec time_spec, const char *fmt, va_list ap);
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.25.0



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


[devel] [PATCH 0/1] Review Request for dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
Summary: dtm: improve time accuracy in a trace record [#3144]
Review request for Ticket(s): 3144
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3144
Base revision: 813ef8f3d514f321fae254ffdaca5eb1991dbbbd
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision b02569e50913fa8697ba087b25b3accae2b0069e
Author: Thanh Nguyen 
Date:   Thu, 6 Feb 2020 15:30:09 +1100

dtm: improve time accuracy in a trace record [#3144]

In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.



Complete diffstat:
--
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 15 ---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 14 insertions(+), 12 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 0/1] Review Request for dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
Summary: dtm: improve time accuracy in a trace record [#3144]
Review request for Ticket(s): 3144
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3144
Base revision: 813ef8f3d514f321fae254ffdaca5eb1991dbbbd
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 3a7d9c5f43233124cb866c4b4e9076cbcd5417b8
Author: Thanh Nguyen 
Date:   Thu, 6 Feb 2020 15:16:37 +1100

dtm: improve time accuracy in a trace record [#3144]

In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.



Complete diffstat:
--
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 17 ++---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 16 insertions(+), 12 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.
---
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 17 ++---
 src/base/logtrace_client.h  |  9 +
 3 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index 8908c1ff3..9822879ab 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned 
priority,
 if (!entry) {
   entry = gl_local_thread_trace->CreateLogEntry(
   static_cast(priority),
-  preamble, ap);
+  base::ReadRealtimeClock(), preamble, ap);
 }
 gl_thread_buffer.WriteToBuffer(entry);
   }
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index e22112a43..1f3dfe721 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,32 +96,35 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog,
 const char* LogTraceClient::Log(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   if (log_socket_ != nullptr && log_mutex_ != nullptr) {
-return LogInternal(severity, fmt, ap);
+return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap);
   }
   return nullptr;
 }
 
 const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  CreateLogEntryInternal(severity, fmt, ap);
+  CreateLogEntryInternal(severity, time_spec, fmt, ap);
   log_socket_->Send(buffer_.data(), buffer_.size());
   return buffer_.data();
 }
 
 const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  return CreateLogEntryInternal(severity, fmt, ap);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
 }
 
+// This is original
+
 const char* LogTraceClient::CreateLogEntryInternal(
-base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+base::LogMessage::Severity severity, timespec time_spec,
+const char *fmt, va_list ap) {
   uint32_t id = sequence_id_;
   sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
   buffer_.clear();
   base::LogMessage::Write(
-  base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(),
+  base::LogMessage::Facility::kLocal1, severity, time_spec,
   fqdn_, app_name_, proc_id_, msg_id_,
   {{base::LogMessage::SdName{"meta"},
 {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"},
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index 5b165e528..1ccb44d06 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -44,7 +44,7 @@ class LogTraceClient {
   const char* Log(base::LogMessage::Severity severity, const char *fmt,
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  timespec time_spec, const char *fmt, va_list ap);
   void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer);
   void RemoveExternalBuffer(int64_t tid);
   void RequestFlushExternalBuffer();
@@ -56,10 +56,11 @@ class LogTraceClient {
 
  private:
   bool Init(const char *msg_id, WriteMode mode);
-  const char* LogInternal(base::LogMessage::Severity severity, const char *fmt,
-  va_list ap);
+
+  const char* LogInternal(base::LogMessage::Severity severity,
+  timespec time_spec, const char *fmt, va_list ap);
   const char* CreateLogEntryInternal(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  timespec time_spec, const char *fmt, va_list ap);
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.25.0



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


Re: [devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-02-05 Thread Thanh Nguyen
Hello Minh,

1) For LogInternal(..), there is only one version. The new replaced the old. 
This is private method, thus it can be safely replaced.
2) For CreateLogEntry(...) which is a public method. For compatibility reasons, 
I keep the old method and create the new method. I do not know if there is any 
client code of opensaf out there calling CreateLogEntry. If it is known that 
there is no client code, I will remove the old method.

3) For CreateLogEntryInternal(..), I also keep two versions corresponding to 
two versions of calling methods CreateLogEntry(..).

I will remove the old version of (2) and (3) if it is confirmed that there is 
no client code calling CreateLogEntry(..).
Best Regards,
Thanh

-Original Message-
From: Minh Hon Chau [mailto:minh.c...@dektech.com.au] 
Sent: Thursday, 6 February 2020 12:48 PM
To: Thanh Nguyen; peter.mcint...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

Hi aThanh,

The patch adds a new pair of CreateLogEntry/CreateLogEntryInternal with 
one extra parameter. If the old one (within 3 parameters) is not being 
used anywhere else, we can delete them.

Thanks

Minh

On 24/1/20 11:34 am, Thanh Nguyen wrote:
> In the trace record the time value is generated
> after acquiring the mutex. The time accuracy is improved
> when generated before seizing the mutext.
> ---
>   src/base/logtrace.cc|  2 +-
>   src/base/logtrace_client.cc | 18 +-
>   src/base/logtrace_client.h  | 13 ++---
>   3 files changed, 24 insertions(+), 9 deletions(-)
>
> diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
> index 8908c1ff3..9822879ab 100644
> --- a/src/base/logtrace.cc
> +++ b/src/base/logtrace.cc
> @@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned 
> priority,
>   if (!entry) {
> entry = gl_local_thread_trace->CreateLogEntry(
> static_cast(priority),
> -  preamble, ap);
> +  base::ReadRealtimeClock(), preamble, ap);
>   }
>   gl_thread_buffer.WriteToBuffer(entry);
> }
> diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
> index e22112a43..484bd17e5 100644
> --- a/src/base/logtrace_client.cc
> +++ b/src/base/logtrace_client.cc
> @@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog,
>   const char* LogTraceClient::Log(base::LogMessage::Severity severity,
>   const char *fmt, va_list ap) {
> if (log_socket_ != nullptr && log_mutex_ != nullptr) {
> -return LogInternal(severity, fmt, ap);
> +return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap);
> }
> return nullptr;
>   }
>   
>   const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity,
> -const char *fmt, va_list ap) {
> +timespec time_spec, const char *fmt, va_list ap) {
> base::Lock lock(*log_mutex_);
> -  CreateLogEntryInternal(severity, fmt, ap);
> +  CreateLogEntryInternal(severity, time_spec, fmt, ap);
> log_socket_->Send(buffer_.data(), buffer_.size());
> return buffer_.data();
>   }
>   
> +const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity 
> severity,
> +timespec time_spec, const char *fmt, va_list ap) {
> +  base::Lock lock(*log_mutex_);
> +  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
> +}
> +
> +// This is original
>   const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity 
> severity,
>   const char *fmt, va_list ap) {
> base::Lock lock(*log_mutex_);
> @@ -116,12 +123,13 @@ const char* 
> LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
>   }
>   
>   const char* LogTraceClient::CreateLogEntryInternal(
> -base::LogMessage::Severity severity, const char *fmt, va_list ap) {
> +base::LogMessage::Severity severity, timespec time_spec,
> +const char *fmt, va_list ap) {
> uint32_t id = sequence_id_;
> sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
> buffer_.clear();
> base::LogMessage::Write(
> -  base::LogMessage::Facility::kLocal1, severity, 
> base::ReadRealtimeClock(),
> +  base::LogMessage::Facility::kLocal1, severity, time_spec,
> fqdn_, app_name_, proc_id_, msg_id_,
> {{base::LogMessage::SdName{"meta"},
>   {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"},
> diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
> index 5b165e528..29aa79b95 100644
> --- a/src/base/logtrace_client.h
> +++ b/src/base/logtrace_client.h
> @@ -45,6 +45,8 @@ class LogTraceClient {
> va_list ap);
> const char* CreateLogEntry(base::LogMessa

[devel] [PATCH 1/1] dtm: improve time accuracy in a trace record [#3144]

2020-01-23 Thread Thanh Nguyen
In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.
---
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 18 +-
 src/base/logtrace_client.h  | 13 ++---
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index 8908c1ff3..9822879ab 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned 
priority,
 if (!entry) {
   entry = gl_local_thread_trace->CreateLogEntry(
   static_cast(priority),
-  preamble, ap);
+  base::ReadRealtimeClock(), preamble, ap);
 }
 gl_thread_buffer.WriteToBuffer(entry);
   }
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index e22112a43..484bd17e5 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog,
 const char* LogTraceClient::Log(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   if (log_socket_ != nullptr && log_mutex_ != nullptr) {
-return LogInternal(severity, fmt, ap);
+return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap);
   }
   return nullptr;
 }
 
 const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  CreateLogEntryInternal(severity, fmt, ap);
+  CreateLogEntryInternal(severity, time_spec, fmt, ap);
   log_socket_->Send(buffer_.data(), buffer_.size());
   return buffer_.data();
 }
 
+const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
+timespec time_spec, const char *fmt, va_list ap) {
+  base::Lock lock(*log_mutex_);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
+}
+
+// This is original
 const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
@@ -116,12 +123,13 @@ const char* 
LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
 }
 
 const char* LogTraceClient::CreateLogEntryInternal(
-base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+base::LogMessage::Severity severity, timespec time_spec,
+const char *fmt, va_list ap) {
   uint32_t id = sequence_id_;
   sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
   buffer_.clear();
   base::LogMessage::Write(
-  base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(),
+  base::LogMessage::Facility::kLocal1, severity, time_spec,
   fqdn_, app_name_, proc_id_, msg_id_,
   {{base::LogMessage::SdName{"meta"},
 {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"},
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index 5b165e528..29aa79b95 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -45,6 +45,8 @@ class LogTraceClient {
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
   const char *fmt, va_list ap);
+  const char* CreateLogEntry(base::LogMessage::Severity severity,
+  timespec time_spec, const char *fmt, va_list ap);
   void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer);
   void RemoveExternalBuffer(int64_t tid);
   void RequestFlushExternalBuffer();
@@ -56,10 +58,15 @@ class LogTraceClient {
 
  private:
   bool Init(const char *msg_id, WriteMode mode);
-  const char* LogInternal(base::LogMessage::Severity severity, const char *fmt,
-  va_list ap);
+
+  const char* LogInternal(base::LogMessage::Severity severity,
+  timespec time_spec, const char *fmt, va_list ap);
   const char* CreateLogEntryInternal(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  timespec time_spec, const char *fmt, va_list ap);
+  inline const char* CreateLogEntryInternal(
+  base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+return CreateLogEntryInternal(severity, base::ReadRealtimeClock(), fmt, 
ap);
+  }
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.17.1



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


[devel] [PATCH 0/1] Review Request for dtm: improve time value in a trace record [#3144]

2020-01-23 Thread Thanh Nguyen
Summary: dtm: improve time accuracy in a trace record [#3144]
Review request for Ticket(s): 3144
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3144
Base revision: f03fe23c17bd4e4e32dd4a1304d2ac8f247d05e7
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision ed3466d17c9df07b54cd801177f20743c1b398f5
Author: Thanh Nguyen 
Date:   Fri, 24 Jan 2020 11:22:41 +1100

dtm: improve time accuracy in a trace record [#3144]

In the trace record the time value is generated
after acquiring the mutex. The time accuracy is improved
when generated before seizing the mutext.



Complete diffstat:
--
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 18 +-
 src/base/logtrace_client.h  | 13 ++---
 3 files changed, 24 insertions(+), 9 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 0/1] Review Request for dtm: improve time value in a trace record [#314

2020-01-23 Thread Thanh Nguyen
Summary: dtm: improve time value in a trace record [#3144]
Review request for Ticket(s): 3144
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3144
Base revision: f03fe23c17bd4e4e32dd4a1304d2ac8f247d05e7
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 3122e85c2c54e467dbbdba04acfbfce7c46c9c17
Author: Thanh Nguyen 
Date:   Thu, 23 Jan 2020 17:00:17 +1100

dtm: improve time value in a trace record [#3144]

In the trace record the time value is generated
after acquiring the mutex. The time value is improved
when generated before seizing the mutext.



Complete diffstat:
--
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 18 +-
 src/base/logtrace_client.h  | 13 ++---
 3 files changed, 24 insertions(+), 9 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] dtm: improve time value in a trace record [#3144]

2020-01-23 Thread Thanh Nguyen
In the trace record the time value is generated
after acquiring the mutex. The time value is improved
when generated before seizing the mutext.
---
 src/base/logtrace.cc|  2 +-
 src/base/logtrace_client.cc | 18 +-
 src/base/logtrace_client.h  | 13 ++---
 3 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index 8908c1ff3..9822879ab 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -97,7 +97,7 @@ void trace_output(const char *file, unsigned line, unsigned 
priority,
 if (!entry) {
   entry = gl_local_thread_trace->CreateLogEntry(
   static_cast(priority),
-  preamble, ap);
+  base::ReadRealtimeClock(), preamble, ap);
 }
 gl_thread_buffer.WriteToBuffer(entry);
   }
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index e22112a43..903e239e3 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -96,19 +96,26 @@ const char* LogTraceClient::Log(LogTraceClient* tracelog,
 const char* LogTraceClient::Log(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   if (log_socket_ != nullptr && log_mutex_ != nullptr) {
-return LogInternal(severity, fmt, ap);
+return LogInternal(severity, base::ReadRealtimeClock(), fmt, ap);
   }
   return nullptr;
 }
 
 const char* LogTraceClient::LogInternal(base::LogMessage::Severity severity,
-const char *fmt, va_list ap) {
+struct timespec time_spec, const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
-  CreateLogEntryInternal(severity, fmt, ap);
+  CreateLogEntryInternal(severity, time_spec, fmt, ap);
   log_socket_->Send(buffer_.data(), buffer_.size());
   return buffer_.data();
 }
 
+const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
+struct timespec time_spec, const char *fmt, va_list ap) {
+  base::Lock lock(*log_mutex_);
+  return CreateLogEntryInternal(severity, time_spec, fmt, ap);
+}
+
+// This is original
 const char* LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
 const char *fmt, va_list ap) {
   base::Lock lock(*log_mutex_);
@@ -116,12 +123,13 @@ const char* 
LogTraceClient::CreateLogEntry(base::LogMessage::Severity severity,
 }
 
 const char* LogTraceClient::CreateLogEntryInternal(
-base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+base::LogMessage::Severity severity, struct timespec time_spec,
+const char *fmt, va_list ap) {
   uint32_t id = sequence_id_;
   sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
   buffer_.clear();
   base::LogMessage::Write(
-  base::LogMessage::Facility::kLocal1, severity, base::ReadRealtimeClock(),
+  base::LogMessage::Facility::kLocal1, severity, time_spec,
   fqdn_, app_name_, proc_id_, msg_id_,
   {{base::LogMessage::SdName{"meta"},
 {base::LogMessage::Parameter{base::LogMessage::SdName{"sequenceId"},
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index 5b165e528..3c264f0b5 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -45,6 +45,8 @@ class LogTraceClient {
   va_list ap);
   const char* CreateLogEntry(base::LogMessage::Severity severity,
   const char *fmt, va_list ap);
+  const char* CreateLogEntry(base::LogMessage::Severity severity,
+  struct timespec time_spec, const char *fmt, va_list ap);
   void AddExternalBuffer(int64_t tid, LogTraceBuffer* buffer);
   void RemoveExternalBuffer(int64_t tid);
   void RequestFlushExternalBuffer();
@@ -56,10 +58,15 @@ class LogTraceClient {
 
  private:
   bool Init(const char *msg_id, WriteMode mode);
-  const char* LogInternal(base::LogMessage::Severity severity, const char *fmt,
-  va_list ap);
+
+  const char* LogInternal(base::LogMessage::Severity severity,
+  struct timespec time_spec, const char *fmt, va_list ap);
   const char* CreateLogEntryInternal(base::LogMessage::Severity severity,
-  const char *fmt, va_list ap);
+  struct timespec time_spec, const char *fmt, va_list ap);
+  inline const char* CreateLogEntryInternal(
+  base::LogMessage::Severity severity, const char *fmt, va_list ap) {
+return CreateLogEntryInternal(severity, base::ReadRealtimeClock(), fmt, 
ap);
+  }
   static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
   base::LogMessage::HostName fqdn_{""};
   base::LogMessage::AppName app_name_{""};
-- 
2.17.1



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


Re: [devel] [PATCH 1/1] smf: Improve SmfAdminStateHandler() Return false if Fail [#3104]

2019-10-27 Thread Thanh Nguyen
Hi Phuc,
ACK from me.
Cheers,
thanh

-Original Message-
From: Tran Thuan [mailto:thuan.t...@dektech.com.au] 
Sent: Thursday, 24 October 2019 5:04 PM
To: 'phuc.h.chau'; lennart.l...@ericsson.com; thang.d.ngu...@dektech.com.au;
minh.c...@dektech.com.au; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [devel] [PATCH 1/1] smf: Improve SmfAdminStateHandler() Return
false if Fail [#3104]

Hi Phuc,

ACK from me.

Best Regards,
ThuanTr

-Original Message-
From: phuc.h.chau  
Sent: Thursday, October 24, 2019 10:28 AM
To: lennart.l...@ericsson.com; thuan.t...@dektech.com.au;
thang.d.ngu...@dektech.com.au; minh.c...@dektech.com.au;
gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net; phuc.h.chau

Subject: [PATCH 1/1] smf: Improve SmfAdminStateHandler() Return false if
Fail [#3104]

SW upgrade testing, if found that if a service unit is in
INSTANTIATION_FAILED,
one_step upgrade will not continue with the software installation.
---
 src/smf/smfd/SmfAdminState.cc | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 src/smf/smfd/SmfAdminState.cc

diff --git a/src/smf/smfd/SmfAdminState.cc b/src/smf/smfd/SmfAdminState.cc
old mode 100644
new mode 100755
index 076f9f0..4730215
--- a/src/smf/smfd/SmfAdminState.cc
+++ b/src/smf/smfd/SmfAdminState.cc
@@ -858,7 +858,7 @@ bool SmfAdminStateHandler::deleteNodeGroup() {
 bool SmfAdminStateHandler::nodeGroupAdminOperation(
 SaAmfAdminOperationIdT adminOp) {
 
-  bool method_rc = true;
+  bool method_rc = false;
 
   TRACE_ENTER();
 
@@ -920,20 +920,17 @@ bool SmfAdminStateHandler::nodeGroupAdminOperation(
   } else if (imm_rc != SA_AIS_OK) {
 LOG_NO("%s adminOpTimeout Fail %s", __FUNCTION__,
saf_error(imm_rc));
 errno_ = imm_rc;
-method_rc = false;
   } else {
 LOG_NO("%s adminOpTimeout Fail %s", __FUNCTION__,
saf_error(oi_rc));
 errno_ = oi_rc;
-method_rc = false;
   }
 }
   } else {
 LOG_NO("%s: becomeAdminOwnerOf(%s) Fail", __FUNCTION__,
nodeGroupName_s.c_str());
-method_rc = false;
   }
 
-  if (method_rc == true) {
+  if (admset_rc == true) {
 TRACE("%s Admin operation is done. Release ownership if nodegroup",
   __FUNCTION__);
 if (releaseAdminOwnerOf(nodeGroupName_s) == false) {
-- 
2.7.4




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



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


[devel] [PATCH 0/1] Review Request for smf: Fix c-linkage and string op errors V3 [#3065]

2019-08-25 Thread Thanh Nguyen
Summary: smf: Fix c-linkage and string op errors V3 [#3065]
Review request for Ticket(s): 3065
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3065
Base revision: a60c538f45737ffd216e9b353aba6bdc4b0f8b03
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 89397fe5fc1dc1a80d931871c31becde45409a71
Author: Thanh Nguyen 
Date:   Mon, 26 Aug 2019 15:16:43 +1000

smf: Fix c-linkage and string op errors V3 [#3065]

- Fix faults in C linkage in file
  src/smf/smfd/SmfUtils.h.
- Fix fault in string concatenation in file
  src/smf/smfd/SmfUpgradeCampaign.cc



Complete diffstat:
--
 src/smf/smfd/SmfUpgradeCampaign.cc | 3 ++-
 src/smf/smfd/SmfUtils.h| 7 ---
 2 files changed, 2 insertions(+), 8 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] smf: Fix c-linkage and string op errors V2 [#3065]

2019-08-25 Thread Thanh Nguyen
- Fix faults in C linkage in file
  src/smf/smfd/SmfUtils.h.
- Fix fault in string concatenation in file
  src/smf/smfd/SmfUpgradeCampaign.cc
---
 src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
 src/smf/smfd/SmfUtils.h| 10 ++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc 
b/src/smf/smfd/SmfUpgradeCampaign.cc
index 3c50bf7..4a1591a 100644
--- a/src/smf/smfd/SmfUpgradeCampaign.cc
+++ b/src/smf/smfd/SmfUpgradeCampaign.cc
@@ -930,7 +930,8 @@ void SmfUpgradeCampaign::continueExec() {
 if (o_result == true) {
   LOG_NO("The campaign have been restarted to many times");
   int cnt = smfd_cb->smfCampMaxRestart;
-  std::string error = "To many campaign restarts, max " + cnt;
+  std::string error = "To many campaign restarts, max "
+  + std::to_string(cnt);
   SmfCampaignThread::instance()->campaign()->setError(error);
   changeState(SmfCampStateExecFailed::instance());
   TRACE_LEAVE();
diff --git a/src/smf/smfd/SmfUtils.h b/src/smf/smfd/SmfUtils.h
index 894e3c9..5e47696 100644
--- a/src/smf/smfd/SmfUtils.h
+++ b/src/smf/smfd/SmfUtils.h
@@ -42,6 +42,12 @@
 class SmfImmOperation;
 class SmfRollbackCcb;
 
+extern std::string smf_valueToString(SaImmAttrValueT value,
+ SaImmValueTypeT type);
+extern const std::string smfStateToString(const uint32_t& i_stateId,
+  const uint32_t& i_state);
+
+
 /* 
  *   TYPE DEFINITIONS
  * 
@@ -62,15 +68,11 @@ extern bool smf_stringsToValues(SaImmAttrValuesT_2* 
i_attribute,
 std::list& i_values);
 extern bool smf_stringToValue(SaImmValueTypeT i_type, SaImmAttrValueT* i_value,
   const char* i_str);
-extern std::string smf_valueToString(SaImmAttrValueT value,
- SaImmValueTypeT type);
 extern int smf_opStringToInt(const char* i_str);
 extern int smf_system(std::string i_cmd);
 extern void updateSaflog(const std::string& i_dn, const uint32_t& i_stateId,
  const uint32_t& i_newState,
  const uint32_t& i_oldState);
-extern const std::string smfStateToString(const uint32_t& i_stateId,
-  const uint32_t& i_state);
 extern bool compare_du_part(unitNameAndState& first, unitNameAndState& second);
 extern bool unique_du_part(unitNameAndState& first, unitNameAndState& second);
 
-- 
2.7.4



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


[devel] [PATCH 0/1] Review Request for smf: Fix c-linkage and string op errors V2 [#3065]

2019-08-25 Thread Thanh Nguyen
Summary: smf: Fix c-linkage and string op errors V2 [#3065]
Review request for Ticket(s): 3065
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3065
Base revision: 252c36529095306e57a859177f9a74f47809b50d
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 55631b6dd1e4283b643d52804fc6e8a680ce09a5
Author: Thanh Nguyen 
Date:   Mon, 26 Aug 2019 11:36:13 +1000

smf: Fix c-linkage and string op errors V2 [#3065]

- Fix faults in C linkage in file
  src/smf/smfd/SmfUtils.h.
- Fix fault in string concatenation in file
  src/smf/smfd/SmfUpgradeCampaign.cc



Complete diffstat:
--
 src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
 src/smf/smfd/SmfUtils.h| 10 ++
 2 files changed, 8 insertions(+), 5 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


Re: [devel] [PATCH 1/1] smf: Fix c-linkage errors [#3065]

2019-08-22 Thread Thanh Nguyen
Hi Vu,

I have changed the patch according to the comments.
I will push the patch after testing.
Best Regards,
Thanh

-Original Message-
From: Nguyen Minh Vu [mailto:vu.m.ngu...@dektech.com.au] 
Sent: Thursday, 22 August 2019 9:06 PM
To: Thanh Nguyen; gary@dektech.com.au; thang.d.ngu...@dektech.com.au; 
minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] smf: Fix c-linkage errors [#3065]

+ Add Lennart to reviewers list

Those methods that are wrapped inside 'extern "C"' 
(/smf/smfd/SmfUtils.h) seem to be called from C++ source files only.

So, perhaps the simple fix for that is moving them out of 'extern "C"'.

Regards, Vu

On 8/20/19 8:12 AM, Thanh Nguyen wrote:
> Faults in C linkage for PBE area is fixed.
> ---
>   src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
>   src/smf/smfd/SmfUtils.cc   | 14 ++
>   src/smf/smfd/SmfUtils.h| 10 --
>   3 files changed, 24 insertions(+), 3 deletions(-)
>
> diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc 
> b/src/smf/smfd/SmfUpgradeCampaign.cc
> index 3c50bf7..4a1591a 100644
> --- a/src/smf/smfd/SmfUpgradeCampaign.cc
> +++ b/src/smf/smfd/SmfUpgradeCampaign.cc
> @@ -930,7 +930,8 @@ void SmfUpgradeCampaign::continueExec() {
>   if (o_result == true) {
> LOG_NO("The campaign have been restarted to many times");
> int cnt = smfd_cb->smfCampMaxRestart;
> -  std::string error = "To many campaign restarts, max " + cnt;
> +  std::string error = "To many campaign restarts, max "
> +  + std::to_string(cnt);
> SmfCampaignThread::instance()->campaign()->setError(error);
> changeState(SmfCampStateExecFailed::instance());
> TRACE_LEAVE();
> diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc
> index 882a3e6..0abb4b1 100644
> --- a/src/smf/smfd/SmfUtils.cc
> +++ b/src/smf/smfd/SmfUtils.cc
> @@ -1091,6 +1091,13 @@ std::string smf_valueToString(SaImmAttrValueT value, 
> SaImmValueTypeT type) {
> return ost.str();
>   }
>   
> +char* smf_valueToString(char* buffer, SaImmAttrValueT value,
> +SaImmValueTypeT type) {
> +  std::string tmp = smf_valueToString(value, type);
> +  memcpy(buffer, tmp.c_str(), tmp.length());
> +  return buffer;
> +}
> +
>   // 
> --
>   // smf_opStringToInt()
>   // 
> --
> @@ -1342,6 +1349,13 @@ const std::string smfStateToString(const uint32_t 
> _stateId,
> }
>   }
>   
> +char* smfStateToString(char* buffer, const uint32_t _stateId,
> +   const uint32_t _state) {
> +  std::string tmp = smfStateToString(i_stateId, i_state);
> +  memcpy(buffer, tmp.c_str(), tmp.length());
> +  return buffer;
> +}
> +
>   bool compare_du_part(unitNameAndState , unitNameAndState ) {
> unsigned int i = 0;
> while ((i < first.name.length()) && (i < second.name.length())) {
> diff --git a/src/smf/smfd/SmfUtils.h b/src/smf/smfd/SmfUtils.h
> index 894e3c9..394c000 100644
> --- a/src/smf/smfd/SmfUtils.h
> +++ b/src/smf/smfd/SmfUtils.h
> @@ -42,6 +42,12 @@
>   class SmfImmOperation;
>   class SmfRollbackCcb;
>   
> +extern std::string smf_valueToString(SaImmAttrValueT value,
> + SaImmValueTypeT type);
> +extern const std::string smfStateToString(const uint32_t& i_stateId,
> +  const uint32_t& i_state);
> +
> +
>   /* 
>*   TYPE DEFINITIONS
>* 
> @@ -62,14 +68,14 @@ extern bool smf_stringsToValues(SaImmAttrValuesT_2* 
> i_attribute,
>   std::list& i_values);
>   extern bool smf_stringToValue(SaImmValueTypeT i_type, SaImmAttrValueT* 
> i_value,
> const char* i_str);
> -extern std::string smf_valueToString(SaImmAttrValueT value,
> +extern char* smf_valueToString(char* buffer, SaImmAttrValueT value,
>SaImmValueTypeT type);
>   extern int smf_opStringToInt(const char* i_str);
>   extern int smf_system(std::string i_cmd);
>   extern void updateSaflog(const std::string& i_dn, const uint32_t& i_stateId,
>const uint32_t& i_newState,
>const uint32_t& i_oldState);
> -extern const std::string smfStateToString(const uint32_t& i_stateId,
> +extern char* smfStateToString(char* buffer, const ui

[devel] [PATCH 1/1] smf: Fix c-linkage errors [#3065]

2019-08-19 Thread Thanh Nguyen
Faults in C linkage for PBE area is fixed.
---
 src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
 src/smf/smfd/SmfUtils.cc   | 14 ++
 src/smf/smfd/SmfUtils.h| 10 --
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/smf/smfd/SmfUpgradeCampaign.cc 
b/src/smf/smfd/SmfUpgradeCampaign.cc
index 3c50bf7..4a1591a 100644
--- a/src/smf/smfd/SmfUpgradeCampaign.cc
+++ b/src/smf/smfd/SmfUpgradeCampaign.cc
@@ -930,7 +930,8 @@ void SmfUpgradeCampaign::continueExec() {
 if (o_result == true) {
   LOG_NO("The campaign have been restarted to many times");
   int cnt = smfd_cb->smfCampMaxRestart;
-  std::string error = "To many campaign restarts, max " + cnt;
+  std::string error = "To many campaign restarts, max "
+  + std::to_string(cnt);
   SmfCampaignThread::instance()->campaign()->setError(error);
   changeState(SmfCampStateExecFailed::instance());
   TRACE_LEAVE();
diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc
index 882a3e6..0abb4b1 100644
--- a/src/smf/smfd/SmfUtils.cc
+++ b/src/smf/smfd/SmfUtils.cc
@@ -1091,6 +1091,13 @@ std::string smf_valueToString(SaImmAttrValueT value, 
SaImmValueTypeT type) {
   return ost.str();
 }
 
+char* smf_valueToString(char* buffer, SaImmAttrValueT value,
+SaImmValueTypeT type) {
+  std::string tmp = smf_valueToString(value, type);
+  memcpy(buffer, tmp.c_str(), tmp.length());
+  return buffer;
+}
+
 // 
--
 // smf_opStringToInt()
 // 
--
@@ -1342,6 +1349,13 @@ const std::string smfStateToString(const uint32_t 
_stateId,
   }
 }
 
+char* smfStateToString(char* buffer, const uint32_t _stateId,
+   const uint32_t _state) {
+  std::string tmp = smfStateToString(i_stateId, i_state);
+  memcpy(buffer, tmp.c_str(), tmp.length());
+  return buffer;
+}
+
 bool compare_du_part(unitNameAndState , unitNameAndState ) {
   unsigned int i = 0;
   while ((i < first.name.length()) && (i < second.name.length())) {
diff --git a/src/smf/smfd/SmfUtils.h b/src/smf/smfd/SmfUtils.h
index 894e3c9..394c000 100644
--- a/src/smf/smfd/SmfUtils.h
+++ b/src/smf/smfd/SmfUtils.h
@@ -42,6 +42,12 @@
 class SmfImmOperation;
 class SmfRollbackCcb;
 
+extern std::string smf_valueToString(SaImmAttrValueT value,
+ SaImmValueTypeT type);
+extern const std::string smfStateToString(const uint32_t& i_stateId,
+  const uint32_t& i_state);
+
+
 /* 
  *   TYPE DEFINITIONS
  * 
@@ -62,14 +68,14 @@ extern bool smf_stringsToValues(SaImmAttrValuesT_2* 
i_attribute,
 std::list& i_values);
 extern bool smf_stringToValue(SaImmValueTypeT i_type, SaImmAttrValueT* i_value,
   const char* i_str);
-extern std::string smf_valueToString(SaImmAttrValueT value,
+extern char* smf_valueToString(char* buffer, SaImmAttrValueT value,
  SaImmValueTypeT type);
 extern int smf_opStringToInt(const char* i_str);
 extern int smf_system(std::string i_cmd);
 extern void updateSaflog(const std::string& i_dn, const uint32_t& i_stateId,
  const uint32_t& i_newState,
  const uint32_t& i_oldState);
-extern const std::string smfStateToString(const uint32_t& i_stateId,
+extern char* smfStateToString(char* buffer, const uint32_t& i_stateId,
   const uint32_t& i_state);
 extern bool compare_du_part(unitNameAndState& first, unitNameAndState& second);
 extern bool unique_du_part(unitNameAndState& first, unitNameAndState& second);
-- 
2.7.4



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


[devel] [PATCH 0/1] Review Request for smf: Fix c-linkage errors [#3065]

2019-08-19 Thread Thanh Nguyen
Summary: smf: Fix c-linkage errors [#3065]
Review request for Ticket(s): 3065
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3065
Base revision: 4f510540b9c3c0f9ff466cb2b8d7c03302094611
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 5877ece8c04aea7914efad6481faded44790607c
Author: Thanh Nguyen 
Date:   Tue, 20 Aug 2019 10:36:20 +1000

smf: Fix c-linkage errors [#3065]

Faults in C linkage for PBE area is fixed.



Complete diffstat:
--
 src/smf/smfd/SmfUpgradeCampaign.cc |  3 ++-
 src/smf/smfd/SmfUtils.cc   | 14 ++
 src/smf/smfd/SmfUtils.h| 10 --
 3 files changed, 24 insertions(+), 3 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.
---
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/imm/common/immpbe_dump.cc b/src/imm/common/immpbe_dump.cc
index e6b3cc5..ee8950d 100644
--- a/src/imm/common/immpbe_dump.cc
+++ b/src/imm/common/immpbe_dump.cc
@@ -150,8 +150,8 @@ static const char *preparedSql[] = {
 static sqlite3_stmt *preparedStmt[SQL_STMT_SIZE] = {NULL};
 
 struct ObjectInfo {
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *dn;
 };
 
@@ -569,8 +569,8 @@ void pbeAtomicSwitchFile(const char *filePath, std::string 
localTmpFilename) {
 // Reverse object DN and use the reverse DN as key in sReverseDnMap
 // which is used mainly to collect child objects when we perform cascade 
delete.
 static void reverseAndInsertDn(const std::string ,
-   unsigned obj_id,
-   unsigned class_id) {
+   int obj_id,
+   int class_id) {
   ObjectInfo *info = new ObjectInfo();
   osafassert(info);
 
@@ -596,8 +596,8 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   sqlite3_stmt *stmt = nullptr;
   int rc;
   bool ret = false;
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *class_name;
   std::string dn;
   int count = 0;
@@ -611,7 +611,7 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   }
 
   while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
-class_id = static_cast(sqlite3_column_int(stmt, 0));
+class_id = sqlite3_column_int(stmt, 0);
 class_name = const_cast(reinterpret_cast
(sqlite3_column_text(stmt, 1)));
 
@@ -707,7 +707,7 @@ static bool deleteObjectList(sqlite3 *dbHandle,
   sqlite3_stmt *stmt = nullptr;
   int rc = 0;
   bool ret = false;
-  unsigned object_id;
+  int object_id;
 
   TRACE_ENTER();
 
@@ -1225,7 +1225,7 @@ void pbeCleanTmpFiles(std::string localTmpFilename) {
 }
 
 ClassInfo *classToPBE(std::string classNameString, SaImmHandleT immHandle,
-  void *db_handle, unsigned int class_id) {
+  void *db_handle, int class_id) {
   SaImmClassCategoryT classCategory;
   SaImmAttrDefinitionT_2 **attrDefinitions;
   SaAisErrorT errorCode;
@@ -1563,7 +1563,7 @@ static ClassInfo *verifyClassPBE(std::string 
classNameString,
  void *db_handle, bool *badfile) {
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   sqlite3_stmt *stmt;
 
@@ -2479,9 +2479,9 @@ bailout:
 }
 
 int dumpInstancesOfClassToPBE(SaImmHandleT immHandle, ClassMap *classIdMap,
-  std::string className, unsigned int *objIdCount,
+  std::string className, int *objIdCount,
   void *db_handle) {
-  unsigned int obj_count = 0;
+  int obj_count = 0;
   SaImmSearchHandleT searchHandle;
   SaAisErrorT errorCode;
   SaNameT objectName;
@@ -2591,11 +2591,11 @@ bailout:
 }
 
 bool objectToPBE(std::string objectNameString, const SaImmAttrValuesT_2 
**attrs,
- ClassMap *classIdMap, void *db_handle, unsigned int object_id,
+ ClassMap *classIdMap, void *db_handle, int object_id,
  SaImmClassNameT className, SaUint64T ccb_id) {
   std::string valueString;
   std::string classNameString;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   int rc = 0;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
@@ -2752,7 +2752,7 @@ bool dumpClassesToPbe(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   std::list classNameList;
   std::list::iterator it;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   char *execErr = NULL;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   TRACE_ENTER();
@@ -2847,13 +2847,13 @@ int verifyPbeState(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   }
 
   if (nrows != 1) {
-LOG_ER("Expected 1 row got %u rows (line: %u)", nrows, __LINE__);
+LOG_ER("Expected 1 row got %d rows (line: %u)", nrows, __LINE__);
 badfile = true;
 goto bailout;
   }
 
-  obj_count = strtoul(result[ncols], NULL, 0);
-  TRACE("verifPbeState: obj_count:%u", obj_count);
+  obj_count = strtol(result[ncols], NULL, 0);
+  TRACE("verifPbeState: obj_count:%d", obj_count);
 
   rc = 

[devel] [PATCH 0/1] Review Request for imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
Summary: imm: Fix Object ID and Class ID type inconsistency [#2770]
Review request for Ticket(s): 2770
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2770
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision f697ae3e82908632a8bb9265de345143927b5a4f
Author: Thanh Nguyen 
Date:   Fri, 9 Aug 2019 09:59:03 +1000

imm: Fix Object ID and Class ID type inconsistency [#2770]

In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.



Complete diffstat:
--
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 0/1] Review Request for imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
Summary: imm: Fix Object ID and Class ID type inconsistency [#2770]
Review request for Ticket(s): 2770
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2770
Base revision: 6a330733244d0497fcc9524bfcae0bb523549e16
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision f697ae3e82908632a8bb9265de345143927b5a4f
Author: Thanh Nguyen 
Date:   Fri, 9 Aug 2019 09:59:03 +1000

imm: Fix Object ID and Class ID type inconsistency [#2770]

In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.



Complete diffstat:
--
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


[devel] [PATCH 1/1] imm: Fix Object ID and Class ID type inconsistency [#2770]

2019-08-08 Thread Thanh Nguyen
In IMM, for PBE, IMM uses the mix type of unsigned int
and signed int for Class ID and Object ID. These data are
stored in sqlite3 data base as 32-bit integers. Cast
is used when reading data back from sqlite3 data base.

Applying Google C++ Style Guide, Class ID and Object
ID are now signed int.

One minor code change in the affected area is implemented
to fix Static Code Checker error.
---
 src/imm/common/immpbe_dump.cc| 44 
 src/imm/common/immpbe_dump.h | 10 -
 src/imm/immpbed/immpbe.h |  2 +-
 src/imm/immpbed/immpbe_daemon.cc | 18 
 4 files changed, 36 insertions(+), 38 deletions(-)

diff --git a/src/imm/common/immpbe_dump.cc b/src/imm/common/immpbe_dump.cc
index e6b3cc5..ee8950d 100644
--- a/src/imm/common/immpbe_dump.cc
+++ b/src/imm/common/immpbe_dump.cc
@@ -150,8 +150,8 @@ static const char *preparedSql[] = {
 static sqlite3_stmt *preparedStmt[SQL_STMT_SIZE] = {NULL};
 
 struct ObjectInfo {
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *dn;
 };
 
@@ -569,8 +569,8 @@ void pbeAtomicSwitchFile(const char *filePath, std::string 
localTmpFilename) {
 // Reverse object DN and use the reverse DN as key in sReverseDnMap
 // which is used mainly to collect child objects when we perform cascade 
delete.
 static void reverseAndInsertDn(const std::string ,
-   unsigned obj_id,
-   unsigned class_id) {
+   int obj_id,
+   int class_id) {
   ObjectInfo *info = new ObjectInfo();
   osafassert(info);
 
@@ -596,8 +596,8 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   sqlite3_stmt *stmt = nullptr;
   int rc;
   bool ret = false;
-  unsigned obj_id;
-  unsigned class_id;
+  int obj_id;
+  int class_id;
   char *class_name;
   std::string dn;
   int count = 0;
@@ -611,7 +611,7 @@ static bool prepareLocalData(sqlite3 *dbHandle) {
   }
 
   while((rc = sqlite3_step(stmt)) == SQLITE_ROW) {
-class_id = static_cast(sqlite3_column_int(stmt, 0));
+class_id = sqlite3_column_int(stmt, 0);
 class_name = const_cast(reinterpret_cast
(sqlite3_column_text(stmt, 1)));
 
@@ -707,7 +707,7 @@ static bool deleteObjectList(sqlite3 *dbHandle,
   sqlite3_stmt *stmt = nullptr;
   int rc = 0;
   bool ret = false;
-  unsigned object_id;
+  int object_id;
 
   TRACE_ENTER();
 
@@ -1225,7 +1225,7 @@ void pbeCleanTmpFiles(std::string localTmpFilename) {
 }
 
 ClassInfo *classToPBE(std::string classNameString, SaImmHandleT immHandle,
-  void *db_handle, unsigned int class_id) {
+  void *db_handle, int class_id) {
   SaImmClassCategoryT classCategory;
   SaImmAttrDefinitionT_2 **attrDefinitions;
   SaAisErrorT errorCode;
@@ -1563,7 +1563,7 @@ static ClassInfo *verifyClassPBE(std::string 
classNameString,
  void *db_handle, bool *badfile) {
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   sqlite3_stmt *stmt;
 
@@ -2479,9 +2479,9 @@ bailout:
 }
 
 int dumpInstancesOfClassToPBE(SaImmHandleT immHandle, ClassMap *classIdMap,
-  std::string className, unsigned int *objIdCount,
+  std::string className, int *objIdCount,
   void *db_handle) {
-  unsigned int obj_count = 0;
+  int obj_count = 0;
   SaImmSearchHandleT searchHandle;
   SaAisErrorT errorCode;
   SaNameT objectName;
@@ -2591,11 +2591,11 @@ bailout:
 }
 
 bool objectToPBE(std::string objectNameString, const SaImmAttrValuesT_2 
**attrs,
- ClassMap *classIdMap, void *db_handle, unsigned int object_id,
+ ClassMap *classIdMap, void *db_handle, int object_id,
  SaImmClassNameT className, SaUint64T ccb_id) {
   std::string valueString;
   std::string classNameString;
-  unsigned int class_id = 0;
+  int class_id = 0;
   ClassInfo *classInfo = NULL;
   int rc = 0;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
@@ -2752,7 +2752,7 @@ bool dumpClassesToPbe(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   std::list classNameList;
   std::list::iterator it;
   int rc = 0;
-  unsigned int class_id = 0;
+  int class_id = 0;
   char *execErr = NULL;
   sqlite3 *dbHandle = (sqlite3 *)db_handle;
   TRACE_ENTER();
@@ -2847,13 +2847,13 @@ int verifyPbeState(SaImmHandleT immHandle, ClassMap 
*classIdMap,
   }
 
   if (nrows != 1) {
-LOG_ER("Expected 1 row got %u rows (line: %u)", nrows, __LINE__);
+LOG_ER("Expected 1 row got %d rows (line: %u)", nrows, __LINE__);
 badfile = true;
 goto bailout;
   }
 
-  obj_count = strtoul(result[ncols], NULL, 0);
-  TRACE("verifPbeState: obj_count:%u", obj_count);
+  obj_count = strtol(result[ncols], NULL, 0);
+  TRACE("verifPbeState: obj_count:%d", obj_count);
 
   rc = 

[devel] [PATCH 1/1] amfnd: fix error reading from deallocated memory [#2568]

2019-06-04 Thread Thanh Nguyen
Invalid read is from the following
- avnd_evt_mds_ava_dn_evh() (amf/amfnd/comp.cc)
- avsv_create_association_class_dn() (amf/common/util.c)
Other changes are to fix cppcheck error report
---
 src/amf/amfnd/comp.cc | 17 +
 src/amf/common/util.c |  6 +++---
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc
index 38b9224..857c1dc 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -428,8 +428,10 @@ uint32_t avnd_evt_mds_ava_dn_evh(AVND_CB *cb, AVND_EVT 
*evt) {
  entry from the cbk list and delete the cbq */
   m_AVND_COMP_CBQ_INV_GET(comp, comp->term_cbq_inv_value, cbk_rec);
   comp->term_cbq_inv_value = 0;
+  uint32_t opq_hdl = 0;
+  if (cbk_rec) opq_hdl = cbk_rec->opq_hdl;
   rc = avnd_comp_clc_fsm_run(cb, comp, 
AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC);
-  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk_rec->opq_hdl, 
false);
+  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp, opq_hdl, false);
   goto done;
 }
 /* found the matching comp; trigger error processing */
@@ -2228,9 +2230,7 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb, 
AVSV_AMF_API_TYPE type,
   AVND_MSG msg;
   AVSV_ND2ND_AVND_MSG *avnd_msg;
   uint32_t rc = NCSCC_RC_SUCCESS;
-  MDS_DEST i_to_dest;
   AVSV_NDA_AVA_MSG *temp_ptr = nullptr;
-  NODE_ID node_id = 0;
   MDS_SYNC_SND_CTXT temp_ctxt;
   TRACE_ENTER();
 
@@ -2267,8 +2267,8 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb, 
AVSV_AMF_API_TYPE type,
 msg.info.avnd->type = AVND_AVND_AVA_MSG;
 msg.type = AVND_MSG_AVND;
 /* Send it to AvND */
-node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
-i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
+NODE_ID node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
+MDS_DEST i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
 rc = avnd_avnd_mds_send(cb, i_to_dest, );
   } else {
 /* now send the response */
@@ -2646,7 +2646,8 @@ void avnd_comp_cmplete_all_assignment(AVND_CB *cb, 
AVND_COMP *comp) {
  */
 temp_csi = m_AVND_COMPDB_REC_CSI_GET_FIRST(*comp);
 
-if (cbk->cbk_info->param.csi_set.ha != temp_csi->si->curr_state) {
+if (temp_csi &&
+   (cbk->cbk_info->param.csi_set.ha != temp_csi->si->curr_state)) {
   avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk->opq_hdl, true);
   continue;
 }
@@ -2788,7 +2789,7 @@ uint32_t comp_restart_initiate(AVND_COMP *comp) {
 rc = avnd_comp_curr_info_del(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
-   // unregister the contained comp
+// unregister the contained comp
 rc = avnd_comp_unregister_contained(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
@@ -2956,7 +2957,7 @@ void avnd_comp_pres_state_set(const AVND_CB *cb, 
AVND_COMP *comp,
  (SA_AMF_PRESENCE_ORPHANED == prv_st {
 if (cb->is_avd_down == false) {
   avnd_di_uns32_upd_send(AVSV_SA_AMF_COMP, saAmfCompPresenceState_ID,
- comp->name.c_str(), comp->pres);
+ comp->name, comp->pres);
 }
   }
 
diff --git a/src/amf/common/util.c b/src/amf/common/util.c
index ec76c32..d17b766 100644
--- a/src/amf/common/util.c
+++ b/src/amf/common/util.c
@@ -240,12 +240,12 @@ void avsv_create_association_class_dn(const SaNameT 
*child_dn,
}
 
if (dn) {
+   TRACE("dn: %s", buf);
osaf_extended_name_steal(buf, dn);
}
-   TRACE_LEAVE2("child_dn: %s parent_dn: %s dn: %s",
+   TRACE_LEAVE2("child_dn: %s parent_dn: %s",
child_dn_ptr ? child_dn_ptr : "no child dn",
-   parent_dn_ptr ? parent_dn_ptr : "no parent dn",
-   buf);
+   parent_dn_ptr ? parent_dn_ptr : "no parent dn");
 }
 
 void avsv_sanamet_init_from_association_dn(const SaNameT *haystack, SaNameT 
*dn,
-- 
2.7.4



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


[devel] [PATCH 0/1] Review Request for ticket [#2568]

2019-06-04 Thread Thanh Nguyen
Summary: amfnd: fix error reading from deallocated memory [#2568]
Review request for Ticket(s): 2568
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2568
Base revision: 135b0b8862da9a036553c5db02062edb278089aa
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 9be484f49579861f2c3325403b7680b700d47c0b
Author: Thanh Nguyen 
Date:   Wed, 5 Jun 2019 12:11:31 +1000

amfnd: fix error reading from deallocated memory [#2568]

Invalid read is from the following
- avnd_evt_mds_ava_dn_evh() (amf/amfnd/comp.cc)
- avsv_create_association_class_dn() (amf/common/util.c)
Other changes are to fix cppcheck error report



Complete diffstat:
--
 src/amf/amfnd/comp.cc | 17 +
 src/amf/common/util.c |  6 +++---
 2 files changed, 12 insertions(+), 11 deletions(-)


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


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


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


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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



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


Re: [devel] [PATCH 1/1] amfnd: fix error reading from deallocated memory [#2568]

2019-06-03 Thread Thanh Nguyen
Thanks Hans,

I will make a change and note the preferred style.
Best Regards,
Thanh

-Original Message-
From: Hans Nordebäck [mailto:hans.nordeb...@ericsson.com] 
Sent: Tuesday, 4 June 2019 3:42 PM
To: Thanh Nguyen; Gary Lee; Thuan Tran; Thang Duc Nguyen
Cc: opensaf-devel@lists.sourceforge.net
Subject: RE: [devel] [PATCH 1/1] amfnd: fix error reading from deallocated
memory [#2568]

Hi Thanh, one minor comment below/Thanks HansN

-Original Message-
From: Thanh Nguyen  
Sent: den 4 juni 2019 00:48
To: Gary Lee ; Thuan Tran
; Thang Duc Nguyen

Cc: opensaf-devel@lists.sourceforge.net
Subject: [devel] [PATCH 1/1] amfnd: fix error reading from deallocated
memory [#2568]

Invalid read is from the following
- avnd_evt_mds_ava_dn_evh() (amf/amfnd/comp.cc)
- avsv_create_association_class_dn() (amf/common/util.c) Other changes are
to fix cppcheck error report
---
 src/amf/amfnd/comp.cc | 16   src/amf/common/util.c |  6
+++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc index
38b9224..facbace 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -428,8 +428,9 @@ uint32_t avnd_evt_mds_ava_dn_evh(AVND_CB *cb, AVND_EVT
*evt) {
  entry from the cbk list and delete the cbq */
   m_AVND_COMP_CBQ_INV_GET(comp, comp->term_cbq_inv_value, cbk_rec);
   comp->term_cbq_inv_value = 0;
[HansN] why use a conditional expr? Preferred, 
uint32_t opq_hdl = 0; 
if (cbk_rec) opq_hdl = cbk_rec->opq_hdl;
+  uint32_t opq_hdl = cbk_rec? cbk_rec->opq_hdl: 0;
   rc = avnd_comp_clc_fsm_run(cb, comp,
AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC);
-  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp,
cbk_rec->opq_hdl, false);
+  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp, opq_hdl, 
+ false);
   goto done;
 }
 /* found the matching comp; trigger error processing */ @@ -2228,9
+2229,7 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb, AVSV_AMF_API_TYPE type,
   AVND_MSG msg;
   AVSV_ND2ND_AVND_MSG *avnd_msg;
   uint32_t rc = NCSCC_RC_SUCCESS;
-  MDS_DEST i_to_dest;
   AVSV_NDA_AVA_MSG *temp_ptr = nullptr;
-  NODE_ID node_id = 0;
   MDS_SYNC_SND_CTXT temp_ctxt;
   TRACE_ENTER();
 
@@ -2267,8 +2266,8 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb,
AVSV_AMF_API_TYPE type,
 msg.info.avnd->type = AVND_AVND_AVA_MSG;
 msg.type = AVND_MSG_AVND;
 /* Send it to AvND */
-node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
-i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
+NODE_ID node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
+MDS_DEST i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
 rc = avnd_avnd_mds_send(cb, i_to_dest, );
   } else {
 /* now send the response */
@@ -2646,7 +2645,8 @@ void avnd_comp_cmplete_all_assignment(AVND_CB *cb,
AVND_COMP *comp) {
  */
 temp_csi = m_AVND_COMPDB_REC_CSI_GET_FIRST(*comp);
 
-if (cbk->cbk_info->param.csi_set.ha != temp_csi->si->curr_state) {
+if (temp_csi &&
+   (cbk->cbk_info->param.csi_set.ha !=
temp_csi->si->curr_state)) {
   avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk->opq_hdl, true);
   continue;
 }
@@ -2788,7 +2788,7 @@ uint32_t comp_restart_initiate(AVND_COMP *comp) {
 rc = avnd_comp_curr_info_del(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
-   // unregister the contained comp
+// unregister the contained comp
 rc = avnd_comp_unregister_contained(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
@@ -2956,7 +2956,7 @@ void avnd_comp_pres_state_set(const AVND_CB *cb,
AVND_COMP *comp,
  (SA_AMF_PRESENCE_ORPHANED == prv_st {
 if (cb->is_avd_down == false) {
   avnd_di_uns32_upd_send(AVSV_SA_AMF_COMP, saAmfCompPresenceState_ID,
- comp->name.c_str(), comp->pres);
+ comp->name, comp->pres);
 }
   }
 
diff --git a/src/amf/common/util.c b/src/amf/common/util.c index
ec76c32..d17b766 100644
--- a/src/amf/common/util.c
+++ b/src/amf/common/util.c
@@ -240,12 +240,12 @@ void avsv_create_association_class_dn(const SaNameT
*child_dn,
}
 
if (dn) {
+   TRACE("dn: %s", buf);
osaf_extended_name_steal(buf, dn);
}
-   TRACE_LEAVE2("child_dn: %s parent_dn: %s dn: %s",
+   TRACE_LEAVE2("child_dn: %s parent_dn: %s",
child_dn_ptr ? child_dn_ptr : "no child dn",
-   parent_dn_ptr ? parent_dn_ptr : "no parent dn",
-   buf);
+   parent_dn_ptr ? parent_dn_ptr : "no parent dn");
 }
 
 void avsv_sanamet_init_from_association_dn(const SaNameT *haystack, SaNameT
*dn,
--
2.7.4



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourc

[devel] [PATCH 0/1] Review Request for [#2568]

2019-06-03 Thread Thanh Nguyen
Summary: amfnd: fix error reading from deallocated memory [#2568]
Review request for Ticket(s): 2568
Peer Reviewer(s): *** LIST THE TECH REVIEWER(S) / MAINTAINER(S) HERE ***
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2568
Base revision: b0dd5b39172e01d644a84804abda2b1ded6e81cc
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

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


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

revision 6262b7ce828b8080cb2f05942b422091afb18c3a
Author: Thanh Nguyen 
Date:   Mon, 3 Jun 2019 16:24:20 +1000

amfnd: fix error reading from deallocated memory [#2568]

Invalid read is from the following
- avnd_evt_mds_ava_dn_evh() (amf/amfnd/comp.cc)
- avsv_create_association_class_dn() (amf/common/util.c)
Other changes are to fix cppcheck error report



Complete diffstat:
--
 src/amf/amfnd/comp.cc | 16 
 src/amf/common/util.c |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)


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


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


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


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


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] amfnd: fix error reading from deallocated memory [#2568]

2019-06-03 Thread Thanh Nguyen
Invalid read is from the following
- avnd_evt_mds_ava_dn_evh() (amf/amfnd/comp.cc)
- avsv_create_association_class_dn() (amf/common/util.c)
Other changes are to fix cppcheck error report
---
 src/amf/amfnd/comp.cc | 16 
 src/amf/common/util.c |  6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/amf/amfnd/comp.cc b/src/amf/amfnd/comp.cc
index 38b9224..facbace 100644
--- a/src/amf/amfnd/comp.cc
+++ b/src/amf/amfnd/comp.cc
@@ -428,8 +428,9 @@ uint32_t avnd_evt_mds_ava_dn_evh(AVND_CB *cb, AVND_EVT 
*evt) {
  entry from the cbk list and delete the cbq */
   m_AVND_COMP_CBQ_INV_GET(comp, comp->term_cbq_inv_value, cbk_rec);
   comp->term_cbq_inv_value = 0;
+  uint32_t opq_hdl = cbk_rec? cbk_rec->opq_hdl: 0;
   rc = avnd_comp_clc_fsm_run(cb, comp, 
AVND_COMP_CLC_PRES_FSM_EV_TERM_SUCC);
-  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk_rec->opq_hdl, 
false);
+  if (cbk_rec) avnd_comp_cbq_rec_pop_and_del(cb, comp, opq_hdl, false);
   goto done;
 }
 /* found the matching comp; trigger error processing */
@@ -2228,9 +2229,7 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb, 
AVSV_AMF_API_TYPE type,
   AVND_MSG msg;
   AVSV_ND2ND_AVND_MSG *avnd_msg;
   uint32_t rc = NCSCC_RC_SUCCESS;
-  MDS_DEST i_to_dest;
   AVSV_NDA_AVA_MSG *temp_ptr = nullptr;
-  NODE_ID node_id = 0;
   MDS_SYNC_SND_CTXT temp_ctxt;
   TRACE_ENTER();
 
@@ -2267,8 +2266,8 @@ uint32_t avnd_amf_resp_send(AVND_CB *cb, 
AVSV_AMF_API_TYPE type,
 msg.info.avnd->type = AVND_AVND_AVA_MSG;
 msg.type = AVND_MSG_AVND;
 /* Send it to AvND */
-node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
-i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
+NODE_ID node_id = m_NCS_NODE_ID_FROM_MDS_DEST(*dest);
+MDS_DEST i_to_dest = avnd_get_mds_dest_from_nodeid(cb, node_id);
 rc = avnd_avnd_mds_send(cb, i_to_dest, );
   } else {
 /* now send the response */
@@ -2646,7 +2645,8 @@ void avnd_comp_cmplete_all_assignment(AVND_CB *cb, 
AVND_COMP *comp) {
  */
 temp_csi = m_AVND_COMPDB_REC_CSI_GET_FIRST(*comp);
 
-if (cbk->cbk_info->param.csi_set.ha != temp_csi->si->curr_state) {
+if (temp_csi &&
+   (cbk->cbk_info->param.csi_set.ha != temp_csi->si->curr_state)) {
   avnd_comp_cbq_rec_pop_and_del(cb, comp, cbk->opq_hdl, true);
   continue;
 }
@@ -2788,7 +2788,7 @@ uint32_t comp_restart_initiate(AVND_COMP *comp) {
 rc = avnd_comp_curr_info_del(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
-   // unregister the contained comp
+// unregister the contained comp
 rc = avnd_comp_unregister_contained(cb, it.second);
 if (NCSCC_RC_SUCCESS != rc) goto done;
 
@@ -2956,7 +2956,7 @@ void avnd_comp_pres_state_set(const AVND_CB *cb, 
AVND_COMP *comp,
  (SA_AMF_PRESENCE_ORPHANED == prv_st {
 if (cb->is_avd_down == false) {
   avnd_di_uns32_upd_send(AVSV_SA_AMF_COMP, saAmfCompPresenceState_ID,
- comp->name.c_str(), comp->pres);
+ comp->name, comp->pres);
 }
   }
 
diff --git a/src/amf/common/util.c b/src/amf/common/util.c
index ec76c32..d17b766 100644
--- a/src/amf/common/util.c
+++ b/src/amf/common/util.c
@@ -240,12 +240,12 @@ void avsv_create_association_class_dn(const SaNameT 
*child_dn,
}
 
if (dn) {
+   TRACE("dn: %s", buf);
osaf_extended_name_steal(buf, dn);
}
-   TRACE_LEAVE2("child_dn: %s parent_dn: %s dn: %s",
+   TRACE_LEAVE2("child_dn: %s parent_dn: %s",
child_dn_ptr ? child_dn_ptr : "no child dn",
-   parent_dn_ptr ? parent_dn_ptr : "no parent dn",
-   buf);
+   parent_dn_ptr ? parent_dn_ptr : "no parent dn");
 }
 
 void avsv_sanamet_init_from_association_dn(const SaNameT *haystack, SaNameT 
*dn,
-- 
2.7.4



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 0/1] Review Request for clm: Incorrect encode/decode time_super [#3007]

2019-02-19 Thread Thanh Nguyen
Summary: clm: Incorrect encode/decode time_super [#3007]
Review request for Ticket(s): 3007
Peer Reviewer(s): Gary, Minh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-3007
Base revision: 8ccffc2cd9cd117578227e9cd49421e5c578fec6
Personal repository: git://git.code.sf.net/u/xdtthng/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 91806d17b2d79138f68ff3eb3449a9a6ba3dfbf0
Author: Thanh Nguyen 
Date:   Wed, 20 Feb 2019 16:01:08 +1100

clm: Incorrect encode/decode time_super [#3007]

Changing ecoding of time_super using 64 bit instead of 32 bit.



Complete diffstat:
--
 src/clm/clmd/clms_mds.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel


[devel] [PATCH 1/1] clm: Incorrect encode/decode time_super [#3007]

2019-02-19 Thread Thanh Nguyen
Changing ecoding of time_super using 64 bit instead of 32 bit.
---
 src/clm/clmd/clms_mds.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/clm/clmd/clms_mds.cc b/src/clm/clmd/clms_mds.cc
index 833d18c..5a77885 100644
--- a/src/clm/clmd/clms_mds.cc
+++ b/src/clm/clmd/clms_mds.cc
@@ -542,7 +542,7 @@ static uint32_t clms_enc_track_cbk_msg(NCS_UBAID *uba, 
CLMSV_MSG *msg) {
 TRACE("p8 nullptr!!!");
 return 0;
   }
-  ncs_encode_32bit(, track->time_super);
+  ncs_encode_64bit(, track->time_super);
   ncs_enc_claim_space(uba, 8);
   total_bytes += 8;
 
-- 
2.7.4



___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel