Re: [devel] [PATCH 0/5] Review Request for ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread praveen malviya

Hi Lennart,

NTFIMCN initializes with IMM with SAF version A.02.12.
IMM integration with CLM is done in last release and for that SAF 
version is A.02.18 (src/imm/README mentions it).
Like any legacy application, NTFIMCN should not get ERR_UNAVAILABLE from 
IMM for any API call.


Thanks,
Praveen



On 28-Jun-17 8:48 PM, Lennart Lund wrote:

Summary: ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]
Review request for Ticket(s): 2506
Peer Reviewer(s): praveen.malv...@oracle.com; minh.c...@dektech.com.au
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2506
Base revision: f089f030a322a43c79f3f259f07a4c42bb4d0da1
Personal repository: git://git.code.sf.net/u/elunlen/review


Impacted area   Impact y/n

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


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

revision beae5c3dacaa05fe68b50433251947d8c045cca7
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 17:09:23 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()



revision 7c3bc31dda6099becf7f246093d0bd7b0d652340
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()

long_description



revision caa854ce873f90208a5a14894b51c997e25a924c
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.



revision 0db3b249ffa8d00b05cc7aefecb1d422c30c8faf
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.



revision 71763df94b6d58d6e553fa26cc41dbd7cb7d264a
Author: Lennart Lund 
Date:   Tue, 27 Jun 2017 16:05:44 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.



revision 8f43f5d28b282812926d5a5bad29e604c76e4697
Author: Lennart Lund 
Date:   Mon, 26 Jun 2017 14:03:38 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.



Complete diffstat:
--
  src/ntf/ntfimcnd/ntfimcn_imm.c  | 205 
  src/ntf/ntfimcnd/ntfimcn_imm.h  |  11 ++-
  src/ntf/ntfimcnd/ntfimcn_main.h |   2 +-
  3 files changed, 158 insertions(+), 60 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 

Re: [devel] [PATCH 1/1] amfd: Do not log warning when create (or delete) a existed(or nonexisted) SUSI [#2467]

2017-06-28 Thread praveen malviya

Ack, not tested.

Thanks,
Praveen

On 27-Jun-17 2:17 PM, minh chau wrote:

Hi Praveen,

I had the same thought as yours, but in case lock  then unlock , 
Create_sync (from unlock) gets ERR_EXIST because the previous 
Delete_sync(from lock) first fails and is still in queue, then we will 
not create the object. This patch doesn't mean to change any logic, it 
just doesn't make the log confusing


Thanks,
Minh

On 27/06/17 18:33, praveen malviya wrote:

Hi Minh,

One comment inline with [ Praveen].

Thanks
Praveen

On 25-May-17 12:53 PM, Minh Chau wrote:

---
  src/amf/amfd/imm.cc | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index 7b1aa333e..26faffcb5 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -1893,7 +1893,7 @@ void avd_saImmOiRtObjectCreate_sync(const 
std::string ,

  rc = saImmOiRtObjectCreate_2(avd_cb->immOiHandle,
  const_cast(className.c_str()),
  parent_name, attrValues);
-if (rc != SA_AIS_OK) {
+if (rc != SA_AIS_OK && rc != SA_AIS_ERR_EXIST) {
LOG_WA("saImmOiRtObjectCreate_2 of className:'%s', 
parentName:'%s',"
" failed with %u", className.c_str(), parentName.c_str(), 
rc);

  }
[Praveen] if return code is ERR_EXIST, then it means RT object exists 
in IMM. In such a situation second if block in this function should 
not push it in job queue.
@@ -1946,7 +1946,7 @@ void avd_saImmOiRtObjectDelete_sync(const 
std::string ) {

  if (isImmReady == true) {
  rc = saImmOiRtObjectDelete_o3(avd_cb->immOiHandle, dn.c_str());
-if (rc != SA_AIS_OK) {
+if (rc != SA_AIS_OK  && rc != SA_AIS_ERR_NOT_EXIST) {
LOG_WA("saImmOiRtObjectDelete_o3 of '%s' failed with %u", 
dn.c_str(), rc);

  }
}







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


Re: [devel] [PATCH 5/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread minh chau

Hi Lennart,

ack from me.


thanks,
Minh

On 29/06/17 01:18, Lennart Lund wrote:

Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()

long_description
---
  src/ntf/ntfimcnd/ntfimcn_imm.c  | 122 +---
  src/ntf/ntfimcnd/ntfimcn_imm.h  |   9 ---
  src/ntf/ntfimcnd/ntfimcn_main.h |   1 +
  3 files changed, 90 insertions(+), 42 deletions(-)

diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c
index d751a724c..fd97a5c6a 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -42,6 +42,11 @@
  #include "ntfimcn_notifier.h"
  
  /*

+ * Global variables
+ */
+extern ntfimcn_cb_t ntfimcn_cb; /* See ntfimcn_main.c */
+
+/*
   * Global, scope file
   */
  /* Release code, major version, minor version */
@@ -81,13 +86,73 @@ struct {
  
  #define NOTIFYING_OBJECT "safApp=safImmService"
  
-extern ntfimcn_cb_t ntfimcn_cb;

+static bool initializeImmOmHandle(SaImmHandleT* immOmHandle);
+static void finalizeImmOmHandle(SaImmHandleT immOmHandle);
+
+/**
+ * Get a class description for the given className
+ *
+ * Handles SA_AIS_ERR_TRY_AGAIN loop
+ * Also retries once if SA_AIS_ERR_UNAVAILABLE
+ * Note: Uses saImmOmClassDescriptionGet_2() that allocates memory that
+ *   has to be freed by calling saImmOmClassDescriptionMemoryFree_2()
+ *
+ * See AIS saImmOmClassDescriptionGet_2
+ * @param className[in]
+ * @param attrDescr[out]
+ * @return AIS return code
+ */
+static SaAisErrorT getClassDescription(const SaImmClassNameT className,
+   SaImmAttrDefinitionT_2 ***attrDescr)
+{
+   SaImmClassCategoryT classCategory;
+   struct timespec timeout_ts;
+   struct timespec delay_ts;
+   SaAisErrorT ais_rc;
+
+   osaf_millis_to_timespec(sleep_delay_ms, _ts);
+   osaf_set_millis_timeout(max_waiting_time_7s, _ts);
+
+   for (int i = 0; i <= 1; i++) {
+   while (osaf_is_timeout(_ts) == false) {
+   ais_rc = saImmOmClassDescriptionGet_2(
+   ntfimcn_cb.immOmHandle,
+   className, , attrDescr);
+   if ((ais_rc != SA_AIS_ERR_TRY_AGAIN) &&
+   (ais_rc != SA_AIS_ERR_TIMEOUT)) {
+   break;
+   }
+   osaf_nanosleep(_ts);
+   }
+
+   /*
+* If SA_AIS_ERR_UNAVAILABLE we may have left the CLM cluster
+* The old handle must be finalized, a new initialized and one
+* new attempt to get the class description shall be done.
+*/
+   if (ais_rc == SA_AIS_ERR_UNAVAILABLE) {
+   finalizeImmOmHandle(ntfimcn_cb.immOmHandle);
+   if (initializeImmOmHandle(_cb.immOmHandle) ==
+   false) {
+   break; /* Failed to initialize OM handle */
+   }
+   } else  break;
+   }
+
+   if (ais_rc != SA_AIS_OK) {
+   LOG_NO("%s saImmOmClassDescriptionGet_2 failed %s",
+   __FUNCTION__, saf_error(ais_rc));
+   }
+
+   return ais_rc;
+}
  
  /**

   * Get name of rdn attribute from IMM
   *
   * Note:
   * Uses in file global struct s_get_rdn_attr_name
+ * Uses global immOmHandle in struct ntfimcn_cb_t
   *
   * @param className[in]
   *
@@ -96,10 +161,8 @@ extern ntfimcn_cb_t ntfimcn_cb;
  static char *get_rdn_attr_name(const SaImmClassNameT className)
  {
SaAisErrorT rc;
-   int msecs_waited;
int i = 0;
  
-	SaImmClassCategoryT classCategory;

SaImmAttrDefinitionT_2 **attrDescr;
  
  	TRACE_ENTER();

@@ -118,25 +181,8 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
memcpy(s_get_rdn_attr_name.saved_className, className,
   strlen(className) + 1);
  
-	/* Get an IMM OM Handle */

-   SaImmHandleT immOmHandle = 0;
-   if (getImmOmHandle() == false) {
-   LOG_ER("getImmOmHandle() Fail");
-   goto error;
-   }
-
/* Get class description */
-   msecs_waited = 0;
-   rc = saImmOmClassDescriptionGet_2(immOmHandle, className,
- , );
-   while (((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT)) &&
-  (msecs_waited < max_waiting_time_7s)) {
-   usleep(sleep_delay_ms * 1000);
-   msecs_waited += sleep_delay_ms;
-   rc = saImmOmClassDescriptionGet_2(immOmHandle,
- className, ,
- );
-   }
+   rc = getClassDescription(className, );
if (rc != SA_AIS_OK) {

Re: [devel] [PATCH 1/1] imm: send imm finalize message to immnd when dispatch returns ERR_BAD_HANDLE [#2504]

2017-06-28 Thread A V Mahesh

Hi Zoran,

How you are able to catch this bug ?

Jut by manually seeing IMMND run-time size growing , while running 
threaded application !


-AVM


On 6/28/2017 7:32 PM, Zoran Milinkovic wrote:

Send IMM_FINALIZE message to immnd when dispatch functions returns 
ERR_BAD_HANDLE.
IMM_FINALIZE will release all allocated resources of a handle on IMM service 
side.
---
  src/imm/agent/imma_proc.cc | 51 ++
  1 file changed, 51 insertions(+)

diff --git a/src/imm/agent/imma_proc.cc b/src/imm/agent/imma_proc.cc
index 14ce5ab..dfd73e3 100644
--- a/src/imm/agent/imma_proc.cc
+++ b/src/imm/agent/imma_proc.cc
@@ -1745,6 +1745,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_one(IMMA_CB *cb, 
SaImmHandleT immHandle) {
imma_proc_ccbaug_setup(cl_node, callback);
m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
if (!imma_process_callback_info(cb, cl_node, callback, immHandle)) {
+IMMSV_EVT finalize_evt, *out_evt;
  /* Callback protocol could not be honored due to some lack
 of client capabilities. E.g. applier can not handle long DNs
 while regular OI can, or there is no regular OI. The capabilties
@@ -1757,6 +1758,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_one(IMMA_CB *cb, 
SaImmHandleT immHandle) {
  */
  cl_node->stale = true;
  cl_node->exposed = true;
+
+out_evt = NULL;
+memset(_evt, 0, sizeof(IMMSV_EVT));
+finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+finalize_evt.info.immnd.info.finReq.client_hdl = cl_node->handle;
+
+/* send the request to the IMMND */
+imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+   _evt, _evt,
+   cl_node->syncr_timeout);
+
+if (out_evt) {
+  free(out_evt);
+}
+
  return SA_AIS_ERR_BAD_HANDLE;
}
return SA_AIS_OK;
@@ -1810,6 +1827,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_all(IMMA_CB *cb, 
SaImmHandleT immHandle) {
imma_proc_ccbaug_setup(cl_node, callback);
m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
if (!imma_process_callback_info(cb, cl_node, callback, immHandle)) {
+IMMSV_EVT finalize_evt, *out_evt;
  /* Callback protocol could not be honored due to some lack
 of client capabilities. E.g. applier can not handle long DNs
 while regular OI can, or there is no regular OI. The capabilties
@@ -1822,6 +1840,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_all(IMMA_CB *cb, 
SaImmHandleT immHandle) {
  */
  cl_node->stale = true;
  cl_node->exposed = true;
+
+out_evt = NULL;
+memset(_evt, 0, sizeof(IMMSV_EVT));
+finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+finalize_evt.info.immnd.info.finReq.client_hdl = cl_node->handle;
+
+/* send the request to the IMMND */
+imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+   _evt, _evt,
+   cl_node->syncr_timeout);
+
+if (out_evt) {
+  free(out_evt);
+}
+
  return SA_AIS_ERR_BAD_HANDLE;
}
  } else {
@@ -1903,6 +1937,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_block(IMMA_CB *cb,
  imma_proc_ccbaug_setup(client_info, callback);
  m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
  if (!imma_process_callback_info(cb, client_info, callback, 
immHandle)) {
+  IMMSV_EVT finalize_evt, *out_evt;
/* Callback protocol could not be honored due to some lack
   of client capabilities. E.g. applier can not handle long DNs
   while regular OI can, or there is no regular OI. The capabilties
@@ -1915,6 +1950,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_block(IMMA_CB *cb,
 */
client_info->stale = true;
client_info->exposed = true;
+
+  out_evt = NULL;
+  memset(_evt, 0, sizeof(IMMSV_EVT));
+  finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+  finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+  finalize_evt.info.immnd.info.finReq.client_hdl = client_info->handle;
+
+  /* send the request to the IMMND */
+  imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+ _evt, _evt,
+ client_info->syncr_timeout);
+
+  if (out_evt) {
+free(out_evt);
+  }
+
return SA_AIS_ERR_BAD_HANDLE;
  }
} else {



--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Opensaf-devel 

Re: [devel] [PATCH 1/1] osaf: Fix build problems when using GCC 7.1.1 [#2502]

2017-06-28 Thread A V Mahesh

Hi Anders,

ACK, not tested ( need to setup  GCC 7.1.1).

-AVM

On 6/20/2017 2:27 PM, Anders Widell wrote:

Fix build problems caused by the following warnings:

* -Werror=format-overflow=
* -Werror=parentheses
* -Werror=unused-variable
---
  src/amf/amfd/imm.cc|  2 -
  src/clm/apitest/tet_ClmLongRdn.c   | 24 +---
  src/clm/apitest/tet_ClmOiOps.c | 72 +-
  src/clm/clmd/clms_imm.c|  6 +-
  src/clm/clmd/clms_ntf.c| 23 ---
  src/imm/apitest/implementer/test_SaImmOiCcb.c  | 21 ---
  .../implementer/test_saImmOiRtObjectCreate_2.c | 12 ++--
  .../management/test_saImmOmCcbObjectDelete.c   | 12 ++--
  .../management/test_saImmOmCcbObjectModify_2.c | 12 ++--
  src/ntf/apitest/tet_longDnObject_notification.c| 18 +++---
  10 files changed, 125 insertions(+), 77 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index 7b1aa333e..9c700a464 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -2306,7 +2306,6 @@ bool ImmObjCreate::immobj_update_required() {
if (class_type == AVSV_SA_AMF_SI_ASSIGNMENT) {
  std::string su_name;
  std::string sisu_name;
-std::string::size_type pos;
  while ((attribute = attrValues_[i++]) != nullptr) {
if (!strcmp(attribute->attrName, "safSISU")) {
  sisu_name = Amf::to_string(
@@ -2347,7 +2346,6 @@ bool ImmObjCreate::immobj_update_required() {
} else if (class_type == AVSV_SA_AMF_CSI_ASSIGNMENT) {
  std::string comp_name;
  std::string csicomp_name;
-std::string::size_type pos;
  AVD_CSI *csi = nullptr;
  AVD_COMP *comp = nullptr;
  AVD_COMP_CSI_REL *compcsi = nullptr;
diff --git a/src/clm/apitest/tet_ClmLongRdn.c b/src/clm/apitest/tet_ClmLongRdn.c
index e80a5fb78..53e6c1d5d 100644
--- a/src/clm/apitest/tet_ClmLongRdn.c
+++ b/src/clm/apitest/tet_ClmLongRdn.c
@@ -1,6 +1,7 @@
  /*  -*- OpenSAF  -*-
   *
   * (C) Copyright 2016 The OpenSAF Foundation
+ * Copyright Ericsson AB 2017 - All Rights Reserved.
   *
   * This program is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -15,6 +16,9 @@
   *
   */
  
+#include 

+#include 
+#include 
  #include 
  #include 
  #include 
@@ -211,8 +215,9 @@ static void unlock_node(char *nodename)
char command[1024];
  
  	// Unlock the node

-   sprintf(command, "immadm -o 1 %s", nodename);
-   assert(rc = system(command) != -1);
+   snprintf(command, sizeof(command), "immadm -o 1 %s", nodename);
+   rc = system(command);
+   assert(rc != -1);
  }
  
  static void lock_node(char *nodename)

@@ -220,8 +225,9 @@ static void lock_node(char *nodename)
int rc;
char command[1024];
// Lock the node
-   sprintf(command, "immadm -o 2 %s", nodename);
-   assert(rc = system(command) != -1);
+   snprintf(command, sizeof(command), "immadm -o 2 %s", nodename);
+   rc = system(command);
+   assert(rc != -1);
  }
  
  static void remove_node(char *nodename)

@@ -230,12 +236,14 @@ static void remove_node(char *nodename)
char command[1024];
  
  	// Lock the node

-   sprintf(command, "immadm -o 2 %s", nodename);
-   assert(rc = system(command) != -1);
+   snprintf(command, sizeof(command), "immadm -o 2 %s", nodename);
+   rc = system(command);
+   assert(rc != -1);
  
  	// Remove the node

-   sprintf(command, "immcfg -d %s", nodename);
-   assert((rc = system(command)) != -1);
+   snprintf(command, sizeof(command), "immcfg -d %s", nodename);
+   rc = system(command);
+   assert(rc != -1);
  }
  
  static void saClmLongRdn_01(void)

diff --git a/src/clm/apitest/tet_ClmOiOps.c b/src/clm/apitest/tet_ClmOiOps.c
index e6b6f9ba6..39c3a76be 100644
--- a/src/clm/apitest/tet_ClmOiOps.c
+++ b/src/clm/apitest/tet_ClmOiOps.c
@@ -1,6 +1,7 @@
  /*  -*- OpenSAF  -*-
   *
   * (C) Copyright 2008 The OpenSAF Foundation
+ * Copyright Ericsson AB 2017 - All Rights Reserved.
   *
   * This program is distributed in the hope that it will be useful, but
   * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -15,6 +16,9 @@
   *
   */
  
+#include 

+#include 
+#include 
  #include 
  #include 
  #include "clmtest.h"
@@ -23,14 +27,15 @@
  void saClmOi_01(void)
  {
int rc;
-   char command[256];
+   char command[384];
  
-	sprintf(

-   command,
+   snprintf(
+   command, sizeof(command),
"immcfg -a saClmNodeLockCallbackTimeout=40 
safNode=%s,safCluster=myClmCluster",
node_name.value);
  
-	assert((rc = system(command)) != -1);

+   rc = system(command);
+   assert(rc != -1);
test_validate(WEXITSTATUS(rc), 0);
  }
  
@@ -38,13 +43,14 @@ void saClmOi_01(void)

  void saClmOi_02(void)
  {
int rc;
-   

[devel] [PATCH 2/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.
---
 src/ntf/ntfd/ntfs_amf.c  |   8 ++--
 src/ntf/ntfd/ntfs_imcnutil.c | 105 +--
 2 files changed, 45 insertions(+), 68 deletions(-)

diff --git a/src/ntf/ntfd/ntfs_amf.c b/src/ntf/ntfd/ntfs_amf.c
index e9c521d4a..cda35d6f9 100644
--- a/src/ntf/ntfd/ntfs_amf.c
+++ b/src/ntf/ntfd/ntfs_amf.c
@@ -263,10 +263,12 @@ response:
checkNotificationList();
}
 done:
-   /* Start the osafntfimcn process if becoming active or stop the process
-* if leaving active state
+   /* Kills the osafntfimcnd process if current state is Active or Standby
+* and the process is not already running in this state. The process
+* will be restarted by the process surveillance thread. This function
+* will not return until the process is terminated.
 */
-   handle_state_ntfimcn(new_haState);
+   handle_state_ntfimcn(ntfs_cb->ha_state);
 
TRACE_LEAVE();
 }
diff --git a/src/ntf/ntfd/ntfs_imcnutil.c b/src/ntf/ntfd/ntfs_imcnutil.c
index 3add5db5a..dd27a255c 100644
--- a/src/ntf/ntfd/ntfs_imcnutil.c
+++ b/src/ntf/ntfd/ntfs_imcnutil.c
@@ -41,13 +41,13 @@
 #include "osaf/configmake.h"
 
 typedef struct {
+   SaAmfHAStateT ha_state;
pid_t pid;
pthread_t thread;
-   bool ntfimcn_on;
 } init_params_t;
 
-static init_params_t ipar = {0, 0, false};
-pthread_mutex_t ntfimcn_mutex = PTHREAD_MUTEX_INITIALIZER;
+static init_params_t ipar;
+pthread_mutex_t ntfimcn_mutex;
 
 /**
  * Kill the osafntfimcn child process using previously saved Pid
@@ -190,14 +190,6 @@ done:
TRACE_LEAVE();
 }
 
-/**
- * Create a ntfimcnd process
- * Note: The process can run on both active and standby node. It must be given
- *   a start argument with this information.
- *
- * @param ha_state[in] Current HA state
- * @return PID for the created process
- */
 static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
 {
char *start_args[3];
@@ -234,11 +226,6 @@ static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
  * Start the imcn process and wait for process to exit.
  * If the process exit then restart it.
  *
- * TODO: (Lennart #2506) The ntfimcn process is no longer started on the
- *   standby node. Handling of HA state in the ntfimcn process can 
therefore
- *   be removed. This also means that giving a start argument would no
- *   longer be needed.
- *
  * @param _init_params[in]
  * @return
  */
@@ -253,18 +240,13 @@ static void *cnsurvail_thread(void *_init_params)
 
while (1) {
osaf_mutex_lock_ordie(_mutex);
-   /* Note: Always give HA state SA_AMF_HA_ACTIVE to the imcn
-* process since ntfimcn is no longer started on the standby
-* node */
-   pid = create_imcnprocess(SA_AMF_HA_ACTIVE);
+   pid = create_imcnprocess(ipar->ha_state);
ipar->pid = pid;
osaf_mutex_unlock_ordie(_mutex);
 
/* Wait for child process to exit */
do {
rc = waitpid(ipar->pid, , 0);
-   TRACE("%s: waitpid() released. rc = %d",
-   __FUNCTION__, rc);
} while ((rc == -1) && (errno == EINTR));
 
if ((rc == -1) && (errno == ECHILD)) {
@@ -285,26 +267,29 @@ static void *cnsurvail_thread(void *_init_params)
TRACE("osafntfimcnd process terminated reason %s (%d)",
  exit_rc ? "exit" : "other", exit_stat);
}
-   TRACE_LEAVE();
 }
 
 /**
- * Start the imcn process surveillance thread.
- * The surveillance thread starts the imcn process
- * Note: This shall be done only if we are active
+ * Start the imcn process surveillance thread
+ *
+ * @param ha_state[in]
  */
-static void start_ntfimcn(void)
+static void start_cnprocess(SaAmfHAStateT ha_state)
 {
int rc;
 
TRACE_ENTER();
 
-   rc = pthread_create(
-   , NULL, cnsurvail_thread, (void *));
+   rc = pthread_mutex_init(_mutex, NULL);
if (rc != 0)
osaf_abort(rc);
 
-   ipar.ntfimcn_on = true;
+   ipar.ha_state = ha_state;
+
+   rc =
+   pthread_create(, NULL, cnsurvail_thread, (void *));
+   if (rc != 0)
+   osaf_abort(rc);
 
TRACE_LEAVE();
 }
@@ -312,45 +297,34 @@ static void start_ntfimcn(void)
 /**
  * Initialize the configuration change notifier
  *
- * Start ntfimcn if we are active
- *
  * @param ha_state[in]
  */
-void init_ntfimcn(SaAmfHAStateT ha_state)
-{
-   TRACE_ENTER();
-   if (ha_state == SA_AMF_HA_ACTIVE) {
-   start_ntfimcn();
-   }
-   TRACE_LEAVE();
-}
+void init_ntfimcn(SaAmfHAStateT ha_state) { start_cnprocess(ha_state); }
 
 

[devel] [PATCH 3/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.
---
 src/ntf/ntfd/ntfs_amf.c |   8 +--
 src/ntf/ntfd/ntfs_imcnutil.c| 105 +--
 src/ntf/ntfimcnd/ntfimcn_imm.c  | 119 
 src/ntf/ntfimcnd/ntfimcn_imm.h  |  20 ++-
 src/ntf/ntfimcnd/ntfimcn_main.h |   1 -
 5 files changed, 158 insertions(+), 95 deletions(-)

diff --git a/src/ntf/ntfd/ntfs_amf.c b/src/ntf/ntfd/ntfs_amf.c
index cda35d6f9..e9c521d4a 100644
--- a/src/ntf/ntfd/ntfs_amf.c
+++ b/src/ntf/ntfd/ntfs_amf.c
@@ -263,12 +263,10 @@ response:
checkNotificationList();
}
 done:
-   /* Kills the osafntfimcnd process if current state is Active or Standby
-* and the process is not already running in this state. The process
-* will be restarted by the process surveillance thread. This function
-* will not return until the process is terminated.
+   /* Start the osafntfimcn process if becoming active or stop the process
+* if leaving active state
 */
-   handle_state_ntfimcn(ntfs_cb->ha_state);
+   handle_state_ntfimcn(new_haState);
 
TRACE_LEAVE();
 }
diff --git a/src/ntf/ntfd/ntfs_imcnutil.c b/src/ntf/ntfd/ntfs_imcnutil.c
index dd27a255c..3add5db5a 100644
--- a/src/ntf/ntfd/ntfs_imcnutil.c
+++ b/src/ntf/ntfd/ntfs_imcnutil.c
@@ -41,13 +41,13 @@
 #include "osaf/configmake.h"
 
 typedef struct {
-   SaAmfHAStateT ha_state;
pid_t pid;
pthread_t thread;
+   bool ntfimcn_on;
 } init_params_t;
 
-static init_params_t ipar;
-pthread_mutex_t ntfimcn_mutex;
+static init_params_t ipar = {0, 0, false};
+pthread_mutex_t ntfimcn_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 /**
  * Kill the osafntfimcn child process using previously saved Pid
@@ -190,6 +190,14 @@ done:
TRACE_LEAVE();
 }
 
+/**
+ * Create a ntfimcnd process
+ * Note: The process can run on both active and standby node. It must be given
+ *   a start argument with this information.
+ *
+ * @param ha_state[in] Current HA state
+ * @return PID for the created process
+ */
 static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
 {
char *start_args[3];
@@ -226,6 +234,11 @@ static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
  * Start the imcn process and wait for process to exit.
  * If the process exit then restart it.
  *
+ * TODO: (Lennart #2506) The ntfimcn process is no longer started on the
+ *   standby node. Handling of HA state in the ntfimcn process can 
therefore
+ *   be removed. This also means that giving a start argument would no
+ *   longer be needed.
+ *
  * @param _init_params[in]
  * @return
  */
@@ -240,13 +253,18 @@ static void *cnsurvail_thread(void *_init_params)
 
while (1) {
osaf_mutex_lock_ordie(_mutex);
-   pid = create_imcnprocess(ipar->ha_state);
+   /* Note: Always give HA state SA_AMF_HA_ACTIVE to the imcn
+* process since ntfimcn is no longer started on the standby
+* node */
+   pid = create_imcnprocess(SA_AMF_HA_ACTIVE);
ipar->pid = pid;
osaf_mutex_unlock_ordie(_mutex);
 
/* Wait for child process to exit */
do {
rc = waitpid(ipar->pid, , 0);
+   TRACE("%s: waitpid() released. rc = %d",
+   __FUNCTION__, rc);
} while ((rc == -1) && (errno == EINTR));
 
if ((rc == -1) && (errno == ECHILD)) {
@@ -267,29 +285,26 @@ static void *cnsurvail_thread(void *_init_params)
TRACE("osafntfimcnd process terminated reason %s (%d)",
  exit_rc ? "exit" : "other", exit_stat);
}
+   TRACE_LEAVE();
 }
 
 /**
- * Start the imcn process surveillance thread
- *
- * @param ha_state[in]
+ * Start the imcn process surveillance thread.
+ * The surveillance thread starts the imcn process
+ * Note: This shall be done only if we are active
  */
-static void start_cnprocess(SaAmfHAStateT ha_state)
+static void start_ntfimcn(void)
 {
int rc;
 
TRACE_ENTER();
 
-   rc = pthread_mutex_init(_mutex, NULL);
+   rc = pthread_create(
+   , NULL, cnsurvail_thread, (void *));
if (rc != 0)
osaf_abort(rc);
 
-   ipar.ha_state = ha_state;
-
-   rc =
-   pthread_create(, NULL, cnsurvail_thread, (void *));
-   if (rc != 0)
-   osaf_abort(rc);
+   ipar.ntfimcn_on = true;
 
TRACE_LEAVE();
 }
@@ -297,34 +312,45 @@ static void 

[devel] [PATCH 1/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.
---
 src/ntf/ntfd/ntfs_amf.c |   8 +--
 src/ntf/ntfd/ntfs_imcnutil.c| 105 +--
 src/ntf/ntfimcnd/ntfimcn_imm.c  | 119 
 src/ntf/ntfimcnd/ntfimcn_imm.h  |  20 ++-
 src/ntf/ntfimcnd/ntfimcn_main.h |   1 -
 5 files changed, 158 insertions(+), 95 deletions(-)

diff --git a/src/ntf/ntfd/ntfs_amf.c b/src/ntf/ntfd/ntfs_amf.c
index cda35d6f9..e9c521d4a 100644
--- a/src/ntf/ntfd/ntfs_amf.c
+++ b/src/ntf/ntfd/ntfs_amf.c
@@ -263,12 +263,10 @@ response:
checkNotificationList();
}
 done:
-   /* Kills the osafntfimcnd process if current state is Active or Standby
-* and the process is not already running in this state. The process
-* will be restarted by the process surveillance thread. This function
-* will not return until the process is terminated.
+   /* Start the osafntfimcn process if becoming active or stop the process
+* if leaving active state
 */
-   handle_state_ntfimcn(ntfs_cb->ha_state);
+   handle_state_ntfimcn(new_haState);
 
TRACE_LEAVE();
 }
diff --git a/src/ntf/ntfd/ntfs_imcnutil.c b/src/ntf/ntfd/ntfs_imcnutil.c
index dd27a255c..3add5db5a 100644
--- a/src/ntf/ntfd/ntfs_imcnutil.c
+++ b/src/ntf/ntfd/ntfs_imcnutil.c
@@ -41,13 +41,13 @@
 #include "osaf/configmake.h"
 
 typedef struct {
-   SaAmfHAStateT ha_state;
pid_t pid;
pthread_t thread;
+   bool ntfimcn_on;
 } init_params_t;
 
-static init_params_t ipar;
-pthread_mutex_t ntfimcn_mutex;
+static init_params_t ipar = {0, 0, false};
+pthread_mutex_t ntfimcn_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 /**
  * Kill the osafntfimcn child process using previously saved Pid
@@ -190,6 +190,14 @@ done:
TRACE_LEAVE();
 }
 
+/**
+ * Create a ntfimcnd process
+ * Note: The process can run on both active and standby node. It must be given
+ *   a start argument with this information.
+ *
+ * @param ha_state[in] Current HA state
+ * @return PID for the created process
+ */
 static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
 {
char *start_args[3];
@@ -226,6 +234,11 @@ static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
  * Start the imcn process and wait for process to exit.
  * If the process exit then restart it.
  *
+ * TODO: (Lennart #2506) The ntfimcn process is no longer started on the
+ *   standby node. Handling of HA state in the ntfimcn process can 
therefore
+ *   be removed. This also means that giving a start argument would no
+ *   longer be needed.
+ *
  * @param _init_params[in]
  * @return
  */
@@ -240,13 +253,18 @@ static void *cnsurvail_thread(void *_init_params)
 
while (1) {
osaf_mutex_lock_ordie(_mutex);
-   pid = create_imcnprocess(ipar->ha_state);
+   /* Note: Always give HA state SA_AMF_HA_ACTIVE to the imcn
+* process since ntfimcn is no longer started on the standby
+* node */
+   pid = create_imcnprocess(SA_AMF_HA_ACTIVE);
ipar->pid = pid;
osaf_mutex_unlock_ordie(_mutex);
 
/* Wait for child process to exit */
do {
rc = waitpid(ipar->pid, , 0);
+   TRACE("%s: waitpid() released. rc = %d",
+   __FUNCTION__, rc);
} while ((rc == -1) && (errno == EINTR));
 
if ((rc == -1) && (errno == ECHILD)) {
@@ -267,29 +285,26 @@ static void *cnsurvail_thread(void *_init_params)
TRACE("osafntfimcnd process terminated reason %s (%d)",
  exit_rc ? "exit" : "other", exit_stat);
}
+   TRACE_LEAVE();
 }
 
 /**
- * Start the imcn process surveillance thread
- *
- * @param ha_state[in]
+ * Start the imcn process surveillance thread.
+ * The surveillance thread starts the imcn process
+ * Note: This shall be done only if we are active
  */
-static void start_cnprocess(SaAmfHAStateT ha_state)
+static void start_ntfimcn(void)
 {
int rc;
 
TRACE_ENTER();
 
-   rc = pthread_mutex_init(_mutex, NULL);
+   rc = pthread_create(
+   , NULL, cnsurvail_thread, (void *));
if (rc != 0)
osaf_abort(rc);
 
-   ipar.ha_state = ha_state;
-
-   rc =
-   pthread_create(, NULL, cnsurvail_thread, (void *));
-   if (rc != 0)
-   osaf_abort(rc);
+   ipar.ntfimcn_on = true;
 
TRACE_LEAVE();
 }
@@ -297,34 +312,45 @@ static void 

[devel] [PATCH 4/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.
---
 src/ntf/ntfd/ntfs_amf.c  |   8 ++--
 src/ntf/ntfd/ntfs_imcnutil.c | 105 +--
 2 files changed, 45 insertions(+), 68 deletions(-)

diff --git a/src/ntf/ntfd/ntfs_amf.c b/src/ntf/ntfd/ntfs_amf.c
index e9c521d4a..cda35d6f9 100644
--- a/src/ntf/ntfd/ntfs_amf.c
+++ b/src/ntf/ntfd/ntfs_amf.c
@@ -263,10 +263,12 @@ response:
checkNotificationList();
}
 done:
-   /* Start the osafntfimcn process if becoming active or stop the process
-* if leaving active state
+   /* Kills the osafntfimcnd process if current state is Active or Standby
+* and the process is not already running in this state. The process
+* will be restarted by the process surveillance thread. This function
+* will not return until the process is terminated.
 */
-   handle_state_ntfimcn(new_haState);
+   handle_state_ntfimcn(ntfs_cb->ha_state);
 
TRACE_LEAVE();
 }
diff --git a/src/ntf/ntfd/ntfs_imcnutil.c b/src/ntf/ntfd/ntfs_imcnutil.c
index 3add5db5a..dd27a255c 100644
--- a/src/ntf/ntfd/ntfs_imcnutil.c
+++ b/src/ntf/ntfd/ntfs_imcnutil.c
@@ -41,13 +41,13 @@
 #include "osaf/configmake.h"
 
 typedef struct {
+   SaAmfHAStateT ha_state;
pid_t pid;
pthread_t thread;
-   bool ntfimcn_on;
 } init_params_t;
 
-static init_params_t ipar = {0, 0, false};
-pthread_mutex_t ntfimcn_mutex = PTHREAD_MUTEX_INITIALIZER;
+static init_params_t ipar;
+pthread_mutex_t ntfimcn_mutex;
 
 /**
  * Kill the osafntfimcn child process using previously saved Pid
@@ -190,14 +190,6 @@ done:
TRACE_LEAVE();
 }
 
-/**
- * Create a ntfimcnd process
- * Note: The process can run on both active and standby node. It must be given
- *   a start argument with this information.
- *
- * @param ha_state[in] Current HA state
- * @return PID for the created process
- */
 static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
 {
char *start_args[3];
@@ -234,11 +226,6 @@ static pid_t create_imcnprocess(SaAmfHAStateT ha_state)
  * Start the imcn process and wait for process to exit.
  * If the process exit then restart it.
  *
- * TODO: (Lennart #2506) The ntfimcn process is no longer started on the
- *   standby node. Handling of HA state in the ntfimcn process can 
therefore
- *   be removed. This also means that giving a start argument would no
- *   longer be needed.
- *
  * @param _init_params[in]
  * @return
  */
@@ -253,18 +240,13 @@ static void *cnsurvail_thread(void *_init_params)
 
while (1) {
osaf_mutex_lock_ordie(_mutex);
-   /* Note: Always give HA state SA_AMF_HA_ACTIVE to the imcn
-* process since ntfimcn is no longer started on the standby
-* node */
-   pid = create_imcnprocess(SA_AMF_HA_ACTIVE);
+   pid = create_imcnprocess(ipar->ha_state);
ipar->pid = pid;
osaf_mutex_unlock_ordie(_mutex);
 
/* Wait for child process to exit */
do {
rc = waitpid(ipar->pid, , 0);
-   TRACE("%s: waitpid() released. rc = %d",
-   __FUNCTION__, rc);
} while ((rc == -1) && (errno == EINTR));
 
if ((rc == -1) && (errno == ECHILD)) {
@@ -285,26 +267,29 @@ static void *cnsurvail_thread(void *_init_params)
TRACE("osafntfimcnd process terminated reason %s (%d)",
  exit_rc ? "exit" : "other", exit_stat);
}
-   TRACE_LEAVE();
 }
 
 /**
- * Start the imcn process surveillance thread.
- * The surveillance thread starts the imcn process
- * Note: This shall be done only if we are active
+ * Start the imcn process surveillance thread
+ *
+ * @param ha_state[in]
  */
-static void start_ntfimcn(void)
+static void start_cnprocess(SaAmfHAStateT ha_state)
 {
int rc;
 
TRACE_ENTER();
 
-   rc = pthread_create(
-   , NULL, cnsurvail_thread, (void *));
+   rc = pthread_mutex_init(_mutex, NULL);
if (rc != 0)
osaf_abort(rc);
 
-   ipar.ntfimcn_on = true;
+   ipar.ha_state = ha_state;
+
+   rc =
+   pthread_create(, NULL, cnsurvail_thread, (void *));
+   if (rc != 0)
+   osaf_abort(rc);
 
TRACE_LEAVE();
 }
@@ -312,45 +297,34 @@ static void start_ntfimcn(void)
 /**
  * Initialize the configuration change notifier
  *
- * Start ntfimcn if we are active
- *
  * @param ha_state[in]
  */
-void init_ntfimcn(SaAmfHAStateT ha_state)
-{
-   TRACE_ENTER();
-   if (ha_state == SA_AMF_HA_ACTIVE) {
-   start_ntfimcn();
-   }
-   TRACE_LEAVE();
-}
+void init_ntfimcn(SaAmfHAStateT ha_state) { start_cnprocess(ha_state); }
 
 

[devel] [PATCH 0/5] Review Request for ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
Summary: ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]
Review request for Ticket(s): 2506
Peer Reviewer(s): praveen.malv...@oracle.com; minh.c...@dektech.com.au
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2506
Base revision: f089f030a322a43c79f3f259f07a4c42bb4d0da1
Personal repository: git://git.code.sf.net/u/elunlen/review


Impacted area   Impact y/n

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


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

revision beae5c3dacaa05fe68b50433251947d8c045cca7
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 17:09:23 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()



revision 7c3bc31dda6099becf7f246093d0bd7b0d652340
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()

long_description



revision caa854ce873f90208a5a14894b51c997e25a924c
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.



revision 0db3b249ffa8d00b05cc7aefecb1d422c30c8faf
Author: Lennart Lund 
Date:   Wed, 28 Jun 2017 16:49:04 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.



revision 71763df94b6d58d6e553fa26cc41dbd7cb7d264a
Author: Lennart Lund 
Date:   Tue, 27 Jun 2017 16:05:44 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.



revision 8f43f5d28b282812926d5a5bad29e604c76e4697
Author: Lennart Lund 
Date:   Mon, 26 Jun 2017 14:03:38 +0200

ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

In ntfimcn the OM handle shall have a short lifespan. Change from creating a
handle once when ntfimcn process starts to create a handle each time it is
needed and finalize when no longer needed.

Change start handling of ntfimcn (in ntf process) so the ntfimcn process is
started on the active node only since the ntfimcn process is not doing
anything on the standby node. Refactor/simplify code accordingly.



Complete diffstat:
--
 src/ntf/ntfimcnd/ntfimcn_imm.c  | 205 
 src/ntf/ntfimcnd/ntfimcn_imm.h  |  11 ++-
 src/ntf/ntfimcnd/ntfimcn_main.h |   2 +-
 3 files changed, 158 insertions(+), 60 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.

___ 

[devel] [PATCH 5/5] ntf: ntfimcn does not handle SA_ERR_UNAVAILABLE [#2506]

2017-06-28 Thread Lennart Lund
Changed according to comment from Minh.
OM Handle is now initialized only when imcn process start and
is reinitialized if SA_AIS_ERR_UNAVAILABLE
Also comment about resource handling in case of error in get_rdn_attr_name()

long_description
---
 src/ntf/ntfimcnd/ntfimcn_imm.c  | 122 +---
 src/ntf/ntfimcnd/ntfimcn_imm.h  |   9 ---
 src/ntf/ntfimcnd/ntfimcn_main.h |   1 +
 3 files changed, 90 insertions(+), 42 deletions(-)

diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c
index d751a724c..fd97a5c6a 100644
--- a/src/ntf/ntfimcnd/ntfimcn_imm.c
+++ b/src/ntf/ntfimcnd/ntfimcn_imm.c
@@ -42,6 +42,11 @@
 #include "ntfimcn_notifier.h"
 
 /*
+ * Global variables
+ */
+extern ntfimcn_cb_t ntfimcn_cb; /* See ntfimcn_main.c */
+
+/*
  * Global, scope file
  */
 /* Release code, major version, minor version */
@@ -81,13 +86,73 @@ struct {
 
 #define NOTIFYING_OBJECT "safApp=safImmService"
 
-extern ntfimcn_cb_t ntfimcn_cb;
+static bool initializeImmOmHandle(SaImmHandleT* immOmHandle);
+static void finalizeImmOmHandle(SaImmHandleT immOmHandle);
+
+/**
+ * Get a class description for the given className
+ *
+ * Handles SA_AIS_ERR_TRY_AGAIN loop
+ * Also retries once if SA_AIS_ERR_UNAVAILABLE
+ * Note: Uses saImmOmClassDescriptionGet_2() that allocates memory that
+ *   has to be freed by calling saImmOmClassDescriptionMemoryFree_2()
+ *
+ * See AIS saImmOmClassDescriptionGet_2
+ * @param className[in]
+ * @param attrDescr[out]
+ * @return AIS return code
+ */
+static SaAisErrorT getClassDescription(const SaImmClassNameT className,
+   SaImmAttrDefinitionT_2 ***attrDescr)
+{
+   SaImmClassCategoryT classCategory;
+   struct timespec timeout_ts;
+   struct timespec delay_ts;
+   SaAisErrorT ais_rc;
+
+   osaf_millis_to_timespec(sleep_delay_ms, _ts);
+   osaf_set_millis_timeout(max_waiting_time_7s, _ts);
+
+   for (int i = 0; i <= 1; i++) {
+   while (osaf_is_timeout(_ts) == false) {
+   ais_rc = saImmOmClassDescriptionGet_2(
+   ntfimcn_cb.immOmHandle,
+   className, , attrDescr);
+   if ((ais_rc != SA_AIS_ERR_TRY_AGAIN) &&
+   (ais_rc != SA_AIS_ERR_TIMEOUT)) {
+   break;
+   }
+   osaf_nanosleep(_ts);
+   }
+
+   /*
+* If SA_AIS_ERR_UNAVAILABLE we may have left the CLM cluster
+* The old handle must be finalized, a new initialized and one
+* new attempt to get the class description shall be done.
+*/
+   if (ais_rc == SA_AIS_ERR_UNAVAILABLE) {
+   finalizeImmOmHandle(ntfimcn_cb.immOmHandle);
+   if (initializeImmOmHandle(_cb.immOmHandle) ==
+   false) {
+   break; /* Failed to initialize OM handle */
+   }
+   } else  break;
+   }
+
+   if (ais_rc != SA_AIS_OK) {
+   LOG_NO("%s saImmOmClassDescriptionGet_2 failed %s",
+   __FUNCTION__, saf_error(ais_rc));
+   }
+
+   return ais_rc;
+}
 
 /**
  * Get name of rdn attribute from IMM
  *
  * Note:
  * Uses in file global struct s_get_rdn_attr_name
+ * Uses global immOmHandle in struct ntfimcn_cb_t
  *
  * @param className[in]
  *
@@ -96,10 +161,8 @@ extern ntfimcn_cb_t ntfimcn_cb;
 static char *get_rdn_attr_name(const SaImmClassNameT className)
 {
SaAisErrorT rc;
-   int msecs_waited;
int i = 0;
 
-   SaImmClassCategoryT classCategory;
SaImmAttrDefinitionT_2 **attrDescr;
 
TRACE_ENTER();
@@ -118,25 +181,8 @@ static char *get_rdn_attr_name(const SaImmClassNameT 
className)
memcpy(s_get_rdn_attr_name.saved_className, className,
   strlen(className) + 1);
 
-   /* Get an IMM OM Handle */
-   SaImmHandleT immOmHandle = 0;
-   if (getImmOmHandle() == false) {
-   LOG_ER("getImmOmHandle() Fail");
-   goto error;
-   }
-
/* Get class description */
-   msecs_waited = 0;
-   rc = saImmOmClassDescriptionGet_2(immOmHandle, className,
- , );
-   while (((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT)) &&
-  (msecs_waited < max_waiting_time_7s)) {
-   usleep(sleep_delay_ms * 1000);
-   msecs_waited += sleep_delay_ms;
-   rc = saImmOmClassDescriptionGet_2(immOmHandle,
- className, ,
- );
-   }
+   rc = getClassDescription(className, );
if (rc != SA_AIS_OK) {
LOG_ER("saImmOmClassDescriptionGet_2 failed %s", saf_error(rc));
goto error;
@@ -160,21 +206,24 @@ static 

[devel] [PATCH 0/1] Review Request for smf: 20 seconds timeout in getting node destination is not enough [#2499]

2017-06-28 Thread Rafael Odzakow
Summary: smf: 20 seconds timeout in getting node destination is not enough 
[#2499]
Review request for Ticket(s): 2499
Peer Reviewer(s): lennart/reddy
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2499
Base revision: f089f030a322a43c79f3f259f07a4c42bb4d0da1
Personal repository: git://git.code.sf.net/u/erafodz/review


Impacted area   Impact y/n

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


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

revision b48d48489837dafbf335e5a30bd57f0694f4654f
Author: Rafael Odzakow 
Date:   Wed, 28 Jun 2017 16:08:38 +0200

smf: 20 seconds timeout in getting node destination is not enough [#2499]

SmfCliCommandAction::execute after cluster reboot did not use
smfRebootTimeout to wait for node to come back up. All commands that can
be issued after reboot should use smfRebootTimeout configuration.



Complete diffstat:
--
 src/smf/smfd/SmfUpgradeStep.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.


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


[devel] [PATCH 1/1] imm: send imm finalize message to immnd when dispatch returns ERR_BAD_HANDLE [#2504]

2017-06-28 Thread Zoran Milinkovic
Send IMM_FINALIZE message to immnd when dispatch functions returns 
ERR_BAD_HANDLE.
IMM_FINALIZE will release all allocated resources of a handle on IMM service 
side.
---
 src/imm/agent/imma_proc.cc | 51 ++
 1 file changed, 51 insertions(+)

diff --git a/src/imm/agent/imma_proc.cc b/src/imm/agent/imma_proc.cc
index 14ce5ab..dfd73e3 100644
--- a/src/imm/agent/imma_proc.cc
+++ b/src/imm/agent/imma_proc.cc
@@ -1745,6 +1745,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_one(IMMA_CB *cb, 
SaImmHandleT immHandle) {
   imma_proc_ccbaug_setup(cl_node, callback);
   m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
   if (!imma_process_callback_info(cb, cl_node, callback, immHandle)) {
+IMMSV_EVT finalize_evt, *out_evt;
 /* Callback protocol could not be honored due to some lack
of client capabilities. E.g. applier can not handle long DNs
while regular OI can, or there is no regular OI. The capabilties
@@ -1757,6 +1758,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_one(IMMA_CB *cb, 
SaImmHandleT immHandle) {
 */
 cl_node->stale = true;
 cl_node->exposed = true;
+
+out_evt = NULL;
+memset(_evt, 0, sizeof(IMMSV_EVT));
+finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+finalize_evt.info.immnd.info.finReq.client_hdl = cl_node->handle;
+
+/* send the request to the IMMND */
+imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+   _evt, _evt,
+   cl_node->syncr_timeout);
+
+if (out_evt) {
+  free(out_evt);
+}
+
 return SA_AIS_ERR_BAD_HANDLE;
   }
   return SA_AIS_OK;
@@ -1810,6 +1827,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_all(IMMA_CB *cb, 
SaImmHandleT immHandle) {
   imma_proc_ccbaug_setup(cl_node, callback);
   m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
   if (!imma_process_callback_info(cb, cl_node, callback, immHandle)) {
+IMMSV_EVT finalize_evt, *out_evt;
 /* Callback protocol could not be honored due to some lack
of client capabilities. E.g. applier can not handle long DNs
while regular OI can, or there is no regular OI. The capabilties
@@ -1822,6 +1840,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_all(IMMA_CB *cb, 
SaImmHandleT immHandle) {
 */
 cl_node->stale = true;
 cl_node->exposed = true;
+
+out_evt = NULL;
+memset(_evt, 0, sizeof(IMMSV_EVT));
+finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+finalize_evt.info.immnd.info.finReq.client_hdl = cl_node->handle;
+
+/* send the request to the IMMND */
+imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+   _evt, _evt,
+   cl_node->syncr_timeout);
+
+if (out_evt) {
+  free(out_evt);
+}
+
 return SA_AIS_ERR_BAD_HANDLE;
   }
 } else {
@@ -1903,6 +1937,7 @@ SaAisErrorT imma_hdl_callbk_dispatch_block(IMMA_CB *cb,
 imma_proc_ccbaug_setup(client_info, callback);
 m_NCS_UNLOCK(>cb_lock, NCS_LOCK_WRITE);
 if (!imma_process_callback_info(cb, client_info, callback, immHandle)) 
{
+  IMMSV_EVT finalize_evt, *out_evt;
   /* Callback protocol could not be honored due to some lack
  of client capabilities. E.g. applier can not handle long DNs
  while regular OI can, or there is no regular OI. The capabilties
@@ -1915,6 +1950,22 @@ SaAisErrorT imma_hdl_callbk_dispatch_block(IMMA_CB *cb,
*/
   client_info->stale = true;
   client_info->exposed = true;
+
+  out_evt = NULL;
+  memset(_evt, 0, sizeof(IMMSV_EVT));
+  finalize_evt.type = IMMSV_EVT_TYPE_IMMND;
+  finalize_evt.info.immnd.type = IMMND_EVT_A2ND_IMM_FINALIZE;
+  finalize_evt.info.immnd.info.finReq.client_hdl = client_info->handle;
+
+  /* send the request to the IMMND */
+  imma_mds_msg_sync_send(cb->imma_mds_hdl, &(cb->immnd_mds_dest),
+ _evt, _evt,
+ client_info->syncr_timeout);
+
+  if (out_evt) {
+free(out_evt);
+  }
+
   return SA_AIS_ERR_BAD_HANDLE;
 }
   } else {
-- 
1.9.1


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


[devel] [PATCH 1/1] rde: allow early role change when active or standby nodes are introduced [#2513]

2017-06-28 Thread Zoran Milinkovic
When active or standby nodes are introduced with request message, there is no 
need to wait more for requesting the active role.
When standby node is introduced, then we are sure that there is an active node 
somewhere in the cluster. So, changing the peer state is safe.
---
 src/rde/rded/rde_main.cc | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/rde/rded/rde_main.cc b/src/rde/rded/rde_main.cc
index e939517..40d5d8e 100644
--- a/src/rde/rded/rde_main.cc
+++ b/src/rde/rded/rde_main.cc
@@ -103,7 +103,10 @@ static void handle_mbx_event() {
   LOG_NO("Got peer info request from node 0x%x with role %s",
  msg->fr_node_id, Role::to_string(msg->info.peer_info.ha_role));
   CheckForSplitBrain(msg);
-  role->SetPeerState(msg->info.peer_info.ha_role, msg->fr_node_id);
+  if(msg->info.peer_info.ha_role == PCS_RDA_ACTIVE
+  || msg->info.peer_info.ha_role == PCS_RDA_STANDBY) {
+role->SetPeerState(msg->info.peer_info.ha_role, msg->fr_node_id);
+  }
   SendPeerInfoResp(msg->fr_dest);
   break;
 }
-- 
1.9.1


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


[devel] [PATCH 0/1] Review Request for rde: allow early role change when active or standby nodes are introduced [#2513]

2017-06-28 Thread Zoran Milinkovic
Summary: rde: allow early role change when active or standby nodes are 
introduced [#2513]
Review request for Ticket(s): 2513
Peer Reviewer(s): Anders
Pull request to: Zoran
Affected branch(es): develop
Development branch: ticket-2513
Base revision: 7193ab9d6261f13efe5ce173f3b9bee248401ef3
Personal repository: git://git.code.sf.net/u/zmilinkovic/review


Impacted area   Impact y/n

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


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

revision f089f030a322a43c79f3f259f07a4c42bb4d0da1
Author: Zoran Milinkovic 
Date:   Wed, 28 Jun 2017 13:25:29 +0200

rde: allow early role change when active or standby nodes are introduced [#2513]

When active or standby nodes are introduced with request message, there is no 
need to wait more for requesting the active role.
When standby node is introduced, then we are sure that there is an active node 
somewhere in the cluster. So, changing the peer state is safe.



Complete diffstat:
--
 src/rde/rded/rde_main.cc | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)


Testing Commands:
-


Testing, Expected Results:
--


Conditions of Submission:
-
Ack from Anders


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


Re: [devel] [PATCH 1/1] pyosaf: Ensure compatibility with Python 3 [#2492]

2017-06-28 Thread Hans Nordebäck

Hi Anders,

minor comments below marked with [HansN]

/BR Hans


On 06/13/2017 04:07 PM, Anders Widell wrote:

Ensure compatibility with Python 3 by running the Python source code files
through the Automated Python 2 to 3 code translation tool "2to3". For more
information about this tool, see:

https://docs.python.org/3/library/2to3.html
---
  python/pyosaf/saEnumConst.py |  6 +++---
  python/pyosaf/utils/immoi/__init__.py|  8 +++
  python/pyosaf/utils/immoi/implementer.py | 36 
  python/pyosaf/utils/immom/__init__.py|  6 +++---
  python/pyosaf/utils/immom/ccb.py | 17 ---
  python/pyosaf/utils/immom/iterator.py|  8 +++
  python/pyosaf/utils/immom/object.py  |  2 +-
  7 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/python/pyosaf/saEnumConst.py b/python/pyosaf/saEnumConst.py
index 5c3338267..51f1efdeb 100644
--- a/python/pyosaf/saEnumConst.py
+++ b/python/pyosaf/saEnumConst.py
@@ -50,14 +50,14 @@ class Enumeration(object):
  
  		i = 0

for node in enumlist:
-   if type(node) is tuple:
+   if isinstance(node, tuple):
try:
node, i = node
except ValueError:
raise EnumException('%r:' % (node,))
-   if type(node) is not str:
+   if not isinstance(node, str):
raise EnumException('Enum name not a string: 
%r' % (node,))
-   if type(i) is not int:
+   if not isinstance(i, int):
raise EnumException('Enum value not integer: 
%r' % (node,))
if node in lookup:
raise EnumException('Enum name not unique: %r' 
% (node,))
diff --git a/python/pyosaf/utils/immoi/__init__.py 
b/python/pyosaf/utils/immoi/__init__.py
index c70f843e9..02ad89b90 100644
--- a/python/pyosaf/utils/immoi/__init__.py
+++ b/python/pyosaf/utils/immoi/__init__.py
@@ -126,7 +126,7 @@ def create_rt_object(class_name, parent_name, obj):
  
  c_attr_values = []
  
-for name, (c_attr_type, values) in obj.attrs.iteritems():

+for name, (c_attr_type, values) in obj.attrs.items():
  
  if values == None:

  values = []
@@ -175,10 +175,10 @@ def update_rt_object(dn, attributes):
  # Create and marshall attribute modifications
  attr_mods = []
  
-for name, values in attributes.iteritems():

+for name, values in attributes.items():
  
  if values is None:

-print "WARNING: Received no values for %s in %s" % (name, dn)
+print("WARNING: Received no values for %s in %s" % (name, dn))
  continue
  
  if not isinstance(values, list):

@@ -356,7 +356,7 @@ def create_non_existing_imm_object(class_name, parent_name, 
attributes):
  
  obj = ImmObject(class_name=class_name, dn=dn)
  
-for name, values in attributes.iteritems():

+for name, values in attributes.items():
  obj.__setattr__(name, values)
  
  obj.__setattr__('SaImmAttrClassName', class_name)

diff --git a/python/pyosaf/utils/immoi/implementer.py 
b/python/pyosaf/utils/immoi/implementer.py
index 865db9ba0..b183905a6 100755
--- a/python/pyosaf/utils/immoi/implementer.py
+++ b/python/pyosaf/utils/immoi/implementer.py
@@ -113,8 +113,8 @@ def _collect_full_transaction(ccb_id):
  affected_instances = [i for i in all_objects_now if i.dn == 
dn]
  
  if len(affected_instances) == 0:

-print ('ERROR: Failed to find object %s affected by modify 
'
-   'operation' % dn)
+print(('ERROR: Failed to find object %s affected by modify 
'
+   'operation' % dn))
  else:
  affected_instance = affected_instances[0]
  
@@ -198,8 +198,8 @@ def admin_operation(oi_handle, c_invocation_id, c_name, c_operation_id, c_params

  try:
  immoi.report_admin_operation_result(invocation_id, result)
  except SafException as err:
-print "ERROR: Failed to report that %s::%s returned %s (%s)" % \
-(name, invocation_id, result, err.msg)
+print("ERROR: Failed to report that %s::%s returned %s (%s)" % \
+(name, invocation_id, result, err.msg))
  
  def abort_ccb(oi_handle, ccb_id):

  ''' Callback for aborted CCBs.
@@ -275,7 +275,7 @@ def delete_added(oi_handle, ccb_id, c_name):
   eSaImmValueTypeT.SA_IMM_ATTR_SANAMET)
  
  # Create a new CCB in the cache if needed

-if not ccb_id in CCBS.keys():
+if not ccb_id in list(CCBS.keys()):
  CCBS[ccb_id] = []
  
  # Cache the operation

@@ -318,7 +318,7 @@ def modify_added(oi_handle, c_ccb_id, c_name, 

Re: [devel] [PATCH 0/1] Review Request for osaf: Fix build problems when using GCC 7.1.1 [#2502]

2017-06-28 Thread Anders Widell

Hi!

Did you get a chance to look at tickets [#2502] and [#2472] yet?

If there are no comments I would like to push them by the end of this week.

thanks,

Anders Widell


On 06/20/2017 10:57 AM, Anders Widell wrote:

Summary: osaf: Fix build problems when using GCC 7.1.1 [#2502]
Review request for Ticket(s): 2502
Peer Reviewer(s): Mahesh
Pull request to:
Affected branch(es): develop
Development branch: ticket-2502
Base revision: da08a820a03d8bf6b3ea35bf318a207eba57356f
Personal repository: git://git.code.sf.net/u/anders-w/review


Impacted area   Impact y/n

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


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

revision e53a35b9875841a5336fa6eef312332fa786568c
Author: Anders Widell 
Date:   Mon, 19 Jun 2017 15:57:54 +0200

osaf: Fix build problems when using GCC 7.1.1 [#2502]

Fix build problems caused by the following warnings:

* -Werror=format-overflow=
* -Werror=parentheses
* -Werror=unused-variable



Complete diffstat:
--
  src/amf/amfd/imm.cc|  2 -
  src/clm/apitest/tet_ClmLongRdn.c   | 24 +---
  src/clm/apitest/tet_ClmOiOps.c | 72 +-
  src/clm/clmd/clms_imm.c|  6 +-
  src/clm/clmd/clms_ntf.c| 23 ---
  src/imm/apitest/implementer/test_SaImmOiCcb.c  | 21 ---
  .../implementer/test_saImmOiRtObjectCreate_2.c | 12 ++--
  .../management/test_saImmOmCcbObjectDelete.c   | 12 ++--
  .../management/test_saImmOmCcbObjectModify_2.c | 12 ++--
  src/ntf/apitest/tet_longDnObject_notification.c| 18 +++---
  10 files changed, 125 insertions(+), 77 deletions(-)


Testing Commands:
-
Build OpenSAF using GCC version 7.1 or later


Testing, Expected Results:
--
OpenSAF shall build successfully.


Conditions of Submission:
-
Ack from reviewer(s).


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

___ You need to refactor 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

Re: [devel] [PATCH 2/3] amf: support SC status change callback, non SAF [#2475]

2017-06-28 Thread Gary Lee
I think currently the callback is called in the context of the agent MDS 
thread? This could introduce threading issues to an application as they 
normally expect callbacks to be executed in the thread calling Dispatch().

On 28/6/17, 5:16 pm, "Gary Lee"  wrote:

Hi Praveen

Is it possible to make the callback to be triggered from saAmfDispatch()?

Thanks
Gary

On 28/6/17, 5:06 pm, "Gary Lee"  wrote:

Hi Praveen

Ack for the series (with 2 comments). One very minor comment below, the 
other is in Patch 3.

Thanks
Gary

On 1/6/17, 9:46 pm, "Praveen"  wrote:

* A callback that will be invoked by AMFA whenever a SC joins 
cluster and
  both SCs leaves cluster if SC Absence feature is enabled.

  Callback and its argument:

  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
  where OsafAmfSCStatusT is defined as:
typedef enum {
  OSAF_AMF_SC_PRESENT = 1,
  OSAF_AMF_SC_ABSENT = 2,
} OsafAmfSCStatusT;

  This callback can be integrated
  with standard AMF component (even with legacy one also).
* An API to register/install above callback function:
   void osafAmfInstallSCStatusChangeCallback(
 void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT 
status));
---
 src/amf/agent/ava_mds.cc  | 35 
++-
 src/amf/agent/ava_mds.h   |  6 --
 src/amf/agent/ava_op.cc   |  5 +
 src/amf/amfnd/avnd_mds.h  |  2 +-
 src/amf/amfnd/di.cc   | 39 
++-
 src/amf/amfnd/mds.cc  |  5 -
 src/amf/common/amf_amfparam.h |  7 +++
 src/amf/common/amf_n2avamsg.h |  1 +
 src/amf/saf/libSaAmf.map  |  1 +
 src/amf/saf/saAmf_B_04_02.h   |  8 
 10 files changed, 103 insertions(+), 6 deletions(-)

diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 54a0cfa..42bc139 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -60,7 +60,8 @@ static uint32_t dec_csi_attr_change_msg(NCS_UBAID 
*uba, AVSV_NDA_AVA_MSG *msg);
 
 static const MDS_CLIENT_MSG_FORMAT_VER
 ava_avnd_msg_fmt_map_table[AVA_AVND_SUBPART_VER_MAX] = {
-AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2};
+AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2,
+AVSV_AVND_AVA_MSG_FMT_VER_3};
 
 /**
  * function called when MDS down for avnd (AMF) is received
@@ -68,6 +69,26 @@ static const MDS_CLIENT_MSG_FORMAT_VER
  */
 static void (*amf_down_cb)(void);
 
+/**
+ * @brief  SC status change callback. It is called when cluster 
becomes
+ * without SCs and with SCs. It can be used by a client to 
know
+ * when cluster runs without SCs and with SCs.
+ * @param  state.
+ */
+static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT 
state);
+
+//Wrapper function that AMFA uses to invoke SC status change 
callback.
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+  TRACE_ENTER();
+  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+ TRACE("Callback not registered");
+  } else {
+ TRACE("Invoking SC status change callback");
+/* A client has installed a callback pointer, call it */
+OsafAmfSCStatusChangeCallbackT(state);
+  }
+  TRACE_LEAVE();
+}
 
/
   Name  : ava_mds_reg
 
@@ -893,6 +914,8 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, 
MDS_CALLBACK_DEC_FLAT_INFO *dec_info) {
 osaf_decode_sanamet(dec_info->io_uba, 
_comp_clean->comp_name);
   }
 } break;
+case AVSV_AMF_SC_STATUS_CHANGE: {
+} break;
 
 default:
   osafassert(0);
@@ -1168,6 +1191,16 @@ extern "C" void ava_install_amf_down_cb(void 
(*cb)(void)) {
   TRACE_LEAVE();
 }
 
+/**
+ * @brief   API 

Re: [devel] [PATCH 2/3] amf: support SC status change callback, non SAF [#2475]

2017-06-28 Thread Gary Lee
Hi Praveen

Is it possible to make the callback to be triggered from saAmfDispatch()?

Thanks
Gary

On 28/6/17, 5:06 pm, "Gary Lee"  wrote:

Hi Praveen

Ack for the series (with 2 comments). One very minor comment below, the 
other is in Patch 3.

Thanks
Gary

On 1/6/17, 9:46 pm, "Praveen"  wrote:

* A callback that will be invoked by AMFA whenever a SC joins cluster 
and
  both SCs leaves cluster if SC Absence feature is enabled.

  Callback and its argument:

  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
  where OsafAmfSCStatusT is defined as:
typedef enum {
  OSAF_AMF_SC_PRESENT = 1,
  OSAF_AMF_SC_ABSENT = 2,
} OsafAmfSCStatusT;

  This callback can be integrated
  with standard AMF component (even with legacy one also).
* An API to register/install above callback function:
   void osafAmfInstallSCStatusChangeCallback(
 void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
---
 src/amf/agent/ava_mds.cc  | 35 ++-
 src/amf/agent/ava_mds.h   |  6 --
 src/amf/agent/ava_op.cc   |  5 +
 src/amf/amfnd/avnd_mds.h  |  2 +-
 src/amf/amfnd/di.cc   | 39 
++-
 src/amf/amfnd/mds.cc  |  5 -
 src/amf/common/amf_amfparam.h |  7 +++
 src/amf/common/amf_n2avamsg.h |  1 +
 src/amf/saf/libSaAmf.map  |  1 +
 src/amf/saf/saAmf_B_04_02.h   |  8 
 10 files changed, 103 insertions(+), 6 deletions(-)

diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 54a0cfa..42bc139 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -60,7 +60,8 @@ static uint32_t dec_csi_attr_change_msg(NCS_UBAID 
*uba, AVSV_NDA_AVA_MSG *msg);
 
 static const MDS_CLIENT_MSG_FORMAT_VER
 ava_avnd_msg_fmt_map_table[AVA_AVND_SUBPART_VER_MAX] = {
-AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2};
+AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2,
+AVSV_AVND_AVA_MSG_FMT_VER_3};
 
 /**
  * function called when MDS down for avnd (AMF) is received
@@ -68,6 +69,26 @@ static const MDS_CLIENT_MSG_FORMAT_VER
  */
 static void (*amf_down_cb)(void);
 
+/**
+ * @brief  SC status change callback. It is called when cluster becomes
+ * without SCs and with SCs. It can be used by a client to know
+ * when cluster runs without SCs and with SCs.
+ * @param  state.
+ */
+static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
+
+//Wrapper function that AMFA uses to invoke SC status change callback.
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+  TRACE_ENTER();
+  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+ TRACE("Callback not registered");
+  } else {
+ TRACE("Invoking SC status change callback");
+/* A client has installed a callback pointer, call it */
+OsafAmfSCStatusChangeCallbackT(state);
+  }
+  TRACE_LEAVE();
+}
 
/
   Name  : ava_mds_reg
 
@@ -893,6 +914,8 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, 
MDS_CALLBACK_DEC_FLAT_INFO *dec_info) {
 osaf_decode_sanamet(dec_info->io_uba, 
_comp_clean->comp_name);
   }
 } break;
+case AVSV_AMF_SC_STATUS_CHANGE: {
+} break;
 
 default:
   osafassert(0);
@@ -1168,6 +1191,16 @@ extern "C" void ava_install_amf_down_cb(void 
(*cb)(void)) {
   TRACE_LEAVE();
 }
 
+/**
+ * @brief   API for client to install SC status change callback.
+ */
+void osafAmfInstallSCStatusChangeCallback(void (*cb)(OsafAmfSCStatusT 
status)) {
+  TRACE_ENTER();
+  OsafAmfSCStatusChangeCallbackT = cb;
+  TRACE_LEAVE();
+}
+
+
 void ava_fill_finalize_msg(AVSV_NDA_AVA_MSG *msg, MDS_DEST dst,
SaAmfHandleT hdl, SaNameT comp_name) {
   msg->type = AVSV_AVA_API_MSG;
diff --git a/src/amf/agent/ava_mds.h b/src/amf/agent/ava_mds.h
index e0f61dd..882f6a5 100644
--- a/src/amf/agent/ava_mds.h
+++ b/src/amf/agent/ava_mds.h
@@ -35,10 +35,10 @@ extern "C" {
 

Re: [devel] [PATCH 2/3] amf: support SC status change callback, non SAF [#2475]

2017-06-28 Thread Gary Lee
Hi Praveen

Ack for the series (with 2 comments). One very minor comment below, the other 
is in Patch 3.

Thanks
Gary

On 1/6/17, 9:46 pm, "Praveen"  wrote:

* A callback that will be invoked by AMFA whenever a SC joins cluster and
  both SCs leaves cluster if SC Absence feature is enabled.

  Callback and its argument:

  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
  where OsafAmfSCStatusT is defined as:
typedef enum {
  OSAF_AMF_SC_PRESENT = 1,
  OSAF_AMF_SC_ABSENT = 2,
} OsafAmfSCStatusT;

  This callback can be integrated
  with standard AMF component (even with legacy one also).
* An API to register/install above callback function:
   void osafAmfInstallSCStatusChangeCallback(
 void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
---
 src/amf/agent/ava_mds.cc  | 35 ++-
 src/amf/agent/ava_mds.h   |  6 --
 src/amf/agent/ava_op.cc   |  5 +
 src/amf/amfnd/avnd_mds.h  |  2 +-
 src/amf/amfnd/di.cc   | 39 ++-
 src/amf/amfnd/mds.cc  |  5 -
 src/amf/common/amf_amfparam.h |  7 +++
 src/amf/common/amf_n2avamsg.h |  1 +
 src/amf/saf/libSaAmf.map  |  1 +
 src/amf/saf/saAmf_B_04_02.h   |  8 
 10 files changed, 103 insertions(+), 6 deletions(-)

diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 54a0cfa..42bc139 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -60,7 +60,8 @@ static uint32_t dec_csi_attr_change_msg(NCS_UBAID *uba, 
AVSV_NDA_AVA_MSG *msg);
 
 static const MDS_CLIENT_MSG_FORMAT_VER
 ava_avnd_msg_fmt_map_table[AVA_AVND_SUBPART_VER_MAX] = {
-AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2};
+AVSV_AVND_AVA_MSG_FMT_VER_1, AVSV_AVND_AVA_MSG_FMT_VER_2,
+AVSV_AVND_AVA_MSG_FMT_VER_3};
 
 /**
  * function called when MDS down for avnd (AMF) is received
@@ -68,6 +69,26 @@ static const MDS_CLIENT_MSG_FORMAT_VER
  */
 static void (*amf_down_cb)(void);
 
+/**
+ * @brief  SC status change callback. It is called when cluster becomes
+ * without SCs and with SCs. It can be used by a client to know
+ * when cluster runs without SCs and with SCs.
+ * @param  state.
+ */
+static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
+
+//Wrapper function that AMFA uses to invoke SC status change callback.
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+  TRACE_ENTER();
+  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+ TRACE("Callback not registered");
+  } else {
+ TRACE("Invoking SC status change callback");
+/* A client has installed a callback pointer, call it */
+OsafAmfSCStatusChangeCallbackT(state);
+  }
+  TRACE_LEAVE();
+}
 
/
   Name  : ava_mds_reg
 
@@ -893,6 +914,8 @@ uint32_t ava_mds_flat_dec(AVA_CB *cb, 
MDS_CALLBACK_DEC_FLAT_INFO *dec_info) {
 osaf_decode_sanamet(dec_info->io_uba, 
_comp_clean->comp_name);
   }
 } break;
+case AVSV_AMF_SC_STATUS_CHANGE: {
+} break;
 
 default:
   osafassert(0);
@@ -1168,6 +1191,16 @@ extern "C" void ava_install_amf_down_cb(void 
(*cb)(void)) {
   TRACE_LEAVE();
 }
 
+/**
+ * @brief   API for client to install SC status change callback.
+ */
+void osafAmfInstallSCStatusChangeCallback(void (*cb)(OsafAmfSCStatusT 
status)) {
+  TRACE_ENTER();
+  OsafAmfSCStatusChangeCallbackT = cb;
+  TRACE_LEAVE();
+}
+
+
 void ava_fill_finalize_msg(AVSV_NDA_AVA_MSG *msg, MDS_DEST dst,
SaAmfHandleT hdl, SaNameT comp_name) {
   msg->type = AVSV_AVA_API_MSG;
diff --git a/src/amf/agent/ava_mds.h b/src/amf/agent/ava_mds.h
index e0f61dd..882f6a5 100644
--- a/src/amf/agent/ava_mds.h
+++ b/src/amf/agent/ava_mds.h
@@ -35,10 +35,10 @@ extern "C" {
 #endif
 
 /* In Service upgrade support */
-#define AVA_MDS_SUB_PART_VERSION 2
+#define AVA_MDS_SUB_PART_VERSION 3
 
 #define AVA_AVND_SUBPART_VER_MIN 1
-#define AVA_AVND_SUBPART_VER_MAX 2
+#define AVA_AVND_SUBPART_VER_MAX 3
 
 
/*
  Function to fill the MDS message structure
@@ -101,6 +101,8 @@ uint32_t ava_mds_cbk(NCSMDS_CALLBACK_INFO*);
 uint32_t ava_mds_send(struct ava_cb_tag*, AVSV_NDA_AVA_MSG*,
   AVSV_NDA_AVA_MSG**);
 
+void