Re: [devel] [PATCH 2/2] amfd: Remove assignment of NwayActive SU which is over assigned after split brain [#2926]

2018-09-24 Thread Hans Nordeback

ack, code review only/Thanks HansN


On 09/19/2018 12:50 AM, Minh Chau wrote:

---
  src/amf/amfd/sg_nwayact_fsm.cc | 8 +++-
  1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/amf/amfd/sg_nwayact_fsm.cc b/src/amf/amfd/sg_nwayact_fsm.cc
index f339026..bbd63c8 100644
--- a/src/amf/amfd/sg_nwayact_fsm.cc
+++ b/src/amf/amfd/sg_nwayact_fsm.cc
@@ -77,17 +77,15 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD_CL_CB *cb, AVD_SG 
*sg) {
continue;
  }
  /* After split-brain, the assignments can go over the preferred number.
- * Reboot the node once at time until the current active assignments
+ * Remove assignment once at time until the current active assignments
   * is equal to preferred number
   */
  if (i_si->pref_active_assignments() < i_si->curr_active_assignments()) {
AVD_SU* over_assigned_su = i_si->list_of_sisu->su;
if (over_assigned_su) {
-LOG_ER("SU '%s' has been over-assigned",
+LOG_WA("SU '%s' has been over-assigned, remove its assignment",
  over_assigned_su->name.c_str());
-LOG_EM("Sending node reboot order to '%s'",
-   over_assigned_su->su_on_node->name.c_str());
-avd_d2n_reboot_snd(over_assigned_su->su_on_node);
+sg->su_fault(cb, over_assigned_su);
}
goto done;
  }




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


Re: [devel] [PATCH 1/2] amfd: Reboot the node that has SU over-assigned after split brain [#2926]

2018-09-24 Thread Hans Nordeback

ack, code review only/Thanks HansN


On 09/19/2018 12:50 AM, Minh Chau wrote:

After split-brain, the assignments can go over the preferred number.
Reboot the node once at time until the current active assignments
is equal to preferred number.
---
  src/amf/amfd/sg_nwayact_fsm.cc | 20 +---
  src/amf/amfd/siass.cc  |  5 -
  2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/src/amf/amfd/sg_nwayact_fsm.cc b/src/amf/amfd/sg_nwayact_fsm.cc
index 68b76f1..f339026 100644
--- a/src/amf/amfd/sg_nwayact_fsm.cc
+++ b/src/amf/amfd/sg_nwayact_fsm.cc
@@ -70,13 +70,27 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD_CL_CB *cb, AVD_SG 
*sg) {
  if (l_flag == false) {
break;
  }
-
  /* verify that the SI is ready and needs come more assignments. */
  if ((i_si->saAmfSIAdminState != SA_AMF_ADMIN_UNLOCKED) ||
  (i_si->list_of_csi == nullptr) ||
-(i_si->pref_active_assignments() <= i_si->curr_active_assignments())) {
+(i_si->pref_active_assignments() == i_si->curr_active_assignments())) {
continue;
  }
+/* After split-brain, the assignments can go over the preferred number.
+ * Reboot the node once at time until the current active assignments
+ * is equal to preferred number
+ */
+if (i_si->pref_active_assignments() < i_si->curr_active_assignments()) {
+  AVD_SU* over_assigned_su = i_si->list_of_sisu->su;
+  if (over_assigned_su) {
+LOG_ER("SU '%s' has been over-assigned",
+over_assigned_su->name.c_str());
+LOG_EM("Sending node reboot order to '%s'",
+   over_assigned_su->su_on_node->name.c_str());
+avd_d2n_reboot_snd(over_assigned_su->su_on_node);
+  }
+  goto done;
+}
  
  /* Cannot be assigned, as sponsors SIs are not in enabled state for this SI

   */
@@ -259,7 +273,7 @@ AVD_SU *avd_sg_nacvred_su_chose_asgn(AVD_CL_CB *cb, AVD_SG 
*sg) {
}
  
TRACE_LEAVE();

-
+done:
if (sg->su_oper_list.empty() == true) {
  return nullptr;
} else {
diff --git a/src/amf/amfd/siass.cc b/src/amf/amfd/siass.cc
index 267c55c..5844b9a 100644
--- a/src/amf/amfd/siass.cc
+++ b/src/amf/amfd/siass.cc
@@ -258,7 +258,10 @@ void avd_susi_read_headless_cached_rta(AVD_CL_CB *cb) {
// the last fsm state when AMFD was before headless. This needs
// AMFND to resend susi_resp message if CSI completes during
// headless period.
-  susi->fsm = imm_susi_fsm;
+  if (imm_susi_fsm != AVD_SU_SI_STATE_BASE &&
+  imm_susi_fsm != AVD_SU_SI_STATE_ABSENT) {
+susi->fsm = imm_susi_fsm;
+  }
  #endif
// Checkpoint to add this SUSI
m_AVSV_SEND_CKPT_UPDT_ASYNC_ADD(avd_cb, susi, AVSV_CKPT_AVD_SI_ASS);




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


Re: [devel] [PATCH 2/3] base: add config file reader [#2923]

2018-09-24 Thread Hans Nordeback

ack, code review only.

/Thanks HansN


On 09/21/2018 08:55 AM, Gary Lee wrote:

Some configuration attribute are read by OpenSAF daemons as
environment variables. eg.

export FMS_PROMOTE_ACTIVE_TIMER=0

There is no easy way to reload these values without a restart.

ConfigFileReader will parse these files looking for 'export VAR=VAL'
and store them into a map, so a daemon can reload configuration
without a restart.
---
  src/base/Makefile.am   |  2 +
  src/base/config_file_reader.cc | 88 ++
  src/base/config_file_reader.h  | 30 
  3 files changed, 120 insertions(+)
  create mode 100644 src/base/config_file_reader.cc
  create mode 100644 src/base/config_file_reader.h

diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index c7dd01900..ce93562e5 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -33,6 +33,7 @@ lib_libopensaf_core_la_LDFLAGS += \
  lib_libopensaf_core_la_SOURCES += \
src/base/condition_variable.cc \
src/base/conf.cc \
+   src/base/config_file_reader.cc \
src/base/daemon.c \
src/base/file_descriptor.cc \
src/base/file_notify.cc \
@@ -94,6 +95,7 @@ noinst_HEADERS += \
src/base/buffer.h \
src/base/condition_variable.h \
src/base/conf.h \
+   src/base/config_file_reader.h \
src/base/daemon.h \
src/base/file_descriptor.h \
src/base/file_notify.h \
diff --git a/src/base/config_file_reader.cc b/src/base/config_file_reader.cc
new file mode 100644
index 0..a72f45691
--- /dev/null
+++ b/src/base/config_file_reader.cc
@@ -0,0 +1,88 @@
+/*  -*- OpenSAF  -*-
+ *
+ * Copyright Ericsson AB 2018 - 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
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include "base/config_file_reader.h"
+
+// @todo move into a string library class
+static void left_trim(std::string& str) {
+  str.erase(str.begin(), std::find_if(str.begin(), str.end(),
+  [](int c) { return !std::isspace(c); }));
+}
+
+static void right_trim(std::string& str) {
+  str.erase(std::find_if(str.rbegin(), str.rend(),
+ [](int c) { return !std::isspace(c); })
+.base(),
+str.end());
+}
+
+static void trim(std::string& str) {
+  left_trim(str);
+  right_trim(str);
+}
+
+ConfigFileReader::SettingsMap ConfigFileReader::ParseFile(
+const std::string& filename) {
+  const std::string prefix("export");
+  SettingsMap map;
+  std::ifstream file(filename);
+  std::string line;
+
+  if (file.is_open()) {
+while (getline(file, line)) {
+  // go through each line of the config file
+  // only process "export key=value" and ignore trailing comments
+  // note: value may be surrounded with quotes
+
+  // trim leading / trailing spaces
+  trim(line);
+
+  // must begin with 'export'
+  if (line.find(prefix) != 0) {
+continue;
+  }
+
+  // remove 'export'
+  line.erase(0, prefix.length());
+
+  // remove any trailing comments
+  size_t hash = line.find('#');
+  if (hash != std::string::npos) {
+line.erase(hash, std::string::npos);
+  }
+
+  trim(line);
+
+  size_t equal = line.find('=');
+  if (equal == std::string::npos ||
+  equal == 0) {
+// must look like "key=value"
+continue;
+  }
+
+  std::string key = line.substr(0, equal);
+  trim(key);
+  std::string value = line.substr(equal + 1);
+  trim(value);
+
+  map[key] = value;
+}
+file.close();
+  }
+  return map;
+}
diff --git a/src/base/config_file_reader.h b/src/base/config_file_reader.h
new file mode 100644
index 0..b369a802c
--- /dev/null
+++ b/src/base/config_file_reader.h
@@ -0,0 +1,30 @@
+/*  -*- OpenSAF  -*-
+ *
+ * Copyright Ericsson AB 2018 - 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
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ */
+
+#ifndef BASE_CONFIG_FILE_READER_H_
+#define 

Re: [devel] [PATCH 3/3] fmd: enable reload of configuration without restart [#2923]

2018-09-24 Thread Hans Nordeback

ack, code review only.

/Thanks HansN


On 09/21/2018 08:55 AM, Gary Lee wrote:

Only FMS_PROMOTE_ACTIVE_TIMER, FMS_NODE_ISOLATION_TIMEOUT and
FMS_ACTIVATION_SUPERVISION_TIMER are currently supported.

These values can be changed in fmd.conf and take effect
by sending SIGHUP to fmd.
---
  src/fm/fmd/fm_cb.h |  2 ++
  src/fm/fmd/fm_main.cc  | 71 --
  src/fm/fmd/osaf-fmd.in |  1 +
  3 files changed, 72 insertions(+), 2 deletions(-)

diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h
index 010ab735a..6eb0d54cd 100644
--- a/src/fm/fmd/fm_cb.h
+++ b/src/fm/fmd/fm_cb.h
@@ -109,6 +109,8 @@ struct FM_CB {
std::atomic peer_node_terminated{false};
  
base::Mutex mutex_{};

+
+  std::string config_file;
  };
  
  extern const char *role_string[];

diff --git a/src/fm/fmd/fm_main.cc b/src/fm/fmd/fm_main.cc
index 3371ec5e8..122b2175c 100644
--- a/src/fm/fmd/fm_main.cc
+++ b/src/fm/fmd/fm_main.cc
@@ -25,6 +25,7 @@ This file contains the main() routine for FM.
  
  #include 

  #include 
+#include "base/config_file_reader.h"
  #include "base/daemon.h"
  #include "base/logtrace.h"
  #include "base/osaf_extended_name.h"
@@ -40,7 +41,7 @@ This file contains the main() routine for FM.
  static SaVersionT clm_version = {'B', 4, 1};
  static const SaClmCallbacksT_4 clm_callbacks = {0, 0};
  
-enum { FD_TERM = 0, FD_AMF = 1, FD_MBX };

+enum { FD_TERM = 0, FD_AMF = 1, FD_MBX = 2, FD_SIGHUP = 3};
  
  FM_CB *fm_cb = NULL;

  const char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", "QUIESCED",
@@ -53,6 +54,7 @@ const char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", 
"QUIESCED",
   */
  
  static uint32_t fm_agents_startup(void);

+static void reload_configuration(FM_CB *fm_cb);
  static uint32_t fm_get_args(FM_CB *);
  static uint32_t fms_fms_exchange_node_info(FM_CB *);
  static uint32_t fms_fms_inform_terminating(FM_CB *fm_cb);
@@ -69,6 +71,7 @@ void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info,
  PCSRDA_RETURN_CODE error_code);
  uint32_t gl_fm_hdl;
  static NCS_SEL_OBJ usr1_sel_obj;
+static NCS_SEL_OBJ sighup_sel_obj;
  
  /**

   * USR1 signal is used when AMF wants instantiate us as a
@@ -83,6 +86,10 @@ static void sigusr1_handler(int sig) {
ncs_sel_obj_ind(_sel_obj);
  }
  
+static void sighup_handler(int signum, siginfo_t *info, void *ptr) {

+  ncs_sel_obj_ind(_sel_obj);
+}
+
  /**
   * Callback from RDA. Post a message/event to the FM mailbox.
   * @param cb_hdl
@@ -124,7 +131,7 @@ DESCRIPTION:  Main routine for FM
  */
  int main(int argc, char *argv[]) {
NCS_SEL_OBJ mbx_sel_obj;
-  nfds_t nfds = 3;
+  nfds_t nfds = 4;
struct pollfd fds[nfds];
int ret = 0;
int rc = NCSCC_RC_FAILURE;
@@ -215,6 +222,22 @@ int main(int argc, char *argv[]) {
  goto fm_init_failed;
}
  
+  rc = ncs_sel_obj_create(_sel_obj);

+  if (rc != NCSCC_RC_SUCCESS) {
+LOG_ER("ncs_sel_obj_create FAILED");
+goto fm_init_failed;
+  }
+
+  struct sigaction sighup;
+  sigemptyset(_mask);
+  sighup.sa_sigaction = sighup_handler;
+  sighup.sa_flags = SA_SIGINFO;
+
+  if (sigaction(SIGHUP, , NULL) != 0) {
+LOG_ER("registering SIGHUP FAILED: %s", strerror(errno));
+goto fm_init_failed;
+  }
+
if (!nid_started && fm_amf_init(_cb->fm_amf_cb) != NCSCC_RC_SUCCESS)
  goto fm_init_failed;
  
@@ -243,6 +266,9 @@ int main(int argc, char *argv[]) {

fds[FD_MBX].fd = mbx_sel_obj.rmv_obj;
fds[FD_MBX].events = POLLIN;
  
+  fds[FD_SIGHUP].fd = sighup_sel_obj.rmv_obj;

+  fds[FD_SIGHUP].events = POLLIN;
+
/* notify the NID */
if (nid_started) fm_nid_notify((uint32_t)NCSCC_RC_SUCCESS);
  
@@ -277,6 +303,11 @@ int main(int argc, char *argv[]) {

}
  }
  
+if (fds[FD_SIGHUP].revents & POLLIN) {

+  ncs_sel_obj_rmv_ind(_sel_obj, true, true);
+  reload_configuration(fm_cb);
+}
+
  if (fds[FD_MBX].revents & POLLIN) handle_mbx_event();
}
  
@@ -350,6 +381,37 @@ static uint32_t fm_agents_startup(void) {

return rc;
  }
  
+// only timer related values are reloaded

+static void reload_configuration(FM_CB *fm_cb) {
+  ConfigFileReader reader;
+  ConfigFileReader::SettingsMap map;
+
+  LOG_NO("reload configuration");
+
+  if (fm_cb->config_file.empty() == false) {
+map = reader.ParseFile(fm_cb->config_file);
+for (const auto& kv : map) {
+  if (kv.first == "FMS_PROMOTE_ACTIVE_TIMER") {
+fm_cb->active_promote_tmr_val =
+  std::stoi(kv.second);
+TRACE("FMS_PROMOTE_ACTIVE_TIMER = %d",
+  fm_cb->active_promote_tmr_val);
+  } else if (kv.first == "FMS_NODE_ISOLATION_TIMEOUT") {
+osaf_millis_to_timespec(std::stoi(kv.second),
+_cb->node_isolation_timeout);
+TRACE("NODE_ISOLATION_TIMEOUT = %" PRId64 ".%09ld",
+  

Re: [devel] [PATCH 1/3] base: remove use of SIGHUP to toggle INFO messages [#2923]

2018-09-24 Thread Hans Nordeback

ack, code review only.

/Thanks HansN


On 09/21/2018 08:55 AM, Gary Lee wrote:

We need to use SIGHUP for reload of configuration
---
  src/base/daemon.c|  5 +++--
  src/base/logtrace.cc | 22 --
  2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c
index 4a37c4174..cdde7fde0 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -416,6 +416,7 @@ void daemonize(int argc, char *argv[])
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
signal(SIGTERM, SIG_DFL); /* Die on SIGTERM */
+   signal(SIGHUP, SIG_IGN);
  
  /* RUNASROOT gives the OpenSAF user a possibility to maintain the 4.1 behaviour

   * should eventually be removed.
@@ -686,8 +687,8 @@ done:
   */
  static void install_fatal_signal_handlers(void)
  {
-   const int HANDLED_SIGNALS_MAX = 7;
-   static const int handled_signals[] = {SIGHUP,  SIGILL,  SIGABRT, SIGFPE,
+   const int HANDLED_SIGNALS_MAX = 6;
+   static const int handled_signals[] = {SIGILL,  SIGABRT, SIGFPE,
  SIGSEGV, SIGPIPE, SIGBUS};
  
  	// to circumvent lsb use dlsym to retrieve backtrace in runtime

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index c1a194f60..8908c1ff3 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -75,22 +75,6 @@ static void sigusr2_handler(int sig) {
trace_category_set(trace_mask);
  }
  
-/**

- * HUP signal handler to toggle info log level on/off
- * @param sig
- */
-static void sighup_handler(int sig) {
-  if ((global::logmask & LOG_MASK(LOG_INFO)) & LOG_MASK(LOG_INFO)) {
-global::logmask = LOG_UPTO(LOG_NOTICE);
-syslog(LOG_NOTICE, "logtrace: info level disabled");
-  } else {
-global::logmask = LOG_UPTO(LOG_INFO);
-syslog(LOG_NOTICE, "logtrace: info level enabled");
-  }
-
-  setlogmask(global::logmask);
-}
-
  void trace_output(const char *file, unsigned line, unsigned priority,
   unsigned category, const char *format, va_list ap) {
char preamble[288];
@@ -275,12 +259,6 @@ int logtrace_init_daemon(const char *ident, const char 
*pathname,
  
setlogmask(logmask);
  
-  if (signal(SIGHUP, sighup_handler) == SIG_ERR) {

-syslog(LOG_ERR, "logtrace: registering SIGHUP failed, (%s)",
-   strerror(errno));
-return -1;
-  }
-
global::logmask = logmask;
  
return logtrace_init(ident, pathname, tracemask);




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


Re: [devel] [PATCH 3/3] fmd: enable reload of configuration without restart [#2923]

2018-09-20 Thread Hans Nordeback

ack, review only. Minor comments below. /Thanks HansN


On 09/19/2018 05:42 AM, Gary Lee wrote:

Only FMS_PROMOTE_ACTIVE_TIMER, FMS_NODE_ISOLATION_TIMEOUT and
FMS_ACTIVATION_SUPERVISION_TIMER are currently supported.

These values can be changed in fmd.conf and take effect
by sending SIGHUP to fmd.
---
  src/fm/fmd/fm_cb.h |  2 ++
  src/fm/fmd/fm_main.cc  | 70 --
  src/fm/fmd/osaf-fmd.in |  1 +
  3 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/src/fm/fmd/fm_cb.h b/src/fm/fmd/fm_cb.h
index 010ab735a..6eb0d54cd 100644
--- a/src/fm/fmd/fm_cb.h
+++ b/src/fm/fmd/fm_cb.h
@@ -109,6 +109,8 @@ struct FM_CB {
std::atomic peer_node_terminated{false};
  
base::Mutex mutex_{};

+
+  std::string config_file;
  };
  
  extern const char *role_string[];

diff --git a/src/fm/fmd/fm_main.cc b/src/fm/fmd/fm_main.cc
index 3371ec5e8..3f2e9123c 100644
--- a/src/fm/fmd/fm_main.cc
+++ b/src/fm/fmd/fm_main.cc
@@ -25,6 +25,7 @@ This file contains the main() routine for FM.
  
  #include 

  #include 
+#include "base/config_file_reader.h"
  #include "base/daemon.h"
  #include "base/logtrace.h"
  #include "base/osaf_extended_name.h"
@@ -40,7 +41,7 @@ This file contains the main() routine for FM.
  static SaVersionT clm_version = {'B', 4, 1};
  static const SaClmCallbacksT_4 clm_callbacks = {0, 0};
  
-enum { FD_TERM = 0, FD_AMF = 1, FD_MBX };

+enum { FD_TERM = 0, FD_AMF = 1, FD_MBX = 2, FD_SIGHUP = 3};
  
  FM_CB *fm_cb = NULL;

  const char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", "QUIESCED",
@@ -53,6 +54,7 @@ const char *role_string[] = {"UNDEFINED", "ACTIVE", "STANDBY", 
"QUIESCED",
   */
  
  static uint32_t fm_agents_startup(void);

+static void reload_configuration(FM_CB *fm_cb);
  static uint32_t fm_get_args(FM_CB *);
  static uint32_t fms_fms_exchange_node_info(FM_CB *);
  static uint32_t fms_fms_inform_terminating(FM_CB *fm_cb);
@@ -69,6 +71,7 @@ void rda_cb(uint32_t cb_hdl, PCS_RDA_CB_INFO *cb_info,
  PCSRDA_RETURN_CODE error_code);
  uint32_t gl_fm_hdl;
  static NCS_SEL_OBJ usr1_sel_obj;
+static NCS_SEL_OBJ sighup_sel_obj;
  
  /**

   * USR1 signal is used when AMF wants instantiate us as a
@@ -83,6 +86,10 @@ static void sigusr1_handler(int sig) {
ncs_sel_obj_ind(_sel_obj);
  }
  
+static void sighup_handler(int signum, siginfo_t *info, void *ptr) {

+  ncs_sel_obj_ind(_sel_obj);
+}
+
  /**
   * Callback from RDA. Post a message/event to the FM mailbox.
   * @param cb_hdl
@@ -124,7 +131,7 @@ DESCRIPTION:  Main routine for FM
  */
  int main(int argc, char *argv[]) {
NCS_SEL_OBJ mbx_sel_obj;
-  nfds_t nfds = 3;
+  nfds_t nfds = 4;
struct pollfd fds[nfds];
int ret = 0;
int rc = NCSCC_RC_FAILURE;
@@ -215,6 +222,21 @@ int main(int argc, char *argv[]) {
  goto fm_init_failed;
}
  
+  rc = ncs_sel_obj_create(_sel_obj);

+  if (rc != NCSCC_RC_SUCCESS) {
+LOG_ER("ncs_sel_obj_create FAILED");
+goto fm_init_failed;
+  }
+
+  struct sigaction sighup;

[HansN] perhaps use sigemptyset(_mask)

+  sighup.sa_sigaction = sighup_handler;
+  sighup.sa_flags = SA_SIGINFO;
+
+  if (sigaction(SIGHUP, , NULL) != 0) {
+LOG_ER("registering SIGHUP FAILED: %s", strerror(errno));
+goto fm_init_failed;
+  }
+
if (!nid_started && fm_amf_init(_cb->fm_amf_cb) != NCSCC_RC_SUCCESS)
  goto fm_init_failed;
  
@@ -243,6 +265,9 @@ int main(int argc, char *argv[]) {

fds[FD_MBX].fd = mbx_sel_obj.rmv_obj;
fds[FD_MBX].events = POLLIN;
  
+  fds[FD_SIGHUP].fd = sighup_sel_obj.rmv_obj;

+  fds[FD_SIGHUP].events = POLLIN;
+
/* notify the NID */
if (nid_started) fm_nid_notify((uint32_t)NCSCC_RC_SUCCESS);
  
@@ -277,6 +302,11 @@ int main(int argc, char *argv[]) {

}
  }
  
+if (fds[FD_SIGHUP].revents & POLLIN) {

+  ncs_sel_obj_rmv_ind(_sel_obj, true, true);
+  reload_configuration(fm_cb);
+}
+
  if (fds[FD_MBX].revents & POLLIN) handle_mbx_event();
}
  
@@ -350,6 +380,37 @@ static uint32_t fm_agents_startup(void) {

return rc;
  }
  
+// only timer related values are reloaded

+static void reload_configuration(FM_CB *fm_cb) {
+  ConfigFileReader reader;
+  ConfigFileReader::SettingsMap map;
+
+  LOG_NO("reload configuration");
+
+  if (fm_cb->config_file.empty() == false) {
+map = reader.ParseFile(fm_cb->config_file);
+for (const auto& kv : map) {
+  if (kv.first == "FMS_PROMOTE_ACTIVE_TIMER") {
+fm_cb->active_promote_tmr_val =
+  std::stoi(kv.second);
+TRACE("FMS_PROMOTE_ACTIVE_TIMER = %d",
+  fm_cb->active_promote_tmr_val);
+  } else if (kv.first == "FMS_NODE_ISOLATION_TIMEOUT") {
+osaf_millis_to_timespec(std::stoi(kv.second),
+_cb->node_isolation_timeout);
+TRACE("NODE_ISOLATION_TIMEOUT = %" PRId64 ".%09ld",
+  

Re: [devel] [PATCH 2/3] base: add config file reader [#2923]

2018-09-20 Thread Hans Nordeback

ack, review only. Some comments below. /Thanks HansN


On 09/19/2018 05:42 AM, Gary Lee wrote:

Some configuration attribute are read by OpenSAF daemons as
environment variables. eg.

export FMS_PROMOTE_ACTIVE_TIMER=0

There is no easy way to reload these values without a restart.

ConfigFileReader will parse these files looking for 'export VAR=VAL'
and store them into a map, so a daemon can reload configuration
without a restart.
---
  src/base/Makefile.am   |  2 ++
  src/base/config_file_reader.cc | 43 ++
  src/base/config_file_reader.h  | 30 
  3 files changed, 75 insertions(+)
  create mode 100644 src/base/config_file_reader.cc
  create mode 100644 src/base/config_file_reader.h

diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index c7dd01900..ce93562e5 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -33,6 +33,7 @@ lib_libopensaf_core_la_LDFLAGS += \
  lib_libopensaf_core_la_SOURCES += \
src/base/condition_variable.cc \
src/base/conf.cc \
+   src/base/config_file_reader.cc \
src/base/daemon.c \
src/base/file_descriptor.cc \
src/base/file_notify.cc \
@@ -94,6 +95,7 @@ noinst_HEADERS += \
src/base/buffer.h \
src/base/condition_variable.h \
src/base/conf.h \
+   src/base/config_file_reader.h \
src/base/daemon.h \
src/base/file_descriptor.h \
src/base/file_notify.h \
diff --git a/src/base/config_file_reader.cc b/src/base/config_file_reader.cc
new file mode 100644
index 0..d22930505
--- /dev/null
+++ b/src/base/config_file_reader.cc
@@ -0,0 +1,43 @@
+/*  -*- OpenSAF  -*-
+ *
+ * Copyright Ericsson AB 2018 - 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
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ */
+
+#include 
+#include 
+#include "base/config_file_reader.h"
+
+ConfigFileReader::SettingsMap ConfigFileReader::ParseFile(const std::string& 
filename) {
+  SettingsMap map;
+  std::ifstream file(filename);
+  std::string line;
+
+  if (file.is_open()) {
+while (getline(file, line)) {
+  // go through each line of the config file
+  // only process "export key=value" and ignore trailing comments
+  // note: value may be surrounded with quotes
[HansN] there were some issues found using std::regex with gcc 4.8.4 in 
ticket #2165 but worked with newer compiler versions, check

the review comments for ticket #2165

+  std::regex re("^export\\s*(\\w+)\\s*=\\s*([^#\\n]+)");
+  std::sregex_token_iterator key_iter(line.begin(), line.end(), re, 1);
+  std::sregex_token_iterator value_iter(line.begin(), line.end(), re, 2);
+  std::sregex_token_iterator end;
+
+  for (; key_iter != end && value_iter != end; ++key_iter, ++value_iter) {
+// store key-value pairs into map
+map[key_iter->str()] = value_iter->str();
+  }
+}
+file.close();
+  }
+  return map;
+}
diff --git a/src/base/config_file_reader.h b/src/base/config_file_reader.h
new file mode 100644
index 0..cb281b7db
--- /dev/null
+++ b/src/base/config_file_reader.h
@@ -0,0 +1,30 @@
+/*  -*- OpenSAF  -*-
+ *
+ * Copyright Ericsson AB 2018 - 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
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ */
+
+#ifndef BASE_CONFIG_FILE_READER_H_
+#define BASE_CONFIG_FILE_READER_H_
+
+#include 
+#include 
+
+class ConfigFileReader {
+ public:

[HansN] prefer alias declarations to typedefs, (i.e. using).

+  typedef std::map SettingsMap;
+
+  // parses OpenSAF 'config' files and return key-value pairs in a map
+  ConfigFileReader::SettingsMap ParseFile(const std::string& filename);
+};
+
+#endif /* BASE_CONFIG_FILE_READER_H */




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


Re: [devel] [PATCH 1/3] base: remove use of SIGHUP to toggle INFO messages [#2923]

2018-09-20 Thread Hans Nordeback

ack, review only/Thanks HansN


On 09/19/2018 05:42 AM, Gary Lee wrote:

We need to use SIGHUP for reload of configuration
---
  src/base/daemon.c|  5 +++--
  src/base/logtrace.cc | 22 --
  2 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c
index 4a37c4174..cdde7fde0 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -416,6 +416,7 @@ void daemonize(int argc, char *argv[])
signal(SIGTTOU, SIG_IGN);
signal(SIGTTIN, SIG_IGN);
signal(SIGTERM, SIG_DFL); /* Die on SIGTERM */
+   signal(SIGHUP, SIG_IGN);
  
  /* RUNASROOT gives the OpenSAF user a possibility to maintain the 4.1 behaviour

   * should eventually be removed.
@@ -686,8 +687,8 @@ done:
   */
  static void install_fatal_signal_handlers(void)
  {
-   const int HANDLED_SIGNALS_MAX = 7;
-   static const int handled_signals[] = {SIGHUP,  SIGILL,  SIGABRT, SIGFPE,
+   const int HANDLED_SIGNALS_MAX = 6;
+   static const int handled_signals[] = {SIGILL,  SIGABRT, SIGFPE,
  SIGSEGV, SIGPIPE, SIGBUS};
  
  	// to circumvent lsb use dlsym to retrieve backtrace in runtime

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index c1a194f60..8908c1ff3 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -75,22 +75,6 @@ static void sigusr2_handler(int sig) {
trace_category_set(trace_mask);
  }
  
-/**

- * HUP signal handler to toggle info log level on/off
- * @param sig
- */
-static void sighup_handler(int sig) {
-  if ((global::logmask & LOG_MASK(LOG_INFO)) & LOG_MASK(LOG_INFO)) {
-global::logmask = LOG_UPTO(LOG_NOTICE);
-syslog(LOG_NOTICE, "logtrace: info level disabled");
-  } else {
-global::logmask = LOG_UPTO(LOG_INFO);
-syslog(LOG_NOTICE, "logtrace: info level enabled");
-  }
-
-  setlogmask(global::logmask);
-}
-
  void trace_output(const char *file, unsigned line, unsigned priority,
   unsigned category, const char *format, va_list ap) {
char preamble[288];
@@ -275,12 +259,6 @@ int logtrace_init_daemon(const char *ident, const char 
*pathname,
  
setlogmask(logmask);
  
-  if (signal(SIGHUP, sighup_handler) == SIG_ERR) {

-syslog(LOG_ERR, "logtrace: registering SIGHUP failed, (%s)",
-   strerror(errno));
-return -1;
-  }
-
global::logmask = logmask;
  
return logtrace_init(ident, pathname, tracemask);




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


Re: [devel] [PATCH 1/1] clm: add new test cases of API saClmInitialize_4() of apitest [#2914]

2018-09-17 Thread Hans Nordeback

ack, review only. Minor comment below. /Thanks HansN


On 08/21/2018 03:20 PM, Richa Tiwari wrote:

---
  src/clm/apitest/tet_saClmInitialize.cc | 53 ++
  1 file changed, 53 insertions(+)

diff --git a/src/clm/apitest/tet_saClmInitialize.cc 
b/src/clm/apitest/tet_saClmInitialize.cc
index b5c4ec0..ce8931e 100644
--- a/src/clm/apitest/tet_saClmInitialize.cc
+++ b/src/clm/apitest/tet_saClmInitialize.cc
@@ -116,6 +116,46 @@ void saClmInitialize_13() {
safassert(ClmTest::saClmFinalize(clmHandle3), SA_AIS_OK);
test_validate(rc, SA_AIS_OK);
  }
+
+void saClmInitialize_14()
+{
+   SaClmCallbacksT_4 clmCallbacks_4={nullptr,};
+   rc = ClmTest::saClmInitialize_4(, _4, 
_4);

[HansN] perhaps check the rc before next line?

+   safassert(ClmTest::saClmFinalize(clmHandle), SA_AIS_OK);
+   test_validate(rc, SA_AIS_OK);
+}
+
+void saClmInitialize_15()
+{
+   rc = ClmTest::saClmInitialize_4(nullptr, nullptr, nullptr);
+   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
+}
+
+void saClmInitialize_16()
+{
+   rc = ClmTest::saClmInitialize_4(,nullptr, nullptr);
+   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
+}
+
+void saClmInitialize_17()
+{
+   rc = ClmTest::saClmInitialize_4(nullptr, _4, nullptr);
+   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
+}
+
+void saClmInitialize_18()
+{
+   rc = ClmTest::saClmInitialize_4(nullptr, _4, 
_4);
+   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
+}
+
+void saClmInitialize_19()
+{
+   SaClmCallbacksT_4 clmCallbacks_4={nullptr,};
+   rc = ClmTest::saClmInitialize_4(nullptr, _4, 
_4);
+   test_validate(rc, SA_AIS_ERR_INVALID_PARAM);
+}
+
  #if 0
  void saClmInitialize_13()
  rc = ClmTest::saClmInitialize(, _1, _1);
@@ -164,6 +204,19 @@ __attribute__((constructor)) static void 
saNtfInitialize_constructor() {
  "saClmInitialize & saClmInitialize_4 with B.0.0 version");
test_case_add(1, saClmInitialize_13,
  "saClmInitialize with multiple instance");
+   test_case_add(1, saClmInitialize_14,
+   "saClmInitialize_4 with clusterNodeGetCallback as null");
+   test_case_add(1, saClmInitialize_15,
+   "saClmInitialize_4 with all parameters as null");
+   test_case_add(1, saClmInitialize_16,
+   "saClmInitialize_4 with callback & version as null");
+   test_case_add(1, saClmInitialize_17,
+   "saClmInitialize_4 with handle & version as null");
+   test_case_add(1, saClmInitialize_18,
+   "saClmInitialize_4 with handle as null");
+   test_case_add(1, saClmInitialize_19,
+   "saClmInitialize_4 with handle & ClusterNodeGetCallback as 
null");
+
  #if 0
/* this test case is for SA_AIS_ERR_LIBRARY, which will be passed when tipc
 *  is running and clma_create() will fail*/




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


Re: [devel] [PATCH 1/1] osaf: make takeover request expiration time configurable [#2917]

2018-09-04 Thread Hans Nordeback

Hi Gary,

ack, code review only. /Thanks HansN


On 08/22/2018 07:01 AM, Gary Lee wrote:

---
  src/fm/fmd/fmd.conf |  4 
  src/osaf/consensus/consensus.cc | 24 
  src/osaf/consensus/consensus.h  |  4 ++--
  3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/fm/fmd/fmd.conf b/src/fm/fmd/fmd.conf
index 9aff54970..9a106bf90 100644
--- a/src/fm/fmd/fmd.conf
+++ b/src/fm/fmd/fmd.conf
@@ -23,6 +23,10 @@ export FMS_NODE_ISOLATION_TIMEOUT=0
  # To enable split brain prevention, change to 1
  #export FMS_SPLIT_BRAIN_PREVENTION=0
  
+# Used with split brain prevention, this controls

+# the expiration time of takeover requests (unit is seconds)
+export FMS_TAKEOVER_REQUEST_VALID_TIME=20
+
  # Full path to key-value store plugin
  #export FMS_KEYVALUE_STORE_PLUGIN_CMD=
  
diff --git a/src/osaf/consensus/consensus.cc b/src/osaf/consensus/consensus.cc

index dc5c9bc46..1136c3724 100644
--- a/src/osaf/consensus/consensus.cc
+++ b/src/osaf/consensus/consensus.cc
@@ -229,6 +229,13 @@ Consensus::Consensus() {
std::string kv_store_cmd = base::GetEnv("FMS_KEYVALUE_STORE_PLUGIN_CMD", 
"");
uint32_t use_remote_fencing = base::GetEnv("FMS_USE_REMOTE_FENCING", 0);
  
+  // if not specified in fmd.conf,

+  // takeover requests are valid for 20 seconds
+  takeover_valid_time =
+base::GetEnv("FMS_TAKEOVER_REQUEST_VALID_TIME", 20);
+  // expiration time of takeover request is twice the max wait time
+  max_takeover_retry = takeover_valid_time / 2;
+
if (split_brain_enable == 1 && kv_store_cmd.empty() == false) {
  use_consensus_ = true;
} else {
@@ -293,10 +300,11 @@ void Consensus::CheckForExistingTakeoverRequest() {
LOG_NO("A takeover request is in progress");
  
uint32_t retries = 0;

-  // wait up to approximately 10 seconds, or until the takeover request is gone
+  // wait up to max_takeover_retry seconds,
+  // or until the takeover request is gone
rc = ReadTakeoverRequest(tokens);
while (rc == SA_AIS_OK &&
- retries < kMaxTakeoverRetry) {
+ retries < max_takeover_retry) {
  ++retries;
  TRACE("Takeover request still present");
  std::this_thread::sleep_for(kSleepInterval);
@@ -326,7 +334,7 @@ SaAisErrorT Consensus::CreateTakeoverRequest(const 
std::string& current_owner,
SaAisErrorT rc;
uint32_t retries = 0;
rc = KeyValue::Create(kTakeoverRequestKeyname, takeover_request,
-kTakeoverValidTime);
+takeover_valid_time);
while (rc == SA_AIS_ERR_FAILED_OPERATION && retries < kMaxRetry) {
  ++retries;
  std::this_thread::sleep_for(kSleepInterval);
@@ -339,11 +347,11 @@ SaAisErrorT Consensus::CreateTakeoverRequest(const 
std::string& current_owner,
  // retrieve takeover request
  std::vector tokens;
  retries = 0;
-// wait up to approximately 10 seconds, or until the takeover request is
-// gone
+// wait up to approximately max_takeover_retry seconds,
+// or until the takeover request is gone
  rc = ReadTakeoverRequest(tokens);
  while (rc == SA_AIS_OK &&
-   retries < kMaxTakeoverRetry) {
+   retries < max_takeover_retry) {
++retries;
TRACE("Takeover request still present");
std::this_thread::sleep_for(kSleepInterval);
@@ -364,9 +372,9 @@ SaAisErrorT Consensus::CreateTakeoverRequest(const 
std::string& current_owner,
  return CreateTakeoverRequest(current_owner, proposed_owner, cluster_size);
}
  
-  // wait up to 15s for request to be answered

+  // wait up to max_takeover_retry seconds for request to be answered
retries = 0;
-  while (retries < (kMaxTakeoverRetry * 1.5)) {
+  while (retries < max_takeover_retry) {
  std::vector tokens;
  if (ReadTakeoverRequest(tokens) == SA_AIS_OK) {
const std::string state =
diff --git a/src/osaf/consensus/consensus.h b/src/osaf/consensus/consensus.h
index a606d9de1..6421c7ca7 100644
--- a/src/osaf/consensus/consensus.h
+++ b/src/osaf/consensus/consensus.h
@@ -85,13 +85,13 @@ class Consensus {
   private:
bool use_consensus_ = false;
bool use_remote_fencing_ = false;
+  uint32_t takeover_valid_time;
+  uint32_t max_takeover_retry;
const std::string kTestKeyname = "opensaf_write_test";
const std::chrono::milliseconds kSleepInterval =
std::chrono::milliseconds(1000);  // in ms
static constexpr uint32_t kLockTimeout = 0;  // lock is persistent by 
default
-  static constexpr uint32_t kMaxTakeoverRetry = 20;
static constexpr uint32_t kMaxRetry = 30;
-  static constexpr uint32_t kTakeoverValidTime = 15;  // in seconds
  
void CheckForExistingTakeoverRequest();
  



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

Re: [devel] [PATCH 1/1] amfd: reboot nodes that report conflicting 2N active assignments [#2920]

2018-09-03 Thread Hans Nordeback

Hi,

I think AMF should avoid getting into this state. Resolving this state 
may be difficult.


AMF should not make any new assignments/failovers when the state of the 
failing node/component is not known,


i.e. we should prefer consistency before availability.

/Thanks HansN


On 09/03/2018 12:33 PM, nagen...@hasolutions.in wrote:

Hi Gary,
Thanks for your response.
Susi delete will be little slower in resolving the conflicts, but 
advantage it has over reboot is, it doesn't impact other applications. 
The other advantage of susi delete is that the availability of SUs for 
workload assignments will be lesser in reboot than Susi delete as 
reboot will take its own time to come back and instantiate SUs. Also, 
I think  susi delete of one SU will do.
Going forward, we can intimate the applications that its assignments 
are being removed because of re-merge after split(either by CSI or by 
OsafCsiAttributeChangeCallbackT), it would help them taking their own 
actions like syncing of DB, etc.
My take would be that we shouldn't use reboot in any case by Amf, we 
need to recover from our situations by our self. As a HA software, we 
need to adopt self healing approach.

What other co-maintainers say?
Thanks,
Nagendra, 91-9866424860
High Availability Solutions Pvt. Ltd. (www.hasolutions.in)
- OpenSAF Support and Services
 - Original Message -

Subject: Re: [PATCH 1/1] amfd: reboot nodes that report
conflicting 2N active assignments [#2920]
From: "Gary Lee" 
Date: 9/3/18 1:36 pm
To: nagen...@hasolutions.in, hans.nordeb...@ericsson.com,
minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net

Hi Nagendra

On 03/09/18 17:50, nagen...@hasolutions.in wrote:
> Hi Gary,
> I have few questions:
> 1. Do we really want to reboot both the nodes in case of conflicts?

That's a good question. A cluster reboot should also be considered? I
have proposed both nodes as it's somewhere in between. Keep in mind
other SG types could be affected also, but not picked up.

> 2. Even we want to send reboot to one node, which node we should
send
> the reboot, the one, which was a part of smaller cluster?

I think we should keep it simple for this ticket, as it's really
just a
stop gap. Something like #2918 should be considered.

> 3. If we could differentiate here that the conflicts happened
because
> of re-merge, then will susi_delete message(here also, we need to
> decide which SU susi need to be deleted) will do rather than
reboot?
> Rebooting will be little to harsh for other applications running on
> the nodes, it is just my understanding.

> 4. In general, what we assume if the partition is merged,
applications
> for sure will be out of sync , so just deleting the susi will do
or we
> need to reboot for sure. This is just for my understanding as I
am not
> much aware of actual application level impact(in terms of Data
base,
> its behavior, etc.).

I think we want to resolve the conflicting state as soon as possible.
Would deleting the susi be potentially slower than issuing a reboot?

Thanks
Gary



--
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] amfd: Set SA_AMF_READINESS_IN_SERVICE for qualified SU after cluster startup timeout [#2916]

2018-08-22 Thread Hans Nordeback

ack, review only/Thanks HansN


On 08/22/2018 12:23 PM, Minh Chau wrote:

In the scenario of single step upgrade where the UNLOCK-IN/UNLOCK
admin op are issued to a SU hosted on non-active node while cluster
startup timer is active and not all ncs SU on that node are fully
assigned. In such case, amfd currently accepts the UNLOCK admin op,
change AdminState to UNLOCKED but the ReadinessState is still OUT_OF_SERVICE.
When the cluster startup timeout, amfd is not giving assignment to
this SU which is still OUT_OF_SERVICE. amfd should return TRY_AGAIN
in the first place of UNLOCK command since the node is still DISABLED
and ABSENT since all ncs SUs are not assigned, but it would cause
the upgrade delays.

When cluster startup timer expires, the patch checks if SU is qualified
to be IN_SERVICE but its readiness state is still OUT_OF_SERVICE, set
it to be IN_SERVICE before amfd starts assignments.
---
  src/amf/amfd/cluster.cc | 13 +
  1 file changed, 13 insertions(+)

diff --git a/src/amf/amfd/cluster.cc b/src/amf/amfd/cluster.cc
index 156c5c9..83fd47d 100644
--- a/src/amf/amfd/cluster.cc
+++ b/src/amf/amfd/cluster.cc
@@ -85,6 +85,19 @@ void avd_cluster_tmr_init_evh(AVD_CL_CB *cb, AVD_EVT *evt) {
  node->node_info.nodeId != cb->node_id_avd_other)
avd_snd_set_leds_msg(cb, node);
}
+  /* If the SU is qualified to be IN_SERVICE but its readiness state
+   * is still OUT_OF_SERVICE, set it to be IN_SERVICE.
+   * This scenario happens if the UNLOCK-in/UNLOCK admin op is issued
+   * to a SU hosted on non-active node while cluster startup timer is
+   * active and not all ncs SU on that node are fully assigned
+   */
+  for (const auto  : *su_db) {
+AVD_SU *i_su = value.second;
+if (i_su->is_in_service() && i_su->sg_of_su->sg_ncs_spec == false &&
+i_su->saAmfSuReadinessState == SA_AMF_READINESS_OUT_OF_SERVICE) {
+  i_su->set_readiness_state(SA_AMF_READINESS_IN_SERVICE);
+}
+  }
  
/* call the realignment routine for each of the SGs in the

 * system that are not NCS specific.



--
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] mbc: fix mbcsv loop forever while it is being dispatch ALL [#2899]

2018-08-20 Thread Hans Nordeback

Hi Canh,

ack, code review only. /Thanks HansN


On 08/20/2018 10:48 AM, Canh Van Truong wrote:

When processing "MBCSV_PEER_UP_MSG" msg in case dispatch all from user,
the msg may be too old. The msg may be come from the node that already rebooted.
This reason cause mbcsv loop forever in WHILE loop, because the active node 
cannot
find the adest of peer msg.

The solution is that find entity in peer list and compare if the peer node id 
that
already exist. If the peer node id exist in the entity (get node id from peer 
anchor),
this mean that mbcsv already processed the "MBCSV_PEER_UP_MSG" for that peer 
node.
---
  src/mbc/mbcsv_env.h  |  2 --
  src/mbc/mbcsv_peer.c | 90 ++--
  2 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/src/mbc/mbcsv_env.h b/src/mbc/mbcsv_env.h
index 350655bed..4d1f24310 100644
--- a/src/mbc/mbcsv_env.h
+++ b/src/mbc/mbcsv_env.h
@@ -519,8 +519,6 @@ uint32_t mbcsv_hdl_dispatch_block(uint32_t mbcsv_hdl, 
SYSF_MBX mbx);
  /*
   * Peer discovery function prototypes.
   */
-PEER_INST *mbcsv_search_and_return_peer(PEER_INST *peer_list,
-MBCSV_ANCHOR anchor);
  PEER_INST *mbcsv_add_new_peer(CKPT_INST *ckpt, MBCSV_ANCHOR anchor);
  uint32_t mbcsv_shutdown_peer(PEER_INST *peer_ptr);
  uint32_t mbcsv_rmv_peer(CKPT_INST *ckpt, MBCSV_ANCHOR anchor);
diff --git a/src/mbc/mbcsv_peer.c b/src/mbc/mbcsv_peer.c
index f863591c4..a429ee9f8 100644
--- a/src/mbc/mbcsv_peer.c
+++ b/src/mbc/mbcsv_peer.c
@@ -56,6 +56,73 @@ static const char *disc_trace[] = {"Peer UP msg", "Peer DOWN 
msg",
   "Peer INFO msg", "Peer INFO resp msg",
   "Peer Role change msg"
   "Invalid peer discovery msg"};
+typedef enum {ANCHOR_SEARCH, NODE_ID_SEARCH} SearchMode;
+
+
+/**\
+* PROCEDURE: search_peer_list
+*
+* Purpose:  This function search MBCA peer list for a match of complete
+*   anchor value (all 64 bits) or Node Id (most significant 32 bits of
+*   anchor value)
+*
+* Input:peer_list - MBCSv peer list.
+*   anchor - Anchor value of the peer to be searched in the list.
+*   search_mode - See enum SearchMode for search alternatives
+*
+* Returns:  Pointer to found peer instance or NULL if no instance found
+*
+* Notes:
+*
+\**/
+static PEER_INST *search_peer_list(PEER_INST *peer_list,
+  MBCSV_ANCHOR anchor,
+  SearchMode search_mode)
+{
+   PEER_INST *peer = NULL, *found_peer = NULL;
+   uint32_t node_id;
+   uint32_t peer_node_id = m_NCS_NODE_ID_FROM_MDS_DEST(anchor);
+
+   for (peer = peer_list; peer != NULL; peer = peer->next) {
+   if (search_mode == ANCHOR_SEARCH) {
+   if (peer->peer_anchor == anchor) {
+   found_peer = peer;
+   break;
+   }
+   } else if (search_mode == NODE_ID_SEARCH) {
+   node_id =
+   m_NCS_NODE_ID_FROM_MDS_DEST(peer->peer_anchor);
+   if (node_id == peer_node_id) {
+   found_peer = peer;
+   break;
+   }
+   } else {
+   TRACE("Unsupport search mode");
+   }
+   }
+   return found_peer;
+}
+
+/**\
+* PROCEDURE: mbcsv_check_if_peer_node_id_exist
+*
+* Purpose:  This function searches entire MBCA peer list for the peer entity
+*   and checking if the peer nodeId is exist in peer entity
+*
+* Input:peer_list - MBCSv peer list.
+*   anchor - Anchor value of the peer to be searched in the list.
+*
+* Returns:  True/False
+*
+* Notes:
+*
+\**/
+static bool check_if_peer_node_id_exist(PEER_INST *peer_list,
+   MBCSV_ANCHOR anchor)
+{
+   PEER_INST *peer = search_peer_list(peer_list, anchor, NODE_ID_SEARCH);
+   return (peer != NULL);
+}
  
  /**\

  * PROCEDURE: mbcsv_search_and_return_peer
@@ -64,23 +131,17 @@ static const char *disc_trace[] = {"Peer UP msg", "Peer DOWN 
msg",
  *   peer entity and returns peer pointer.
  *
  * Input:peer_list - MBCSv peer list.
-*   anchor - Anchor value of the peer to be serched in the list.
+*   anchor - Anchor value of the peer to be searched in the list.
  *
  * Returns:  Peer instance pointer.
  *
  * Notes:
  *
  \**/

Re: [devel] [PATCH 1/1] mbc: fix mbcsv loop forever while it is being dispatch ALL [#2899]

2018-08-08 Thread Hans Nordeback

Hi Canh,

ack, review only. One minor comment, instead of adding a similar function

mbcsv_check_if_peer_node_id_exist

reuse

mbcsv_search_and_return_peer

and add a new argument to this function (upper/lower/all part of 
archword) instead. It is not that many place that


needs to be updated and code redundancy is avoided.

/Thanks HansN


On 07/30/2018 06:16 AM, Canh Van Truong wrote:

When processing "MBCSV_PEER_UP_MSG" msg in case dispatch all from user,
the msg may be too old. The msg may be come from the node that already rebooted.
This reason cause mbcsv loop forever in WHILE loop, because the active node 
cannot
find the adest of peer msg.

The solution is that find entity in peer list and compare if the peer node id 
that
already exist. If the peer node id exist in the entity (get node id from peer 
anchor),
this mean that mbcsv already processed the "MBCSV_PEER_UP_MSG" for that peer 
node.
---
  src/mbc/mbcsv_peer.c | 41 -
  1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/src/mbc/mbcsv_peer.c b/src/mbc/mbcsv_peer.c
index f863591c4..736c015c2 100644
--- a/src/mbc/mbcsv_peer.c
+++ b/src/mbc/mbcsv_peer.c
@@ -64,7 +64,7 @@ static const char *disc_trace[] = {"Peer UP msg", "Peer DOWN 
msg",
  *   peer entity and returns peer pointer.
  *
  * Input:peer_list - MBCSv peer list.
-*   anchor - Anchor value of the peer to be serched in the list.
+*   anchor - Anchor value of the peer to be searched in the list.
  *
  * Returns:  Peer instance pointer.
  *
@@ -83,6 +83,36 @@ PEER_INST *mbcsv_search_and_return_peer(PEER_INST *peer_list,
return NULL;
  }
  
+/**\

+* PROCEDURE: mbcsv_check_if_peer_node_id_exist
+*
+* Purpose:  This function searches entire MBCA peer list for the peer entity
+*   and checking if the peer nodeId is exist in peer entity
+*
+* Input:peer_list - MBCSv peer list.
+*   anchor - Anchor value of the peer to be searched in the list.
+*
+* Returns:  True/False
+*
+* Notes:
+*
+\**/
+bool mbcsv_check_if_peer_node_id_exist(PEER_INST *peer_list,
+  MBCSV_ANCHOR anchor)
+{
+   PEER_INST *peer;
+   uint32_t node_id;
+   uint32_t peer_node_id = anchor >> 32;
+
+   for (peer = peer_list; peer != NULL; peer = peer->next) {
+   node_id = peer->peer_anchor >> 32;
+   if (node_id == peer_node_id)
+   return true;
+   }
+
+   return false;
+}
+
  /**\
  * PROCEDURE: mbcsv_add_new_peer
  *
@@ -733,6 +763,15 @@ uint32_t mbcsv_process_peer_up_info(MBCSV_EVT *msg, 
CKPT_INST *ckpt,
}
}
  
+	// If the node id exist in any peer entity of the peer list, we already

+   // got peer up message for that peer node. So This peer up message
+   // is invalid and just ignore it. Fixed bug #2899
+   if (mbcsv_check_if_peer_node_id_exist(
+  ckpt->peer_list, msg->rcvr_peer_key.peer_anchor) == true) {
+   TRACE_LEAVE2("Peer up message is too old. Just ignore this");
+   return NCSCC_RC_SUCCESS;
+   }
+
if (0 != (mbx = mbcsv_get_mbx(msg->rcvr_peer_key.pwe_hdl,
  msg->rcvr_peer_key.svc_id))) {
  



--
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] amf: remove assignment for NPI component with enable DisableRestart [#2879]

2018-08-07 Thread Hans Nordeback

Hi Thang,

yes, you copied it from above, it looks as it is misspelled, thus -> 
this at both comments?/Thanks HansN



On 08/07/2018 10:49 AM, Thang Nguyen wrote:

Hi Hans,

Thanks for your review.
But that comment has already existed.

B.R
/Thang

-Original Message-
From: Hans Nordeback 
Sent: Tuesday, August 7, 2018 2:55 PM
To: thang.nguyen ; gary@dektech.com.au; 
minh.c...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] amf: remove assignment for NPI component with enable 
DisableRestart [#2879]

Hi Thang,

ack, code review only. Very minor comment below. /Thanks HansN


On 06/27/2018 07:48 PM, thang.nguyen wrote:

With NPI component configured with saAmfCtDefDisableRestart=1. Once
invoking restart admin op, amfnd does not remove the assignment and cause the 
crash.

Remove assignment before change the pres state to TERMINATION in clc.
---
   src/amf/amfnd/clc.cc | 9 +
   1 file changed, 9 insertions(+)

diff --git a/src/amf/amfnd/clc.cc b/src/amf/amfnd/clc.cc index
c8e60e6..df8356a 100644
--- a/src/amf/amfnd/clc.cc
+++ b/src/amf/amfnd/clc.cc
@@ -2217,6 +2217,15 @@ uint32_t avnd_comp_clc_inst_restart_hdler(AVND_CB *cb, 
AVND_COMP *comp) {
   /* invoke terminate callback */
   rc = avnd_comp_cbk_send(cb, comp, AVSV_AMF_COMP_TERM, 0, 0);
   else {
+  if (m_AVND_COMP_IS_RESTART_DIS(comp) && (comp->csi_list.n_nodes > 0)) {
+/* A NPI component with DisableRestart=1. Restart admin op on su or 
this
+comp itself, first perform reassignment for this component to other SU
+then term it. At present assignment of whole SU will be gracefully
+reassigned instead of only this comp.
+*/

[HansN] (and also the same comment in the if stmt before this else)

  /*Send amfd to gracefully remove assignments for this SU.*/


+/*Send amfd to gracefully remove assignments for thus SU.*/
+su_send_suRestart_recovery_msg(comp->su);
+  }
 rc =
 avnd_comp_clc_cmd_execute(cb, comp, 
AVND_COMP_CLC_CMD_TYPE_TERMINATE);
 m_AVND_COMP_REG_PARAM_RESET(cb, comp);





--
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] amf: remove assignment for NPI component with enable DisableRestart [#2879]

2018-08-07 Thread Hans Nordeback

Hi Thang,

ack, code review only. Very minor comment below. /Thanks HansN


On 06/27/2018 07:48 PM, thang.nguyen wrote:

With NPI component configured with saAmfCtDefDisableRestart=1. Once invoking
restart admin op, amfnd does not remove the assignment and cause the crash.

Remove assignment before change the pres state to TERMINATION in clc.
---
  src/amf/amfnd/clc.cc | 9 +
  1 file changed, 9 insertions(+)

diff --git a/src/amf/amfnd/clc.cc b/src/amf/amfnd/clc.cc
index c8e60e6..df8356a 100644
--- a/src/amf/amfnd/clc.cc
+++ b/src/amf/amfnd/clc.cc
@@ -2217,6 +2217,15 @@ uint32_t avnd_comp_clc_inst_restart_hdler(AVND_CB *cb, 
AVND_COMP *comp) {
  /* invoke terminate callback */
  rc = avnd_comp_cbk_send(cb, comp, AVSV_AMF_COMP_TERM, 0, 0);
  else {
+  if (m_AVND_COMP_IS_RESTART_DIS(comp) && (comp->csi_list.n_nodes > 0)) {
+/* A NPI component with DisableRestart=1. Restart admin op on su or 
this
+comp itself, first perform reassignment for this component to other SU
+then term it. At present assignment of whole SU will be gracefully
+reassigned instead of only this comp.
+*/

[HansN] (and also the same comment in the if stmt before this else)

/*Send amfd to gracefully remove assignments for this SU.*/


+/*Send amfd to gracefully remove assignments for thus SU.*/
+su_send_suRestart_recovery_msg(comp->su);
+  }
rc =
avnd_comp_clc_cmd_execute(cb, comp, 
AVND_COMP_CLC_CMD_TYPE_TERMINATE);
m_AVND_COMP_REG_PARAM_RESET(cb, comp);



--
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 2/2] rded: perform KV store operations outside main thread [#2905]

2018-08-07 Thread Hans Nordeback

Hi Gary,

ack, review only. Minor comments below. /Thanks HansN


On 08/01/2018 06:49 AM, Gary Lee wrote:

Sometimes the 'watch' command in the KV plugin will not return
a takeover request, if the KV store does not respond in time.
Then rded would try to read the takeover request in the main
thread after receiving a takeover request notification.

This can cause rded to not respond to AMF callbacks in a timely
fashion. We should try to read the takeover request in another
thread to avoid this.
---
  src/rde/rded/role.cc | 26 --
  1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/rde/rded/role.cc b/src/rde/rded/role.cc
index 0567fdfcf..8e0411ee5 100644
--- a/src/rde/rded/role.cc
+++ b/src/rde/rded/role.cc
@@ -51,12 +51,34 @@ void Role::MonitorCallback(const std::string& key, const 
std::string& new_value,
  
rde_msg* msg = static_cast(malloc(sizeof(rde_msg)));

if (key == Consensus::kTakeoverRequestKeyname) {

[HansN] std::string request;

+std::string request("");
+
+if (new_value.empty() == true) {
+  // sometimes the KV store plugin doesn't return the new value,
+  // let's try to read it in this thread to avoid stalling
+  // the main thread
+  TRACE("Empty takeover request from callback. Try reading it");
+
+  SaAisErrorT rc = SA_AIS_ERR_TRY_AGAIN;
+  constexpr uint8_t max_retry = 5;
+  uint8_t retries = 0;
+  Consensus consensus_service;
+
+  while (retries < max_retry && rc != SA_AIS_OK) {
+rc = consensus_service.ReadTakeoverRequest(request);
+++retries;
+  }
+} else {
+  // use the value received in callback
+  request = new_value;
+}
+
  // don't send this to the main thread straight away, as it will
  // need some time to process topology changes.
  msg->type = RDE_MSG_TAKEOVER_REQUEST_CALLBACK;
-size_t len = new_value.length() + 1;
+size_t len = request.length() + 1;
  msg->info.takeover_request = new char[len];
-strncpy(msg->info.takeover_request, new_value.c_str(), len);
+strncpy(msg->info.takeover_request, request.c_str(), len);
  LOG_NO("Sending takeover request '%s' to main thread",
msg->info.takeover_request);
  std::this_thread::sleep_for(std::chrono::seconds(4));



--
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/2] osaf: add function to read takeover requests [#2905]

2018-08-07 Thread Hans Nordeback

Hi Gary,

ack, review only. /Thanks HansN


On 08/01/2018 06:49 AM, Gary Lee wrote:

---
  src/osaf/consensus/consensus.cc | 17 +
  src/osaf/consensus/consensus.h  |  3 +++
  2 files changed, 20 insertions(+)

diff --git a/src/osaf/consensus/consensus.cc b/src/osaf/consensus/consensus.cc
index 800b776e6..2a8e9bb1c 100644
--- a/src/osaf/consensus/consensus.cc
+++ b/src/osaf/consensus/consensus.cc
@@ -453,6 +453,23 @@ SaAisErrorT Consensus::ParseTakeoverRequest(const 
std::string& request,
return SA_AIS_OK;
  }
  
+SaAisErrorT Consensus::ReadTakeoverRequest(std::string& request) {

+  TRACE_ENTER();
+
+  std::string value;
+  SaAisErrorT rc;
+
+  rc = KeyValue::Get(kTakeoverRequestKeyname, value);
+  if (rc != SA_AIS_OK) {
+// it doesn't always exist, don't log an error
+TRACE("Could not read takeover request (%d)", rc);
+return SA_AIS_ERR_FAILED_OPERATION;
+  }
+
+  request = value;
+  return SA_AIS_OK;
+}
+
  SaAisErrorT Consensus::ReadTakeoverRequest(std::vector& tokens) {
TRACE_ENTER();
  
diff --git a/src/osaf/consensus/consensus.h b/src/osaf/consensus/consensus.h

index fbcbb2037..a606d9de1 100644
--- a/src/osaf/consensus/consensus.h
+++ b/src/osaf/consensus/consensus.h
@@ -45,6 +45,9 @@ class Consensus {
void MonitorTakeoverRequest(ConsensusCallback callback,
const uint32_t user_defined);
  
+  // Retrieve takeover request (if any)

+  SaAisErrorT ReadTakeoverRequest(std::string& request);
+
// Is consensus service enabled?
bool IsEnabled() const;
  



--
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] imm: attrDefaultValue is set to NULL if no default value is given [#2901]

2018-08-06 Thread Hans Nordeback

Hi Vu,

ack, review only. Minor comment below./Thanks HansN


On 07/30/2018 10:46 AM, Vu Minh Nguyen wrote:

When explicitly having  tag, but no value is given:
, set NULL to attrDefaultValue.
---
  src/imm/immloadd/imm_loader.cc | 3 ++-
  src/imm/tools/imm_import.cc| 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/imm/immloadd/imm_loader.cc b/src/imm/immloadd/imm_loader.cc
index de5a575e9..ad9785e92 100644
--- a/src/imm/immloadd/imm_loader.cc
+++ b/src/imm/immloadd/imm_loader.cc
@@ -1909,7 +1909,8 @@ void addClassAttributeDefinition(
attrDefinition.attrFlags = attrFlags;
  
/* Set the default value */

-  if (attrDefaultValueBuffer) {
+  if (attrDefaultValueBuffer &&

[HansN] use static_cast(attrDefaultValueBuffer) instead or

(strlen(attrDefaultValueBuffer) > 0)) {   (instead of the reinterpret_cast, not 
needed though)


+  (strlen(reinterpret_cast(attrDefaultValueBuffer)) > 0)) {
  charsToValueHelper(, attrValueType,
 (const char *)attrDefaultValueBuffer);
} else {
diff --git a/src/imm/tools/imm_import.cc b/src/imm/tools/imm_import.cc
index e2bdcba5c..8145ec572 100644
--- a/src/imm/tools/imm_import.cc
+++ b/src/imm/tools/imm_import.cc
@@ -2444,7 +2444,8 @@ static void addClassAttributeDefinition(ParserState 
*state) {
}
  
/* Set the default value */

-  if (state->attrDefaultValueSet) {
+  if (state->attrDefaultValueSet &&

[HansN] use static_cast(attrDefaultValueBuffer) instead or

(strlen(attrDefaultValueBuffer) > 0)) {   (instead of the reinterpret_cast, not 
needed though)


+  (strlen(reinterpret_cast(state->attrDefaultValueBuffer)) > 0)) {
  if (charsToValueHelper(,
 state->attrValueType, 
state->attrDefaultValueBuffer,
 state->strictParse)) {



--
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] dtm: Add --extract-trace option to osaflog command V2 [#2894]

2018-08-03 Thread Hans Nordeback

Hi Minh,

ack, review only. Minor comment below. /Thanks HansN


On 07/20/2018 05:33 AM, Minh Chau wrote:

If a process produces a core dump file that has THREAD_TRACE_BUFFER
enabled, this option reads the core dump file to extract the trace
strings in all threads and writes them to the trace file.
---
  src/base/log_writer.h|   3 +-
  src/dtm/tools/osaflog.cc | 100 +--
  2 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/src/base/log_writer.h b/src/base/log_writer.h
index a7c5000..0a03e92 100644
--- a/src/base/log_writer.h
+++ b/src/base/log_writer.h
@@ -45,6 +45,7 @@ class LogWriter {
void Write(size_t size);
void Write(const char* bytes, size_t size);
void Flush();
+  void SetLogFile(const std::string& log_file) { log_file_ = log_file; }
  
   private:

constexpr static const size_t kBufferSize = 128 * size_t{1024};
@@ -54,7 +55,7 @@ class LogWriter {
  
std::string log_file(size_t backup) const;
  
-  const std::string log_file_;

+  std::string log_file_;
int fd_;
size_t current_file_size_;
size_t current_buffer_size_;
diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc
index c5946ee..87deecb 100644
--- a/src/dtm/tools/osaflog.cc
+++ b/src/dtm/tools/osaflog.cc
@@ -27,10 +27,15 @@
  #include 
  #include 
  #include 
+#include 
+#include 
  #include 
  #include 
  #include 
  #include 
+#include 
+#include "base/logtrace_buffer.h"
+#include "base/log_writer.h"
  #include "base/string_parse.h"
  #include "base/time.h"
  #include "base/unix_server_socket.h"
@@ -53,7 +58,7 @@ std::string PathName(const std::string& log_stream, int 
suffix);
  uint64_t GetInode(int fd);
  bool PrettyPrint(FILE* stream);
  bool PrettyPrint(const char* line, size_t size);
-
+int ExtractTrace(const std::string& core_file, const std::string& trace_file);
  char buf[65 * 1024];
  
  }  // namespace

@@ -64,6 +69,7 @@ int main(int argc, char** argv) {
{"flush", no_argument, 0, 'f'},
{"print", no_argument, nullptr, 'p'},
{"delete", no_argument, nullptr, 'd'},
+  {"extract-trace", required_argument, 0, 'e'},
{0, 0, 0, 0}};
  
uint64_t max_file_size = 0;

@@ -81,13 +87,16 @@ int main(int argc, char** argv) {
bool delete_set = false;
bool max_file_size_set = false;
bool max_backups_set = false;
+  bool thread_trace = false;

[HansN] use
     std::string input_core;
 std::string output_trace;  (default constructor), instead.

+  std::string input_core = "";
+  std::string output_trace = "";
  
if (argc == 1) {

   PrintUsage(argv[0]);
   exit(EXIT_FAILURE);
}
  
-  while ((option = getopt_long(argc, argv, "m:b:p:f",

+  while ((option = getopt_long(argc, argv, "m:b:p:f:e:",
 long_options, _index)) != -1) {
  switch (option) {
   case 'p':
@@ -115,11 +124,33 @@ int main(int argc, char** argv) {
   exit(EXIT_FAILURE);
 }
   break;
+ case 'e':
+   if (argv[optind] == nullptr || optarg == nullptr) {
+ fprintf(stderr, "Coredump file or output trace file is "
+ "not specified in arguments\n");
+ exit(EXIT_FAILURE);
+   }
+   input_core = std::string(optarg);
+   output_trace = std::string(argv[optind]);
+   struct stat statbuf;
+   if (stat(input_core.c_str(), ) != 0) {
+fprintf(stderr, "Core dump file does not exist\n");
+exit(EXIT_FAILURE);
+   }
+
+   if (stat(output_trace.c_str(), ) == 0) {
+ fprintf(stderr, "Output trace file already exists\n");
+ exit(EXIT_FAILURE);
+   }
+   thread_trace = true;
+   break;
   default: PrintUsage(argv[0]);
   exit(EXIT_FAILURE);
  }
}
  
+  if (thread_trace) exit(ExtractTrace(input_core, output_trace));

+
if (argc > optind && !pretty_print_set && !delete_set) {
  pretty_print_set = true;
  flush_set = true;
@@ -183,7 +214,13 @@ void PrintUsage(const char* program_name) {
"  G can be used for kilo-, mega- and\n"
"  gigabytes.\n"
"--max-backups=NUM Set the maximum number of backup files to\n"
-  "  retain during log rotation to NUM.\n",
+  "  retain during log rotation to NUM.\n"
+  "--extract-trace  \n"
+  "  If a process produces a core dump file has\n"
+  "  THREAD_TRACE_BUFFER enabled, this option\n"
+  "  

Re: [devel] [PATCH 1/1] amfd: check for queued updates on attribute [#2884]

2018-07-31 Thread Hans Nordeback

Hi Gary,

a minor comment below.

/Regards HansN


On 07/06/2018 04:07 AM, Gary Lee wrote:

If there is a queued update on a particular object's attribute,
also queue further 'sync' updates so we don't end up with an
inconsistent value.
---
  src/amf/amfd/imm.cc | 35 +--
  src/amf/amfd/imm.h  |  9 ++---
  2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/src/amf/amfd/imm.cc b/src/amf/amfd/imm.cc
index ac7a3cbae..82d2b1329 100644
--- a/src/amf/amfd/imm.cc
+++ b/src/amf/amfd/imm.cc
@@ -26,6 +26,7 @@
  #include 
  #include 
  #include 
+#include 
  #include 
  
  #include 

@@ -393,7 +394,7 @@ Job *Fifo::peek() {
  }
  
  //

-void Fifo::queue(Job *job) { job_.push(job); }
+void Fifo::queue(Job *job) { job_.push_back(job); }
  
  //

  Job *Fifo::dequeue() {
@@ -403,7 +404,7 @@ Job *Fifo::dequeue() {
  tmp = 0;
} else {
  tmp = job_.front();
-job_.pop();
+job_.pop_front();
}
  
return tmp;

@@ -550,8 +551,27 @@ void Fifo::trim_to_size(const uint32_t size) {
TRACE_LEAVE();
  }
  
+bool Fifo::pendingImmUpdateOp(const std::string& dn,

+  const std::string& attribute) {
+  TRACE_ENTER();
+
+  for (auto job : job_) {
+if (job->getJobType() == JOB_TYPE_IMM &&
+typeid(*job) == typeid(ImmObjUpdate)) {
[HansN] you can remove the typeinfo include and the typeid funciton and 
check the result of the dynamic_cast instead (nullptr), e.g:

  if (ImmObjUpdate *update_job = dynamic_cast(job)) { ...

+  ImmObjUpdate *update_job = dynamic_cast(job);
+  if (update_job->dn == dn &&
+  update_job->attributeName_ == attribute) {
+TRACE("Found an existing update on '%s'", dn.c_str());
+return true;
+  }
+}
+  }
+
+  return false;
+}
+
  //
-std::queue Fifo::job_;
+std::deque Fifo::job_;
  //
  
  extern struct ImmutilWrapperProfile immutilWrapperProfile;

@@ -1756,7 +1776,7 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sync(
  const std::string , SaImmAttrNameT attributeName,
  SaImmValueTypeT attrValueType, void *value,
  SaImmAttrModificationTypeT modifyType) {
-  SaAisErrorT rc = SA_AIS_OK;
+  SaAisErrorT rc = SA_AIS_ERR_TRY_AGAIN;
SaImmAttrModificationT_2 attrMod;
const SaImmAttrModificationT_2 *attrMods[] = {, nullptr};
SaImmAttrValueT attrValues[] = {value};
@@ -1764,7 +1784,10 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sync(
bool isImmReady = isImmServiceReady(avd_cb);
  
TRACE_ENTER2("'%s' %s", dn.c_str(), attributeName);

-  if (isImmReady == true) {
+  // Only perform the update if there isn't a pending IMM update involving
+  // the attribute. Else queue it so the attribute's value remains consistent.
+  if (isImmReady == true &&
+  Fifo::pendingImmUpdateOp(dn, attribute_name) == false) {
  attrMod.modType = modifyType;
  attrMod.modAttr.attrName = attributeName;
  attrMod.modAttr.attrValuesNumber = 1;
@@ -1777,7 +1800,7 @@ SaAisErrorT avd_saImmOiRtObjectUpdate_sync(
   attributeName, rc);
}
  
-  if (rc != SA_AIS_OK || isImmReady == false) {

+  if (rc != SA_AIS_OK) {
  // Now it will be updated through job queue.
  avd_saImmOiRtObjectUpdate(dn, attribute_name, attrValueType, value);
}
diff --git a/src/amf/amfd/imm.h b/src/amf/amfd/imm.h
index 1778d27ee..3cfc207cf 100644
--- a/src/amf/amfd/imm.h
+++ b/src/amf/amfd/imm.h
@@ -26,10 +26,10 @@
  #ifndef AMF_AMFD_IMM_H_
  #define AMF_AMFD_IMM_H_
  
+#include 

+#include 
  #include "amf/amfd/cb.h"
  #include "osaf/immutil/immutil.h"
-#include 
-#include 
  
  typedef void (*AvdImmOiCcbApplyCallbackT)(CcbUtilOperationData_t *opdata);

  typedef SaAisErrorT (*AvdImmOiCcbCompletedCallbackT)(
@@ -177,8 +177,11 @@ class Fifo {
  
static void trim_to_size(const uint32_t size);
  
+  static bool pendingImmUpdateOp(const std::string& dn,

+ const std::string& attribute);
+
   private:
-  static std::queue job_;
+  static std::deque job_;
  };
  //
  



--
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] amfd: Check IMM status before calling saImmOiDispatch [#2885]

2018-07-30 Thread Hans Nordeback

Hi Minh,

I noticed this ticket is set as fixed but one question. Looking at the 
backtrace in the ticket, it seems


that the imma_cb struct cb_lock mutex is created in thread 5 
(avd_imm_reinit_bg_thread)


but in the main thread pthread_mutex_unlock intents to unlock the "old" 
cb_lock mutex


but instead uses the new mutex and gets i_code=1, EPERM (ownership of 
mutex?). If so, I think this is a problem that we


need to look at.

/Regards HansN


On 07/03/2018 01:25 PM, Minh Chau wrote:

Currently amfd already check @avd_imm_status before setting fd,
amfd should also check @avd_imm_status before calling saImmOiDispatch
---
  src/amf/amfd/main.cc | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amf/amfd/main.cc b/src/amf/amfd/main.cc
index 51a6064..d42fd4e 100644
--- a/src/amf/amfd/main.cc
+++ b/src/amf/amfd/main.cc
@@ -707,7 +707,8 @@ static void main_loop(void) {
avd_d2n_msg_dequeue(cb);
  }
  
-if (cb->immOiHandle && fds[FD_IMM].revents & POLLIN) {

+if (cb->avd_imm_status == AVD_IMM_INIT_DONE &&
+cb->immOiHandle && fds[FD_IMM].revents & POLLIN) {
TRACE("IMM event rec");
error = saImmOiDispatch(cb->immOiHandle, SA_DISPATCH_ALL);
  



--
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] imm: prioritize to elect IMMND on the active node [#2862]

2018-06-25 Thread Hans Nordeback

Hi Vu,

ack, review only. (The indentation is still not correct). /Thanks HansN


On 06/20/2018 08:28 AM, Vu Minh Nguyen wrote:

The coordinator IMMND on PL-3 was crashed, the active IMMD then elected the new
coordinator on the standby node, SC-2, but failed because IMMND on the SC-2 was
restarted also. As the result, the active IMMD exited and failure-over
happened. After that, SC-2 took active role and found no candidate for new IMMND
coordinator, so cluster was rebooted.

We can prevent this happen if the active IMMD prioritizes to elect the
coordinator which is located on the same site with himself if the IMMND database
is up-to-date.
---
  src/imm/immd/immd_proc.c | 16 +---
  1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/imm/immd/immd_proc.c b/src/imm/immd/immd_proc.c
index 1882eef..34c1415 100644
--- a/src/imm/immd/immd_proc.c
+++ b/src/imm/immd/immd_proc.c
@@ -331,24 +331,34 @@ bool immd_proc_elect_coord(IMMD_CB *cb, bool new_active)
 */
} else {
/* Try to elect a new coord. */
+   IMMD_IMMND_INFO_NODE *candidate_coord_node = NULL;
cb->payload_coord_dest = 0LL;
memset(, 0, sizeof(MDS_DEST));
immd_immnd_info_node_getnext(>immnd_tree, ,
 _info_node);
+
+   // Election priority:
+   // 1) Coordinator on active node
+   // 2) Coordinator on standby node
+   // 3) Coordinator on PL node if SC absence is allowed.
while (immnd_info_node) {
key = immnd_info_node->immnd_dest;
if ((immnd_info_node->isOnController) &&
(immnd_info_node->epoch == cb->mRulingEpoch)) {
-   /*We found a new candidate for cordinator */
+   candidate_coord_node = immnd_info_node;
immnd_info_node->isCoord = true;
-   break;
+   if (immnd_info_node->immnd_key == cb->node_id) {
+   /* Found a new candidate on active SC */
+   break;
+   }
}
  
  			immd_immnd_info_node_getnext(>immnd_tree, ,

 _info_node);
}
  
-		if (!immnd_info_node && cb->mScAbsenceAllowed) {

+   immnd_info_node = candidate_coord_node;
+if (!immnd_info_node && cb->mScAbsenceAllowed) {
/* If SC absence is allowed and no SC based IMMND is
   available then elect an IMMND coord at a payload.
   Note this means that an IMMND at a payload may be



--
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] base: Support thread trace buffer [#456]

2018-06-19 Thread Hans Nordeback

Hi Minh,

ack, review only. Some comments below marked with [HansN]. (Perhaps 
TraceLogBuffer and TraceLogClient are better names?)


/Thanks HansN


On 06/11/2018 11:16 PM, Minh Chau wrote:

This ticket support the tracing buffer per thread. If enabled,
each thread has it own buffer which the trace is written to.
The thread trace buffers will be flushed to file if an abnormal
end hits, i.e. LOG_ER is called.
The thread trace file format: "daemon_name"_"proc_id"_"thread_id"
is stored under /var/log/opensaf/. These file can be correlated
in timing order by a "sort" command or could be by another saflog
command.
Main changes in this ticket
. Rename LogTrace class to LogTraceClient
. Move Log_Writer from dtm to base
. Add LogTraceBuffer class, this class hold the trace buffer
. Add thread_local instace of LogTraceBuffer, so that the instance
   of LogTraceBuffer will be created/deleted whenever a new thread
   is created or destroyed.
. Add an instance of LogTraceClient for thread trace buffering.
---
  src/amf/amfd/amfd.conf |   5 ++
  src/base/Makefile.am   |   4 +
  src/base/daemon.c  |   3 +
  src/base/log_writer.cc | 135 +
  src/base/log_writer.h  |  65 ++
  src/base/logtrace.cc   |  77 +---
  src/base/logtrace.h|   6 ++
  src/base/logtrace_buffer.cc|  87 +++
  src/base/logtrace_buffer.h |  52 +++
  src/base/logtrace_client.cc|  91 ++-
  src/base/logtrace_client.h |  50 ---
  src/dtm/Makefile.am|   3 -
  src/dtm/transport/log_server.h |   2 +-
  src/dtm/transport/log_writer.cc| 117 -
  src/dtm/transport/log_writer.h |  64 --
  src/dtm/transport/tests/log_writer_test.cc |   2 +-
  src/mds/mds_log.cc |  18 ++--
  17 files changed, 537 insertions(+), 244 deletions(-)
  create mode 100644 src/base/log_writer.cc
  create mode 100644 src/base/log_writer.h
  create mode 100644 src/base/logtrace_buffer.cc
  create mode 100644 src/base/logtrace_buffer.h
  delete mode 100644 src/dtm/transport/log_writer.cc
  delete mode 100644 src/dtm/transport/log_writer.h

diff --git a/src/amf/amfd/amfd.conf b/src/amf/amfd/amfd.conf
index 9da3bec..5e20650 100644
--- a/src/amf/amfd/amfd.conf
+++ b/src/amf/amfd/amfd.conf
@@ -24,3 +24,8 @@ export AVSV_HB_PERIOD=100
  # All logging will be recorded in a new node local log file 
$PKGLOGDIR/osaf.log.
  # Uncomment the next line to enable this service to log to OpenSAF node local 
log file.
  # export OSAF_LOCAL_NODE_LOG=1
+
+# THREAD_TRACE_BUFFER variable enables the tracing, writes the trace
+# to thread based buffer in circular fashion. The trace buffers will
+# be flushed to file if an abnormal end hits, i.e. LOG_ER is called
+export THREAD_TRACE_BUFFER=1
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index 65f9219..a6c3178 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -51,6 +51,8 @@ lib_libopensaf_core_la_SOURCES += \
src/base/log_message.cc \
src/base/logtrace.cc \
src/base/logtrace_client.cc \
+   src/base/logtrace_buffer.cc \
+   src/base/log_writer.cc \
src/base/mutex.cc \
src/base/ncs_main_pub.c \
src/base/ncs_sprr.c \
@@ -101,6 +103,8 @@ noinst_HEADERS += \
src/base/log_message.h \
src/base/logtrace.h \
src/base/logtrace_client.h \
+   src/base/logtrace_buffer.h \
+   src/base/log_writer.h \
src/base/macros.h \
src/base/mutex.h \
src/base/ncs_edu.h \
diff --git a/src/base/daemon.c b/src/base/daemon.c
index 361dd8d..ad052bf 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -549,6 +549,9 @@ void daemon_exit(void)
unlink(fifo_file);
unlink(__pidfile);
  
+	/* flush the logtrace */

+   logtrace_exit_daemon();
+
_Exit(0);
  }
  
diff --git a/src/base/log_writer.cc b/src/base/log_writer.cc

new file mode 100644
index 000..eb079d6
--- /dev/null
+++ b/src/base/log_writer.cc
@@ -0,0 +1,135 @@
+/*  -*- 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
+ * or FITNESS FOR A PARTICULAR PURPOSE. This file and program are licensed
+ * under the GNU Lesser General Public License Version 2.1, February 1999.
+ * The complete license can be accessed from the following location:
+ * http://opensource.org/licenses/lgpl-license.php
+ * See the Copying file included with the OpenSAF distribution for full
+ * licensing terms.
+ *
+ * Author(s): Ericsson AB
+ *
+ */

Re: [devel] [PATCH 1/1] imm: fix failure to import file containing existing long dn object [#2874]

2018-06-18 Thread Hans Nordeback

Hi Vu,

ack, code review only. Some comments, function createImmObject looks as 
a candidate for refactoring and struct ParserState


perhaps can use std::string instead of char* for objectName?

/Thanks HansN

On 06/11/2018 11:50 AM, Vu Minh Nguyen wrote:

We copied the original object name `state->objectName` using the function
osaf_extended_name_lend(state->objectName, ).

In case of long dn object, objectName contained a reference to the string
which was stored in `state->objectName`, any change to `state->objectName`,
in this case it was the code line `state->objectName[DNlen] = '\0',
would impact the backup `objectName`.

As the `objectName` had been changed unintentionally to non-existing object dn,
`saImmOmAccessorGet_2` returned `SA_AIS_ERR_NOT_EXIST` unexpectedly.

To fix this bug, using C++ string to save a copy of the original object
`state->objectName` string. Do so, the string value is not changed when
we play with `state->objectName`.
---
  src/imm/tools/imm_import.cc | 8 +---
  1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/imm/tools/imm_import.cc b/src/imm/tools/imm_import.cc
index 5397c67..d4f7c08 100644
--- a/src/imm/tools/imm_import.cc
+++ b/src/imm/tools/imm_import.cc
@@ -633,7 +633,7 @@ static void createImmObject(ParserState *state) {
SaAisErrorT errorCode = SA_AIS_OK;
int i = 0;
size_t DNlen;
-  SaNameT objectName;
+  std::string objectName;
std::list::iterator it;
  
TRACE_8("CREATE IMM OBJECT %s, %s", state->objectClass, state->objectName);

@@ -647,7 +647,7 @@ static void createImmObject(ParserState *state) {
osaf_extended_name_clear();
if (state->objectName != NULL) {
  char *parent;
-osaf_extended_name_lend(state->objectName, );
+objectName = std::string{state->objectName};
  
  /* ',' is the delimeter */

  /* but '\' is the escape character, used for association objects */
@@ -746,6 +746,7 @@ static void createImmObject(ParserState *state) {
SaImmAttrValuesT_2 **existing_attributes;
SaImmAttrValuesT_2 *attr;
const char *existing_className;
+  SaNameT dn;
  
LOG_IN("OBJECT %s already exist, verifying...", state->objectName);
  
@@ -759,7 +760,8 @@ static void createImmObject(ParserState *state) {

  goto done;
}
  
-  errorCode = immutil_saImmOmAccessorGet_2(accessorHandle, ,

+  osaf_extended_name_lend(objectName.c_str(), );
+  errorCode = immutil_saImmOmAccessorGet_2(accessorHandle, ,
 NULL,  // get all attributes
 _attributes);
if (SA_AIS_OK != errorCode) {



--
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] imm: prioritize to elect IMMND on the active node [#2862]

2018-06-15 Thread Hans Nordeback

Hi Vu, the formatting of the code was not so good, a new attempt below:

} else {
      /* Try to elect a new coord. */
      IMMD_IMMND_INFO_NODE *candidate_coord_node = 0;
      cb->payload_coord_dest = 0LL;
      memset(, 0, sizeof(MDS_DEST));
      immd_immnd_info_node_getnext(>immnd_tree, ,
                   _info_node);

      // Prioritize to elect the new coordinator which is
      // located at the active node (same site with the active IMMD).
      while (immnd_info_node) {
          key = immnd_info_node->immnd_dest;
          if ((immnd_info_node->isOnController) &&
          (immnd_info_node->epoch == cb->mRulingEpoch)) {
              if (immnd_info_node->immnd_key == cb->node_id) {
                  /*We found a new candidate for cordinator */
                  candidate_coord_node = immnd_info_node;
                  break;
              } else {
                  candidate_coord_node = immnd_info_node;
              }
          }

          immd_immnd_info_node_getnext(>immnd_tree, ,
                       _info_node);
      }
      immnd_info_node = candidate_coord_node;
      if (immnd_info_node != 0)
          immnd_info_node->isCoord = true;

/Thanks HansN
On 06/15/2018 03:43 PM, Hans Nordeback wrote:


Hi Vu,

a few comments,

- the indentation is not correct after the first while stmt.

- why adding a new similar while loop? Instead remove the newly added 
while loop


and change the first while loop to something like this (not tested 
though):



} else{
/* Try to elect a new coord. */
IMMD_IMMND_INFO_NODE *candidate_coord_node =0;
cb->payload_coord_dest=0LL;
memset(, 0, sizeof(MDS_DEST));
immd_immnd_info_node_getnext(>immnd_tree, ,
_info_node);
// Prioritize to elect the new coordinator which is
// located at the active node (same site with the active IMMD).
while(immnd_info_node) {
key =immnd_info_node->immnd_dest;
if((immnd_info_node->isOnController) &&
 (immnd_info_node->epoch==cb->mRulingEpoch)) {
if(immnd_info_node->immnd_key==cb->node_id) {
/*We found a new candidate for cordinator */
candidate_coord_node =immnd_info_node;
break;
} else{
candidate_coord_node =immnd_info_node;
}
}
immd_immnd_info_node_getnext(>immnd_tree, ,
_info_node);
}
immnd_info_node =candidate_coord_node;
if(immnd_info_node !=0)
immnd_info_node->isCoord=true;


/Thanks HansN


On 05/22/2018 10:59 AM, Vu Minh Nguyen wrote:

Here is the case:
The coordinator IMMND on PL-3 was crashed, the active IMMD then elected the new
coordinator on the standby node SC-2 but failed because IMMND on the SC-2 was
also restarted. As the result, the active IMMD exited and failure-over
happened. After that, SC-2 took active role and found no candidate for new IMMND
coordinator, so cluster was reboot.

We can prevent this happen if the active IMMD prioritizes to elect the
coordinator which is located on the same site with himself if the IMMND database
is up-to-date.
---
  src/imm/immd/immd_proc.c | 27 ++-
  1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/imm/immd/immd_proc.c b/src/imm/immd/immd_proc.c
index 1882eef..e80f2db 100644
--- a/src/imm/immd/immd_proc.c
+++ b/src/imm/immd/immd_proc.c
@@ -331,16 +331,22 @@ bool immd_proc_elect_coord(IMMD_CB *cb, bool new_active)
 */
} else {
/* Try to elect a new coord. */
+   bool has_coord_candidate = false;
cb->payload_coord_dest = 0LL;
memset(, 0, sizeof(MDS_DEST));
immd_immnd_info_node_getnext(>immnd_tree, ,
 _info_node);
+
+   // Prioritize to elect the new coordinator which is
+   // located at the active node (same site with the active IMMD).
while (immnd_info_node) {
key = immnd_info_node->immnd_dest;
if ((immnd_info_node->isOnController) &&
+   (immnd_info_node->immnd_key == cb->node_id) &&
(immnd_info_node->epoch == cb->mRulingEpoch)) {
/*We found a new candidate for cordinator */
immnd_info_node->isCoord = true;
+   has_coord_candidate = true;
break;
}
  
@@ -348,7 +354,26 @@ bool immd_proc_elect_coord(IMMD_CB *cb, bool new_active)

 _info_node);
}
  
-		if (!immnd_info_node && cb->mScAbsenceAllowed) {

+if (!has_coord_candidate) {
+  memset(, 0, sizeof(MDS_DEST));
+  immd_immnd_info_no

Re: [devel] [PATCH 1/1] imm: prioritize to elect IMMND on the active node [#2862]

2018-06-15 Thread Hans Nordeback

Hi Vu,

a few comments,

- the indentation is not correct after the first while stmt.

- why adding a new similar while loop? Instead remove the newly added 
while loop


and change the first while loop to something like this (not tested though):


} else{
/* Try to elect a new coord. */
IMMD_IMMND_INFO_NODE *candidate_coord_node =0;
cb->payload_coord_dest=0LL;
memset(, 0, sizeof(MDS_DEST));
immd_immnd_info_node_getnext(>immnd_tree, ,
_info_node);
// Prioritize to elect the new coordinator which is
// located at the active node (same site with the active IMMD).
while(immnd_info_node) {
key =immnd_info_node->immnd_dest;
if((immnd_info_node->isOnController) &&
 (immnd_info_node->epoch==cb->mRulingEpoch)) {
if(immnd_info_node->immnd_key==cb->node_id) {
/*We found a new candidate for cordinator */
candidate_coord_node =immnd_info_node;
break;
} else{
candidate_coord_node =immnd_info_node;
}
}
immd_immnd_info_node_getnext(>immnd_tree, ,
_info_node);
}
immnd_info_node =candidate_coord_node;
if(immnd_info_node !=0)
immnd_info_node->isCoord=true;


/Thanks HansN


On 05/22/2018 10:59 AM, Vu Minh Nguyen wrote:

Here is the case:
The coordinator IMMND on PL-3 was crashed, the active IMMD then elected the new
coordinator on the standby node SC-2 but failed because IMMND on the SC-2 was
also restarted. As the result, the active IMMD exited and failure-over
happened. After that, SC-2 took active role and found no candidate for new IMMND
coordinator, so cluster was reboot.

We can prevent this happen if the active IMMD prioritizes to elect the
coordinator which is located on the same site with himself if the IMMND database
is up-to-date.
---
  src/imm/immd/immd_proc.c | 27 ++-
  1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/imm/immd/immd_proc.c b/src/imm/immd/immd_proc.c
index 1882eef..e80f2db 100644
--- a/src/imm/immd/immd_proc.c
+++ b/src/imm/immd/immd_proc.c
@@ -331,16 +331,22 @@ bool immd_proc_elect_coord(IMMD_CB *cb, bool new_active)
 */
} else {
/* Try to elect a new coord. */
+   bool has_coord_candidate = false;
cb->payload_coord_dest = 0LL;
memset(, 0, sizeof(MDS_DEST));
immd_immnd_info_node_getnext(>immnd_tree, ,
 _info_node);
+
+   // Prioritize to elect the new coordinator which is
+   // located at the active node (same site with the active IMMD).
while (immnd_info_node) {
key = immnd_info_node->immnd_dest;
if ((immnd_info_node->isOnController) &&
+   (immnd_info_node->immnd_key == cb->node_id) &&
(immnd_info_node->epoch == cb->mRulingEpoch)) {
/*We found a new candidate for cordinator */
immnd_info_node->isCoord = true;
+   has_coord_candidate = true;
break;
}
  
@@ -348,7 +354,26 @@ bool immd_proc_elect_coord(IMMD_CB *cb, bool new_active)

 _info_node);
}
  
-		if (!immnd_info_node && cb->mScAbsenceAllowed) {

+if (!has_coord_candidate) {
+  memset(, 0, sizeof(MDS_DEST));
+  immd_immnd_info_node_getnext(>immnd_tree, ,
+   _info_node);
+
+  while (immnd_info_node) {
+key = immnd_info_node->immnd_dest;
+if ((immnd_info_node->isOnController) &&
+(immnd_info_node->epoch == cb->mRulingEpoch)) {
+  /*We found a new candidate for cordinator */
+  immnd_info_node->isCoord = true;
+  break;
+}
+
+immd_immnd_info_node_getnext(>immnd_tree, ,
+ _info_node);
+  }
+}
+
+if (!immnd_info_node && cb->mScAbsenceAllowed) {
/* If SC absence is allowed and no SC based IMMND is
   available then elect an IMMND coord at a payload.
   Note this means that an IMMND at a payload may be


--
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] ckpt: update return code in LOG_ER printout [#2864]

2018-06-11 Thread Hans Nordeback

Hi Canh,

ack, code review only. /Thanks HansN


On 05/30/2018 11:01 AM, Canh Van Truong wrote:

---
  src/ckpt/apitest/test_cpa_util.c | 30 +++---
  src/ckpt/ckptd/cpd_proc.c| 18 +++---
  2 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/src/ckpt/apitest/test_cpa_util.c b/src/ckpt/apitest/test_cpa_util.c
index 9b765bbb7..bc52ff950 100644
--- a/src/ckpt/apitest/test_cpa_util.c
+++ b/src/ckpt/apitest/test_cpa_util.c
@@ -8,7 +8,6 @@
  
  #if FULL_LOG

  #define m_TEST_CPSV_PRINTF printf
-extern const char *saf_error_string[];
  #else
  #define m_TEST_CPSV_PRINTF(...)
  #endif
@@ -21,6 +20,7 @@ extern const char *saf_error_string[];
gl_try_again_cnt = 0;  \
tmoutFlag = 0
  
+extern const char *saf_error_string[];

  int gl_try_again_cnt;
  int gl_tmout_cnt;
  int gl_sync_pointnum;
@@ -34,15 +34,13 @@ int cpsv_test_result(SaAisErrorT rc, SaAisErrorT exp_out, 
char *test_case,
if (rc == SA_AIS_ERR_TRY_AGAIN) {
result = TEST_FAIL;
if (gl_try_again_cnt++ == 0) {
-   m_TEST_CPSV_PRINTF("\n FAILED  : %s\n",
-  test_case);
-   m_TEST_CPSV_PRINTF(" Return Value: %s\n\n",
+   printf("\n FAILED  : %s\n", test_case);
+   printf(" Return Value: %s\n\n",
   saf_error_string[rc]);
}
  
  		if (!(gl_try_again_cnt % 10))

-   m_TEST_CPSV_PRINTF(" Try again count : %d \n",
-  gl_try_again_cnt);
+   printf(" Try again count : %d \n", gl_try_again_cnt);
  
  		usleep(50); /* 500 ms */

return (result);
@@ -51,21 +49,20 @@ int cpsv_test_result(SaAisErrorT rc, SaAisErrorT exp_out, 
char *test_case,
if (rc == SA_AIS_ERR_TIMEOUT) {
result = TEST_FAIL;
if (gl_tmout_cnt++ == 0) {
-   m_TEST_CPSV_PRINTF("\n FAILED  : %s\n",
-  test_case);
-   m_TEST_CPSV_PRINTF(" Return Value: %s\n\n",
+   printf("\n FAILED  : %s\n", test_case);
+   printf(" Return Value: %s\n\n",
   saf_error_string[rc]);
}
  
  		if (gl_try_again_cnt > 0) {

-   m_TEST_CPSV_PRINTF(
+   printf(
"\n TIMEOUT AFTER TRY_AGAIN POSSIBLE ERROR  : %s\n",
test_case);
tmoutFlag = 1;
}
  
  		if (gl_tmout_cnt == 10) {

-   m_TEST_CPSV_PRINTF(" Timeout count : %d \n",
+   printf(" Timeout count : %d \n",
   gl_tmout_cnt);
tmoutFlag = 1;
}
@@ -75,28 +72,31 @@ int cpsv_test_result(SaAisErrorT rc, SaAisErrorT exp_out, 
char *test_case,
}
  
  	if (gl_try_again_cnt) {

-   m_TEST_CPSV_PRINTF(" Try again count : %d \n",
+   printf(" Try again count : %d \n",
   gl_try_again_cnt);
gl_try_again_cnt = 0;
}
  
  	if (gl_tmout_cnt) {

-   m_TEST_CPSV_PRINTF(" Timeout count : %d \n", gl_tmout_cnt);
+   printf(" Timeout count : %d \n", gl_tmout_cnt);
gl_tmout_cnt = 0;
tmoutFlag = 0;
}
  
  	if (rc == exp_out) {

m_TEST_CPSV_PRINTF("\n SUCCESS   : %s  \n", test_case);
+   m_TEST_CPSV_PRINTF(" Return Value  : %s\n",
+  saf_error_string[rc]);
result = TEST_PASS;
} else {
-   m_TEST_CPSV_PRINTF("\n FAILED: %s  \n", test_case);
+   printf("\n FAILED: %s  \n", test_case);
+   printf(" Test Cfg Mode : %d\n", flg);
+   printf(" Return Value  : %s\n", saf_error_string[rc]);
result = TEST_FAIL;
if (flg == TEST_CONFIG_MODE)
result = TEST_UNRESOLVED;
}
  
-	m_TEST_CPSV_PRINTF(" Return Value  : %s\n", saf_error_string[rc]);

return (result);
  }
  
diff --git a/src/ckpt/ckptd/cpd_proc.c b/src/ckpt/ckptd/cpd_proc.c

index 187a171f8..26614ba23 100644
--- a/src/ckpt/ckptd/cpd_proc.c
+++ b/src/ckpt/ckptd/cpd_proc.c
@@ -189,10 +189,13 @@ uint32_t cpd_ckpt_db_entry_update(CPD_CB *cb, MDS_DEST 
*cpnd_dest,
  
  	/*   Processing for the Node name , with CLM  */
  
-	if (saClmClusterNodeGet(cb->clm_hdl, node_id, CPD_CLM_API_TIMEOUT,

-   _node) != SA_AIS_OK) {
+   SaAisErrorT rc = saClmClusterNodeGet(cb->clm_hdl, node_id,
+

Re: [devel] [PATCH 1/1] mds: release mds lock if mds_mdtm_init failed [#2873]

2018-06-10 Thread Hans Nordeback

ack, code review only. /Thanks HansN


On 06/11/2018 06:40 AM, Phat Do wrote:

If a process failed to mds_mdtm_init(), then it exits and holds the mds lock 
forever.
Any upcoming MDS init process got stuck at required lock.

This patch will clean up and release mds lock if mds_mdtm_init failed.
---
  src/mds/mds_main.c | 5 +
  1 file changed, 5 insertions(+)

diff --git a/src/mds/mds_main.c b/src/mds/mds_main.c
index 7f47178..8c9b1f1 100644
--- a/src/mds/mds_main.c
+++ b/src/mds/mds_main.c
@@ -575,6 +575,11 @@ uint32_t mds_lib_req(NCS_LIB_REQ_INFO *req)
status = mds_mdtm_init(node_id, _tipc_ref);
if (status != NCSCC_RC_SUCCESS) {
/*  todo cleanup */
+   syslog(
+   LOG_ERR,
+   "MDS:LIB_CREATE: mds_mdtm_init failed\n");
+   mds_mcm_destroy();
+   osaf_mutex_unlock_ordie(_mds_library_mutex);
return NCSCC_RC_FAILURE;
}
gl_mds_mcm_cb->adest =



--
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] base: ensure _file is always initialised [#2872]

2018-06-08 Thread Hans Nordeback

ack, review only/Thanks HansN


On 06/08/2018 05:12 AM, Gary Lee wrote:

If trace is enabled after the last TRACE() statement is run, but
*before* ~Trace() is called, then _file is left as nullptr when
logtrace_output() is called in ~Trace(). This will segfault.
---
  src/base/logtrace.h | 10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/base/logtrace.h b/src/base/logtrace.h
index 9b20da82d..69379766e 100644
--- a/src/base/logtrace.h
+++ b/src/base/logtrace.h
@@ -175,7 +175,11 @@ extern void log_output(const char *file, unsigned line, 
unsigned priority,
  
  class Trace {

   public:
-  Trace() {}
+  Trace() = delete;
+  Trace(const char *file, const char *function) {
+file_ = file;
+function_ = function;
+  }
~Trace() {
  if (!trace_leave_called && is_logtrace_enabled(CAT_TRACE_LEAVE)) {
va_list ap{};
@@ -212,11 +216,11 @@ class Trace {
  };
  
  #define TRACE_ENTER()\

-  Trace t_;  \
+  Trace t_(__FILE__, __FUNCTION__); \
t_.trace(__FILE__, __FUNCTION__, __LINE__, CAT_TRACE_ENTER, "%s ", \
 __FUNCTION__)
  #define TRACE_ENTER2(format, args...)\
-  Trace t_;  \
+  Trace t_(__FILE__, __FUNCTION__); \
t_.trace(__FILE__, __FUNCTION__, __LINE__, CAT_TRACE_ENTER, "%s: " format, \
 __FUNCTION__, ##args)
  



--
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] base: Improve backtrace print in daemon.c [#2853]

2018-06-08 Thread Hans Nordeback

Hi Anders,


yes these functions are not "async signal safe", but if we do encounter 
functions "hangs", we can add an alarm,


so a core dump can be produced anyway.


/Thanks HansN


On 06/07/2018 09:38 AM, Anders Widell wrote:


Hi!


Could you check if there is some alternative way that doesn't use 
system(), syslog() and fgets() from within the signal handler?



regards,

Anders Widell


*Från:* Ravi Sekhar Reddy Konda 
*Skickat:* den 30 maj 2018 08:10:56
*Till:* Hans Nordebäck; Anders Widell; Gary Lee
*Kopia:* opensaf-devel@lists.sourceforge.net
*Ämne:* RE: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853]
Hi Hans,

Ack, code review only

Regards,
Ravi

-Original Message-
From: Hans Nordeback [mailto:hans.nordeb...@ericsson.com]
Sent: Wednesday, May 16, 2018 12:54 PM
To: anders.wid...@ericsson.com; Ravi Sekhar Reddy Konda 
; gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net; Hans Nordeback 


Subject: [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853]

---
 src/base/daemon.c   | 52 ++---
 tools/cluster_sim_uml/build_uml |  1 +
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c index 
361dd8dd6..2ad0dcd2d 100644

--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -608,14 +608,18 @@ static void fatal_signal_handler(int sig, 
siginfo_t *siginfo, void *ctx)

 const int BT_ARRAY_SIZE = 20;
 void *bt_array[BT_ARRAY_SIZE];
 size_t bt_size;
-   int fd;
 char bt_header[40];
+   char cmd_buf[200];
+   char addr2line_buf[120];
+   Dl_info dl_info;
+   FILE *fp;

-   if ((fd = open(bt_filename, O_RDWR | O_CREAT, 0644)) < 0) {
+   int fd = open(bt_filename, O_RDWR | O_CREAT, 0644);
+
+   if (fd < 0)
 goto done;
-   }

-   snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u 
uid: %u\n",

+   snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid:
+%u\n\n",
  sig, siginfo->si_pid, siginfo->si_uid);

 if (write(fd, bt_header, strlen(bt_header)) < 0) { @@ -624,6 
+628,45 @@ static void fatal_signal_handler(int sig, siginfo_t 
*siginfo, void *ctx)

 }

 bt_size = plibc_backtrace(bt_array, BT_ARRAY_SIZE);
+
+   if (system("which addr2line") == 0) {
+   for (int i = 0; i < bt_size; ++i) {
+   memset(_info, 0, sizeof(dl_info));
+   dladdr(bt_array[i], _info);
+   ptrdiff_t offset = bt_array[i] - 
dl_info.dli_fbase;

+
+   snprintf(cmd_buf, sizeof(cmd_buf),
+    "addr2line %tx -p -f -e %s",
+    offset, dl_info.dli_fname);
+
+   fp = popen(cmd_buf, "r");
+   if (fp == NULL) {
+   syslog(LOG_ERR,
+  "popen failed: %s", 
strerror(errno));

+   } else {
+   if (fgets(addr2line_buf,
+ sizeof(addr2line_buf),
+ fp) != NULL) {
+   snprintf(cmd_buf, sizeof(cmd_buf),
+    "# %d %s",
+    i, addr2line_buf);
+   if (write(fd, cmd_buf,
+ strlen(cmd_buf)) < 0) {
+ syslog(LOG_ERR,
+ "write failed: %s",
+ strerror(errno));
+   }
+   }
+   pclose(fp);
+   }
+   }
+   }
+
+   if (write(fd, "\n", 1) < 0) {
+   syslog(LOG_ERR,
+  "write failed: %s", strerror(errno));
+   }
+
 plibc_backtrace_symbols_fd(bt_array, bt_size, fd);

 close(fd);
@@ -677,6 +720,7 @@ static void install_fatal_signal_handlers(void)
  time_string, getpid());

 struct sigaction action;
+
 memset(, 0, sizeof(action));
 action.sa_sigaction = fatal_signal_handler;
 sigfillset(_mask);
diff --git a/tools/cluster_sim_uml/build_uml 
b/tools/cluster_sim_uml/build_uml index b9f224360..16d49d03e 100755

--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -176,6 +176,7 @@ cmd_create_rootfs()
 test -e /usr/bin/lsof && install /usr/bin/lsof usr/bin
 test -e /bin/pidof && install /bin/pidof usr/bin
 test -e /usr/sbin/tcpdump && install /usr/sbin/tcpdump usr/sbin
+    test -e /usr/bin/add

Re: [devel] [PATCH 1/1] mds: return success at failure in case of using broadcast send type [#2866]

2018-05-29 Thread Hans Nordeback

Hi Vu,

it is not dead code as it is executed and "aborts" the broadcast, which 
is the bug here.


But the check may be removed as it is already seems done above, I prefer 
to remove this in


a separate refactoring ticket though.

/BR HansN


On 05/29/2018 08:13 AM, Vu Minh Nguyen wrote:

Hi Hans,

Ack with one question, started with [Vu]. Thanks!

Regards, Vu


-Original Message-----
From: Hans Nordeback 
Sent: Monday, May 28, 2018 6:18 PM
To: vu.m.ngu...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net; Hans Nordeback

Subject: [PATCH 1/1] mds: return success at failure in case of using

broadcast

send type [#2866]

---
  src/mds/apitest/mdstipc.h |   2 +
  src/mds/apitest/mdstipc_api.c | 130
++
  src/mds/mds_dt_tipc.c |   2 +-
  3 files changed, 133 insertions(+), 1 deletion(-)

diff --git a/src/mds/apitest/mdstipc.h b/src/mds/apitest/mdstipc.h
index 01b58c405..07cf55696 100644
--- a/src/mds/apitest/mdstipc.h
+++ b/src/mds/apitest/mdstipc.h
@@ -361,6 +361,8 @@ void tet_broadcast_to_svc_tp_3(void);
  void tet_broadcast_to_svc_tp_4(void);
  void tet_broadcast_to_svc_tp_5(void);
  void tet_broadcast_to_svc_tp_6(void);
+void tet_broadcast_to_svc_tp_7(void);
+void tet_broadcast_to_svc_tp_8(void);
  void tet_direct_just_send_tp_1(void);
  void tet_direct_just_send_tp_2(void);
  void tet_direct_just_send_tp_3(void);
diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
index de166d11d..e320e094e 100644
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -7479,6 +7479,130 @@ void tet_broadcast_to_svc_tp_6()
test_validate(FAIL, 0);
  }

+void tet_broadcast_to_svc_tp_7()
+{
+   int FAIL = 0;
+   MDS_SVC_ID svcids[] = {NCSMDS_SVC_ID_EXTERNAL_MIN};
+
+   // Test broadcast of large message
+   char tmp[65220] = " Hi All ";
+   TET_MDS_MSG *mesg;
+   mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
+   memset(mesg, 0, sizeof(TET_MDS_MSG));
+   memcpy(mesg->send_data, tmp, sizeof(tmp));
+   mesg->send_len = sizeof(tmp);
+
+   /*Start up*/
+   if (tet_initialise_setup(false)) {
+   printf("\nSetup Initialisation has Failed \n");
+   FAIL = 1;
+   } else {
+

/**/

+   printf(
+   "\nCase 1: Svc INTMIN on VDEST=200 Broadcasting a LOW
Priority message to Svc EXTMIN\n");
+   if (mds_service_subscribe(gl_tet_vdest[1].mds_pwe1_hdl,
+ NCSMDS_SVC_ID_INTERNAL_MIN,
+ NCSMDS_SCOPE_NONE, 1,
+ svcids) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   if (mds_service_retrieve(gl_tet_vdest[1].mds_pwe1_hdl,
+NCSMDS_SVC_ID_INTERNAL_MIN,
+SA_DISPATCH_ALL) !=
NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   if (mds_broadcast_to_svc(
+   gl_tet_vdest[1].mds_pwe1_hdl,
+   NCSMDS_SVC_ID_INTERNAL_MIN,
NCSMDS_SVC_ID_EXTERNAL_MIN,
+   NCSMDS_SCOPE_NONE, MDS_SEND_PRIORITY_LOW,
+   mesg) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   } else
+   printf("\nSuccess\n");
+   if (mds_service_cancel_subscription(
+   gl_tet_vdest[1].mds_pwe1_hdl,
+   NCSMDS_SVC_ID_INTERNAL_MIN, 1,
+   svcids) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   }
+

/*-*/

+   /*clean up*/
+   if (tet_cleanup_setup()) {
+   printf("\nSetup Clean Up has Failed \n");
+   FAIL = 1;
+   }
+
+   free(mesg);
+   test_validate(FAIL, 0);
+}
+
+void tet_broadcast_to_svc_tp_8()
+{
+   int FAIL = 0;
+   MDS_SVC_ID svcids[] = {NCSMDS_SVC_ID_EXTERNAL_MIN};
+
+   // Test broadcast of large message
+   char tmp[66000] = " Hi All ";
+   TET_MDS_MSG *mesg;
+   mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
+   memset(mesg, 0, sizeof(TET_MDS_MSG));
+   memcpy(mesg->send_data, tmp, sizeof(tmp));
+   mesg->send_len = sizeof(tmp);
+
+   /*Start up*/
+   if (tet_initialise_setup(false)) {
+   printf("\nSetup Initialisation has Failed \n");
+   FAIL = 1;
+   } else {
+

/*--

[devel] [PATCH 0/1] Review Request for mds: return success at failure in case of using broadcast send type [#2866]

2018-05-28 Thread Hans Nordeback
Summary: mds: return success at failure in case of using broadcast send type 
[#2866]
Review request for Ticket(s): 2866
Peer Reviewer(s): Vu
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2866
Base revision: e0bcf786e0b3417d31b767073bb789ef150eb2ad
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision 45b986c5f3dc6a7ead53f3f4e913a19ca4b303c5
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 28 May 2018 13:06:26 +0200

mds: return success at failure in case of using broadcast send type [#2866]



Complete diffstat:
--
 src/mds/apitest/mdstipc.h |   2 +
 src/mds/apitest/mdstipc_api.c | 130 ++
 src/mds/mds_dt_tipc.c |   2 +-
 3 files changed, 133 insertions(+), 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] mds: return success at failure in case of using broadcast send type [#2866]

2018-05-28 Thread Hans Nordeback
---
 src/mds/apitest/mdstipc.h |   2 +
 src/mds/apitest/mdstipc_api.c | 130 ++
 src/mds/mds_dt_tipc.c |   2 +-
 3 files changed, 133 insertions(+), 1 deletion(-)

diff --git a/src/mds/apitest/mdstipc.h b/src/mds/apitest/mdstipc.h
index 01b58c405..07cf55696 100644
--- a/src/mds/apitest/mdstipc.h
+++ b/src/mds/apitest/mdstipc.h
@@ -361,6 +361,8 @@ void tet_broadcast_to_svc_tp_3(void);
 void tet_broadcast_to_svc_tp_4(void);
 void tet_broadcast_to_svc_tp_5(void);
 void tet_broadcast_to_svc_tp_6(void);
+void tet_broadcast_to_svc_tp_7(void);
+void tet_broadcast_to_svc_tp_8(void);
 void tet_direct_just_send_tp_1(void);
 void tet_direct_just_send_tp_2(void);
 void tet_direct_just_send_tp_3(void);
diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
index de166d11d..e320e094e 100644
--- a/src/mds/apitest/mdstipc_api.c
+++ b/src/mds/apitest/mdstipc_api.c
@@ -7479,6 +7479,130 @@ void tet_broadcast_to_svc_tp_6()
test_validate(FAIL, 0);
 }
 
+void tet_broadcast_to_svc_tp_7()
+{
+   int FAIL = 0;
+   MDS_SVC_ID svcids[] = {NCSMDS_SVC_ID_EXTERNAL_MIN};
+
+   // Test broadcast of large message
+   char tmp[65220] = " Hi All ";
+   TET_MDS_MSG *mesg;
+   mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
+   memset(mesg, 0, sizeof(TET_MDS_MSG));
+   memcpy(mesg->send_data, tmp, sizeof(tmp));
+   mesg->send_len = sizeof(tmp);
+
+   /*Start up*/
+   if (tet_initialise_setup(false)) {
+   printf("\nSetup Initialisation has Failed \n");
+   FAIL = 1;
+   } else {
+   
/**/
+   printf(
+   "\nCase 1: Svc INTMIN on VDEST=200 Broadcasting a LOW 
Priority message to Svc EXTMIN\n");
+   if (mds_service_subscribe(gl_tet_vdest[1].mds_pwe1_hdl,
+ NCSMDS_SVC_ID_INTERNAL_MIN,
+ NCSMDS_SCOPE_NONE, 1,
+ svcids) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   if (mds_service_retrieve(gl_tet_vdest[1].mds_pwe1_hdl,
+NCSMDS_SVC_ID_INTERNAL_MIN,
+SA_DISPATCH_ALL) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   if (mds_broadcast_to_svc(
+   gl_tet_vdest[1].mds_pwe1_hdl,
+   NCSMDS_SVC_ID_INTERNAL_MIN, NCSMDS_SVC_ID_EXTERNAL_MIN,
+   NCSMDS_SCOPE_NONE, MDS_SEND_PRIORITY_LOW,
+   mesg) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   } else
+   printf("\nSuccess\n");
+   if (mds_service_cancel_subscription(
+   gl_tet_vdest[1].mds_pwe1_hdl,
+   NCSMDS_SVC_ID_INTERNAL_MIN, 1,
+   svcids) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   }
+   
/*-*/
+   /*clean up*/
+   if (tet_cleanup_setup()) {
+   printf("\nSetup Clean Up has Failed \n");
+   FAIL = 1;
+   }
+
+   free(mesg);
+   test_validate(FAIL, 0);
+}
+
+void tet_broadcast_to_svc_tp_8()
+{
+   int FAIL = 0;
+   MDS_SVC_ID svcids[] = {NCSMDS_SVC_ID_EXTERNAL_MIN};
+
+   // Test broadcast of large message
+   char tmp[66000] = " Hi All ";
+   TET_MDS_MSG *mesg;
+   mesg = (TET_MDS_MSG *)malloc(sizeof(TET_MDS_MSG));
+   memset(mesg, 0, sizeof(TET_MDS_MSG));
+   memcpy(mesg->send_data, tmp, sizeof(tmp));
+   mesg->send_len = sizeof(tmp);
+
+   /*Start up*/
+   if (tet_initialise_setup(false)) {
+   printf("\nSetup Initialisation has Failed \n");
+   FAIL = 1;
+   } else {
+   
/**/
+   printf(
+   "\nCase 1: Svc INTMIN on VDEST=200 Broadcasting a LOW 
Priority message to Svc EXTMIN\n");
+   if (mds_service_subscribe(gl_tet_vdest[1].mds_pwe1_hdl,
+ NCSMDS_SVC_ID_INTERNAL_MIN,
+ NCSMDS_SCOPE_NONE, 1,
+ svcids) != NCSCC_RC_SUCCESS) {
+   printf("\nFail\n");
+   FAIL = 1;
+   }
+   if (mds_service_retrieve(gl_tet_vdest[1].mds_pwe1_hdl,
+NCSMDS_SVC_ID_INTERNAL_MIN,
+SA_DISPATCH_ALL) != 

Re: [devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-28 Thread Hans Nordeback

Hi Minh,

yes, std::call_once or pthread_once should work.

/Thanks HansN

On 05/28/2018 05:08 AM, Minh Hon Chau wrote:

Hi Hans,

I think it can happen e.g if the traces in agent are enabled for more 
than 1 services.


Maybe std::call_once can do?

Thanks
Minh
On 25/05/18 18:33, Hans Nordeback wrote:

Hi Minh,

ack, with a comment/question, if logtrace_init can be called 
concurrently, the new calls are not thread safe. If so,


(it is the same problem when e.g. making a singleton thread safe, 
where e.g. "double-checked locking" has been tried, but


does not work).

Using pthread_once here should work.

/Thanks HansN

On 05/25/2018 05:58 AM, Minh Chau wrote:

When a process calls exit(), the exit_handler trigger
__do_global_dtor_aux then calls TraceLog destructor.
One of process thread is calling TraceLog::Log while
the destructor is called. This leads to a coredump.
The process (which could by any applications) calling
exit() first is responsible to make exit() thread-safe.
However, the TraceLog should also avoid the coredump
occurring at OpenSAF side.

Runtime allocate TraceLog pointer so that its memory
is located in heap. This allocation to avoid its
desctructor to be called as part of __do_global_dtor_aux.
---
  src/base/logtrace.cc    | 21 -
  src/base/logtrace_client.cc |  5 +
  src/base/logtrace_client.h  |  2 ++
  src/mds/mds_log.cc  | 15 ---
  4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index fd3d829..3d64e4d 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -43,8 +43,8 @@ bool enable_osaf_log = false;
    }  // namespace global
  -static TraceLog gl_trace;
-static TraceLog gl_osaflog;
+TraceLog* gl_trace = nullptr;
+TraceLog* gl_osaflog = nullptr;
    static pid_t gettid() { return syscall(SYS_gettid); }
  @@ -88,8 +88,8 @@ void trace_output(const char *file, unsigned 
line, unsigned priority,

    if (strncmp(file, "src/", 4) == 0) file += 4;
    snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), 
file, line,

 global::prefix_name[priority + category], format);
- gl_trace.Log(static_cast(priority), 
preamble,

-  ap);
+  TraceLog::Log(gl_trace, 
static_cast(priority),

+  preamble, ap);
  }
    void log_output(const char *file, unsigned line, unsigned priority,
@@ -101,8 +101,8 @@ void log_output(const char *file, unsigned line, 
unsigned priority,

    if (strncmp(file, "src/", 4) == 0) file += 4;
    snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), 
file, line,

 global::prefix_name[priority + category], format);
- gl_osaflog.Log(static_cast(priority), 
preamble,

-  ap);
+  TraceLog::Log(gl_osaflog, 
static_cast(priority),

+  preamble, ap);
  }
    void logtrace_log(const char *file, unsigned line, int priority,
@@ -176,11 +176,13 @@ int logtrace_init(const char *, const char 
*pathname, unsigned mask) {

  global::msg_id = nullptr;
    }
    if (result && mask != 0) {
-    result = gl_trace.Init(global::msg_id, TraceLog::kBlocking);
+    if (!gl_trace) gl_trace = new TraceLog();
+    result = gl_trace->Init(global::msg_id, TraceLog::kBlocking);
    }
    if (base::GetEnv("OSAF_LOCAL_NODE_LOG", uint32_t{0}) == 1) {
  global::enable_osaf_log = true;
-    gl_osaflog.Init(global::osaf_log_file, TraceLog::kBlocking);
+    if (!gl_osaflog) gl_osaflog = new TraceLog();
+    gl_osaflog->Init(global::osaf_log_file, TraceLog::kBlocking);
    }
    if (result) {
  syslog(LOG_INFO, "logtrace: trace enabled to file '%s', 
mask=0x%x",

@@ -221,7 +223,8 @@ int trace_category_set(unsigned mask) {
    if (global::category_mask == 0) {
  syslog(LOG_INFO, "logtrace: trace disabled");
    } else {
-    gl_trace.Init(global::msg_id, TraceLog::kBlocking);
+    if (!gl_trace) gl_trace = new TraceLog();
+    gl_trace->Init(global::msg_id, TraceLog::kBlocking);
  syslog(LOG_INFO, "logtrace: trace enabled to file %s, mask=0x%x",
 global::msg_id, global::category_mask);
    }
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index 0dac6d3..a9d82e2 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -81,6 +81,11 @@ bool TraceLog::Init(const char *msg_id, WriteMode 
mode) {

    return true;
  }
  +void TraceLog::Log(TraceLog* tracelog, base::LogMessage::Severity 
severity,

+  const char *fmt, va_list ap) {
+  if (tracelog != nullptr) tracelog->Log(severity, fmt, ap);
+}
+
  void TraceLog::Log(base::LogMessage::Severity severity, const char 
*fmt,

 va_list ap) {
    if (log_socket_ != nullptr && mutex_ != nullptr) {
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index eac31d0..21c7d2e 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_clien

Re: [devel] [PATCH 1/1] base: Place TraceLog instance on heap memory V3 [#2860]

2018-05-25 Thread Hans Nordeback

Hi Minh,

ack, with a comment/question, if logtrace_init can be called 
concurrently, the new calls are not thread safe. If so,


(it is the same problem when e.g. making a singleton thread safe, where 
e.g. "double-checked locking" has been tried, but


does not work).

Using pthread_once here should work.

/Thanks HansN

On 05/25/2018 05:58 AM, Minh Chau wrote:

When a process calls exit(), the exit_handler trigger
__do_global_dtor_aux then calls TraceLog destructor.
One of process thread is calling TraceLog::Log while
the destructor is called. This leads to a coredump.
The process (which could by any applications) calling
exit() first is responsible to make exit() thread-safe.
However, the TraceLog should also avoid the coredump
occurring at OpenSAF side.

Runtime allocate TraceLog pointer so that its memory
is located in heap. This allocation to avoid its
desctructor to be called as part of __do_global_dtor_aux.
---
  src/base/logtrace.cc| 21 -
  src/base/logtrace_client.cc |  5 +
  src/base/logtrace_client.h  |  2 ++
  src/mds/mds_log.cc  | 15 ---
  4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index fd3d829..3d64e4d 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -43,8 +43,8 @@ bool enable_osaf_log = false;
  
  }  // namespace global
  
-static TraceLog gl_trace;

-static TraceLog gl_osaflog;
+TraceLog* gl_trace = nullptr;
+TraceLog* gl_osaflog = nullptr;
  
  static pid_t gettid() { return syscall(SYS_gettid); }
  
@@ -88,8 +88,8 @@ void trace_output(const char *file, unsigned line, unsigned priority,

if (strncmp(file, "src/", 4) == 0) file += 4;
snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), file, line,
 global::prefix_name[priority + category], format);
-  gl_trace.Log(static_cast(priority), preamble,
-  ap);
+  TraceLog::Log(gl_trace, static_cast(priority),
+  preamble, ap);
  }
  
  void log_output(const char *file, unsigned line, unsigned priority,

@@ -101,8 +101,8 @@ void log_output(const char *file, unsigned line, unsigned 
priority,
if (strncmp(file, "src/", 4) == 0) file += 4;
snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), file, line,
 global::prefix_name[priority + category], format);
-  gl_osaflog.Log(static_cast(priority), preamble,
-  ap);
+  TraceLog::Log(gl_osaflog, static_cast(priority),
+  preamble, ap);
  }
  
  void logtrace_log(const char *file, unsigned line, int priority,

@@ -176,11 +176,13 @@ int logtrace_init(const char *, const char *pathname, 
unsigned mask) {
  global::msg_id = nullptr;
}
if (result && mask != 0) {
-result = gl_trace.Init(global::msg_id, TraceLog::kBlocking);
+if (!gl_trace) gl_trace = new TraceLog();
+result = gl_trace->Init(global::msg_id, TraceLog::kBlocking);
}
if (base::GetEnv("OSAF_LOCAL_NODE_LOG", uint32_t{0}) == 1) {
  global::enable_osaf_log = true;
-gl_osaflog.Init(global::osaf_log_file, TraceLog::kBlocking);
+if (!gl_osaflog) gl_osaflog = new TraceLog();
+gl_osaflog->Init(global::osaf_log_file, TraceLog::kBlocking);
}
if (result) {
  syslog(LOG_INFO, "logtrace: trace enabled to file '%s', mask=0x%x",
@@ -221,7 +223,8 @@ int trace_category_set(unsigned mask) {
if (global::category_mask == 0) {
  syslog(LOG_INFO, "logtrace: trace disabled");
} else {
-gl_trace.Init(global::msg_id, TraceLog::kBlocking);
+if (!gl_trace) gl_trace = new TraceLog();
+gl_trace->Init(global::msg_id, TraceLog::kBlocking);
  syslog(LOG_INFO, "logtrace: trace enabled to file %s, mask=0x%x",
 global::msg_id, global::category_mask);
}
diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index 0dac6d3..a9d82e2 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -81,6 +81,11 @@ bool TraceLog::Init(const char *msg_id, WriteMode mode) {
return true;
  }
  
+void TraceLog::Log(TraceLog* tracelog, base::LogMessage::Severity severity,

+  const char *fmt, va_list ap) {
+  if (tracelog != nullptr) tracelog->Log(severity, fmt, ap);
+}
+
  void TraceLog::Log(base::LogMessage::Severity severity, const char *fmt,
 va_list ap) {
if (log_socket_ != nullptr && mutex_ != nullptr) {
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index eac31d0..21c7d2e 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -32,6 +32,8 @@ class TraceLog {
  kNonblocking = base::UnixSocket::Mode::kNonblocking,
};
bool Init(const char *msg_id, WriteMode mode);
+  static void Log(TraceLog* tracelog, base::LogMessage::Severity severity,
+  const char *fmt, va_list ap);
void Log(base::LogMessage::Severity severity, const char *fmt,
va_list ap);
TraceLog();
diff --git a/src/mds/mds_log.cc 

Re: [devel] [PATCH 1/1] base: Destructor of TraceLog causes coredump V2 [#2860]

2018-05-24 Thread Hans Nordeback

Hi Minh,

yes gl_trace/gl_log can be put on the heap, you mean without any owner?

But in this case when destructors for one of the threads has been run 
other threads


should notice that some states may not be valid anymore,  e.g. that 
mutex_->good() returns false, but if mutex_ has been


released it should be if (mutex_ && mutex_->good() instead.


/Thanks HansN


On 05/24/2018 06:20 AM, Hans Nordebäck wrote:

Hi Minh,


yes you are right about the possibility for a segv, but using a std::shared_ptr 
instead of the naked ptr may be an option ?


/Thanks Hans


Från: Minh Hon Chau <minh.c...@dektech.com.au>
Skickat: den 24 maj 2018 02:34:13
Till: Hans Nordebäck; Anders Widell; Gary Lee
Kopia: opensaf-devel@lists.sourceforge.net
Ämne: Re: [PATCH 1/1] base: Destructor of TraceLog causes coredump V2 [#2860]

Hi Hans,

It is good to give an option to Mutex class not to abort. We can avoid
the abort in mutex_unlock (as reported in coredump), but I feel the
issue is still there.

We may hit a problem (segv?) with "mutex_->good()" since the other
thread is wiping out the mutex_ in destructor, it is a matter of timing
to happen I guess.

As we don't have (and don't want to have) any protection between two
threads for the TraceLog, so the good one (I hope) is making one of
those threads not to touch the TraceLog.

If you don't like to remove the destructor, another way is locating the
gl_trace/gl_log to the HEAP?

Thanks,

Minh



On 23/05/18 20:50, Hans Nordeback wrote:

Change Mutex class to make it possible for caller to decide if abort
---
   src/base/logtrace_client.cc |  5 -
   src/base/mutex.cc   |  2 +-
   src/base/mutex.h| 22 +-
   3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index 0dac6d389..f597c1ae3 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -76,7 +76,7 @@ bool TraceLog::Init(const char *msg_id, WriteMode mode) {
 msg_id_ = base::LogMessage::MsgId{msg_id};
 log_socket_ = new base::UnixClientSocket{Osaflog::kServerSocketPath,
   static_cast(mode)};
-  mutex_ = new base::Mutex{};
+  mutex_ = new base::Mutex{false};

 return true;
   }
@@ -91,6 +91,9 @@ void TraceLog::Log(base::LogMessage::Severity severity, const 
char *fmt,
   void TraceLog::LogInternal(base::LogMessage::Severity severity, const char 
*fmt,
  va_list ap) {
 base::Lock lock(*mutex_);
+
+  if (!mutex_->good()) return;
+
 uint32_t id = sequence_id_;
 sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
 buffer_.clear();
diff --git a/src/base/mutex.cc b/src/base/mutex.cc
index 5fa6ac55a..1627ac20b 100644
--- a/src/base/mutex.cc
+++ b/src/base/mutex.cc
@@ -20,7 +20,7 @@

   namespace base {

-Mutex::Mutex() : mutex_{} {
+Mutex::Mutex(bool abort) : abort_{abort}, mutex_{}, result_{0} {
 pthread_mutexattr_t attr;
 int result = pthread_mutexattr_init();
 if (result != 0) osaf_abort(result);
diff --git a/src/base/mutex.h b/src/base/mutex.h
index 7b3cee187..e3c54a711 100644
--- a/src/base/mutex.h
+++ b/src/base/mutex.h
@@ -31,30 +31,34 @@ namespace base {
   class Mutex {
public:
 using NativeHandleType = pthread_mutex_t*;
-  Mutex();
+  Mutex(bool abort = true);
 ~Mutex();
 void Lock() {
-int result = pthread_mutex_lock(_);
-if (result != 0) osaf_abort(result);
+result_ = pthread_mutex_lock(_);
+if (abort_ && result_ != 0) osaf_abort(result_);
 }
 bool TryLock() {
-int result = pthread_mutex_trylock(_);
-if (result == 0) {
+result_ = pthread_mutex_trylock(_);
+if (result_ == 0) {
 return true;
-} else if (result == EBUSY) {
+} else if (result_ == EBUSY) {
 return false;
   } else {
-  osaf_abort(result);
+  if (abort_) osaf_abort(result_);
+  return false;
   }
 }
 void Unlock() {
-int result = pthread_mutex_unlock(_);
-if (result != 0) osaf_abort(result);
+result_ = pthread_mutex_unlock(_);
+if (abort_ && result_ != 0) osaf_abort(result_);
 }
 NativeHandleType native_handle() { return _; }

+  bool good() const {return result_ == 0;};
private:
+  bool abort_;
 pthread_mutex_t mutex_;
+  int result_;
 DELETE_COPY_AND_MOVE_OPERATORS(Mutex);
   };


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



--
Check out the vibrant tech community on one of the world's most
enga

[devel] [PATCH 0/1] Review Request for base: Destructor of TraceLog causes coredump V2 [#2860]

2018-05-23 Thread Hans Nordeback
Summary: base: Destructor of TraceLog causes coredump V2 [#2860]
Review request for Ticket(s): 2860
Peer Reviewer(s): Minh, Gary, AndersW
Pull request to:
Affected branch(es): develop
Development branch: ticket-2860
Base revision: e0bcf786e0b3417d31b767073bb789ef150eb2ad
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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


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

revision c8e1aced8519c4f77819b1dbc92bdedfcf4734ea
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Wed, 23 May 2018 12:36:40 +0200

base: Destructor of TraceLog causes coredump V2 [#2860]

Change Mutex class to make it possible for caller to decide if abort



Complete diffstat:
--
 src/base/logtrace_client.cc |  5 -
 src/base/mutex.cc   |  2 +-
 src/base/mutex.h| 22 +-
 3 files changed, 18 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  y  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] base: Destructor of TraceLog causes coredump V2 [#2860]

2018-05-23 Thread Hans Nordeback
Change Mutex class to make it possible for caller to decide if abort
---
 src/base/logtrace_client.cc |  5 -
 src/base/mutex.cc   |  2 +-
 src/base/mutex.h| 22 +-
 3 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index 0dac6d389..f597c1ae3 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -76,7 +76,7 @@ bool TraceLog::Init(const char *msg_id, WriteMode mode) {
   msg_id_ = base::LogMessage::MsgId{msg_id};
   log_socket_ = new base::UnixClientSocket{Osaflog::kServerSocketPath,
 static_cast(mode)};
-  mutex_ = new base::Mutex{};
+  mutex_ = new base::Mutex{false};
 
   return true;
 }
@@ -91,6 +91,9 @@ void TraceLog::Log(base::LogMessage::Severity severity, const 
char *fmt,
 void TraceLog::LogInternal(base::LogMessage::Severity severity, const char 
*fmt,
va_list ap) {
   base::Lock lock(*mutex_);
+
+  if (!mutex_->good()) return;
+
   uint32_t id = sequence_id_;
   sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
   buffer_.clear();
diff --git a/src/base/mutex.cc b/src/base/mutex.cc
index 5fa6ac55a..1627ac20b 100644
--- a/src/base/mutex.cc
+++ b/src/base/mutex.cc
@@ -20,7 +20,7 @@
 
 namespace base {
 
-Mutex::Mutex() : mutex_{} {
+Mutex::Mutex(bool abort) : abort_{abort}, mutex_{}, result_{0} {
   pthread_mutexattr_t attr;
   int result = pthread_mutexattr_init();
   if (result != 0) osaf_abort(result);
diff --git a/src/base/mutex.h b/src/base/mutex.h
index 7b3cee187..e3c54a711 100644
--- a/src/base/mutex.h
+++ b/src/base/mutex.h
@@ -31,30 +31,34 @@ namespace base {
 class Mutex {
  public:
   using NativeHandleType = pthread_mutex_t*;
-  Mutex();
+  Mutex(bool abort = true);
   ~Mutex();
   void Lock() {
-int result = pthread_mutex_lock(_);
-if (result != 0) osaf_abort(result);
+result_ = pthread_mutex_lock(_);
+if (abort_ && result_ != 0) osaf_abort(result_);
   }
   bool TryLock() {
-int result = pthread_mutex_trylock(_);
-if (result == 0) {
+result_ = pthread_mutex_trylock(_);
+if (result_ == 0) {
   return true;
-} else if (result == EBUSY) {
+} else if (result_ == EBUSY) {
   return false;
 } else {
-  osaf_abort(result);
+  if (abort_) osaf_abort(result_);
+  return false;
 }
   }
   void Unlock() {
-int result = pthread_mutex_unlock(_);
-if (result != 0) osaf_abort(result);
+result_ = pthread_mutex_unlock(_);
+if (abort_ && result_ != 0) osaf_abort(result_);
   }
   NativeHandleType native_handle() { return _; }
 
+  bool good() const {return result_ == 0;};
  private:
+  bool abort_;
   pthread_mutex_t mutex_;
+  int result_;
   DELETE_COPY_AND_MOVE_OPERATORS(Mutex);
 };
 
-- 
2.17.0


--
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] base: Disable TraceLog desctructor [#2860]

2018-05-22 Thread Hans Nordeback

Hi Minh,

I think the call to exit() should be made thread safe instead, removing 
the destructor may lead to


other problems such as leakages.

In the "daemonized" services _Exit() is called and no destructors are 
run, there were some problems


earlier when some libraries called exit(), these exits has been removed. 
So if exit() has to be called


it should be made thread safe.

/Thanks HansN


On 05/22/2018 08:06 AM, Minh Chau wrote:

When IMMD call exit(), there is a race condition in IMMD which's
thread call TraceLog::Log which the destructor of TraceLog instance
is being called as part of exit handler.

This patch disables TraceLog desctrutor to avoid the coredump, the
memory granted to the process would be reclaimed by the OS after
process's death.
---
  src/base/logtrace_client.cc | 5 -
  src/base/logtrace_client.h  | 1 -
  2 files changed, 6 deletions(-)

diff --git a/src/base/logtrace_client.cc b/src/base/logtrace_client.cc
index 0dac6d3..e181831 100644
--- a/src/base/logtrace_client.cc
+++ b/src/base/logtrace_client.cc
@@ -28,11 +28,6 @@ TraceLog::TraceLog()
log_socket_ = nullptr;
  }
  
-TraceLog::~TraceLog() {

-  if (mutex_) delete mutex_;
-  if (log_socket_) delete log_socket_;
-}
-
  bool TraceLog::Init(const char *msg_id, WriteMode mode) {
char app_name[NAME_MAX];
char pid_path[PATH_MAX];
diff --git a/src/base/logtrace_client.h b/src/base/logtrace_client.h
index eac31d0..c2219e2 100644
--- a/src/base/logtrace_client.h
+++ b/src/base/logtrace_client.h
@@ -35,7 +35,6 @@ class TraceLog {
void Log(base::LogMessage::Severity severity, const char *fmt,
va_list ap);
TraceLog();
-  ~TraceLog();
  
   private:

void LogInternal(base::LogMessage::Severity severity, const char *fmt,



--
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] rded: run controller promotion code in new thread [#2857]

2018-05-18 Thread Hans Nordeback

Hi Gary,

ack, code review only.

/Thanks HansN


On 05/18/2018 07:50 AM, Gary Lee wrote:

Currently, the consensus code relating to node promotion
is run from the main thread. We can improve rded's
responsiveness by moving this code into another thread.
---
  src/rde/rded/rde_cb.h|  3 +-
  src/rde/rded/rde_main.cc |  6 +++-
  src/rde/rded/role.cc | 82 ++--
  src/rde/rded/role.h  |  2 ++
  4 files changed, 61 insertions(+), 32 deletions(-)

diff --git a/src/rde/rded/rde_cb.h b/src/rde/rded/rde_cb.h
index f5ad689c3..877687341 100644
--- a/src/rde/rded/rde_cb.h
+++ b/src/rde/rded/rde_cb.h
@@ -53,7 +53,8 @@ enum RDE_MSG_TYPE {
RDE_MSG_NEW_ACTIVE_CALLBACK = 5,
RDE_MSG_NODE_UP = 6,
RDE_MSG_NODE_DOWN = 7,
-  RDE_MSG_TAKEOVER_REQUEST_CALLBACK = 8
+  RDE_MSG_TAKEOVER_REQUEST_CALLBACK = 8,
+  RDE_MSG_ACTIVE_PROMOTION_SUCCESS = 9
  };
  
  struct rde_peer_info {

diff --git a/src/rde/rded/rde_main.cc b/src/rde/rded/rde_main.cc
index c5b4b8283..c59aa4536 100644
--- a/src/rde/rded/rde_main.cc
+++ b/src/rde/rded/rde_main.cc
@@ -55,7 +55,8 @@ const char *rde_msg_name[] = {"-",
"RDE_MSG_NEW_ACTIVE_CALLBACK(5)"
"RDE_MSG_NODE_UP(6)",
"RDE_MSG_NODE_DOWN(7)",
-  "RDE_MSG_TAKEOVER_REQUEST_CALLBACK(8)"};
+  "RDE_MSG_TAKEOVER_REQUEST_CALLBACK(8)",
+  "RDE_MSG_ACTIVE_PROMOTION_SUCCESS(9)"};
  
  static RDE_CONTROL_BLOCK _rde_cb;

  static RDE_CONTROL_BLOCK *rde_cb = &_rde_cb;
@@ -186,6 +187,9 @@ static void handle_mbx_event() {
  LOG_WA("Received takeover request when not active");
}
  } break;
+case RDE_MSG_ACTIVE_PROMOTION_SUCCESS:
+  role->NodePromoted();
+  break;
  default:
LOG_ER("%s: discarding unknown message type %u", __FUNCTION__, 
msg->type);
break;
diff --git a/src/rde/rded/role.cc b/src/rde/rded/role.cc
index 1b5a6ae89..b6a5df51a 100644
--- a/src/rde/rded/role.cc
+++ b/src/rde/rded/role.cc
@@ -22,6 +22,7 @@
  #include "rde/rded/role.h"
  #include 
  #include 
+#include 
  #include "base/getenv.h"
  #include "base/logtrace.h"
  #include "base/ncs_main_papi.h"
@@ -63,6 +64,55 @@ void Role::MonitorCallback(const std::string& key, const 
std::string& new_value,
osafassert(status == NCSCC_RC_SUCCESS);
  }
  
+void Role::PromoteNode(const uint64_t cluster_size) {

+  TRACE_ENTER();
+  SaAisErrorT rc;
+
+  Consensus consensus_service;
+
+  rc = consensus_service.PromoteThisNode(true, cluster_size);
+  if (rc != SA_AIS_OK && rc != SA_AIS_ERR_EXIST) {
+LOG_ER("Unable to set active controller in consensus service");
+opensaf_reboot(0, nullptr,
+   "Unable to set active controller in consensus service");
+  }
+
+  if (rc == SA_AIS_ERR_EXIST) {
+LOG_WA("Another controller is already active");
+return;
+  }
+
+  RDE_CONTROL_BLOCK* cb = rde_get_control_block();
+
+  // send msg to main thread
+  rde_msg* msg = static_cast(malloc(sizeof(rde_msg)));
+  msg->type = RDE_MSG_ACTIVE_PROMOTION_SUCCESS;
+  uint32_t status;
+  status = m_NCS_IPC_SEND(>mbx, msg, NCS_IPC_PRIORITY_HIGH);
+  osafassert(status == NCSCC_RC_SUCCESS);
+}
+
+void Role::NodePromoted() {
+  ExecutePreActiveScript();
+  LOG_NO("Switched to ACTIVE from %s", to_string(role()));
+  role_ = PCS_RDA_ACTIVE;
+  rde_rda_send_role(role_);
+
+  Consensus consensus_service;
+  RDE_CONTROL_BLOCK* cb = rde_get_control_block();
+
+  // register for callback if active controller is changed
+  // in consensus service
+  if (cb->monitor_lock_thread_running == false) {
+cb->monitor_lock_thread_running = true;
+consensus_service.MonitorLock(MonitorCallback, cb->mbx);
+  }
+  if (cb->monitor_takeover_req_thread_running == false) {
+cb->monitor_takeover_req_thread_running = true;
+consensus_service.MonitorTakeoverRequest(MonitorCallback, cb->mbx);
+  }
+}
+
  Role::Role(NODE_ID own_node_id)
  : known_nodes_{},
role_{PCS_RDA_QUIESCED},
@@ -83,36 +133,8 @@ timespec* Role::Poll(timespec* ts) {
timeout = ts;
  } else {
RDE_CONTROL_BLOCK* cb = rde_get_control_block();
-  SaAisErrorT rc;
-  Consensus consensus_service;
-
-  rc = consensus_service.PromoteThisNode(true, cb->cluster_members.size());
-  if (rc != SA_AIS_OK && rc != SA_AIS_ERR_EXIST) {
-LOG_ER("Unable to set active controller in consensus service");
-opensaf_reboot(0, nullptr,
-   "Unable to set active controller in consensus service");
-  }
-
-  if (rc == SA_AIS_ERR_EXIST) {
-LOG_WA("Another controller is already active");
-return timeout;
-  }
-
-  ExecutePreActiveScript();
-  LOG_NO("Switched to ACTIVE from %s", to_string(role()));
-  role_ = PCS_RDA_ACTIVE;
-  rde_rda_send_role(role_);
-
-  // register for callback if active controller is 

[devel] [PATCH 1/1] base: Improve backtrace print in daemon.c [#2853]

2018-05-16 Thread Hans Nordeback
---
 src/base/daemon.c   | 52 ++---
 tools/cluster_sim_uml/build_uml |  1 +
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c
index 361dd8dd6..2ad0dcd2d 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -608,14 +608,18 @@ static void fatal_signal_handler(int sig, siginfo_t 
*siginfo, void *ctx)
const int BT_ARRAY_SIZE = 20;
void *bt_array[BT_ARRAY_SIZE];
size_t bt_size;
-   int fd;
char bt_header[40];
+   char cmd_buf[200];
+   char addr2line_buf[120];
+   Dl_info dl_info;
+   FILE *fp;
 
-   if ((fd = open(bt_filename, O_RDWR | O_CREAT, 0644)) < 0) {
+   int fd = open(bt_filename, O_RDWR | O_CREAT, 0644);
+
+   if (fd < 0)
goto done;
-   }
 
-   snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: %u\n",
+   snprintf(bt_header, sizeof(bt_header), "signal: %d pid: %u uid: %u\n\n",
 sig, siginfo->si_pid, siginfo->si_uid);
 
if (write(fd, bt_header, strlen(bt_header)) < 0) {
@@ -624,6 +628,45 @@ static void fatal_signal_handler(int sig, siginfo_t 
*siginfo, void *ctx)
}
 
bt_size = plibc_backtrace(bt_array, BT_ARRAY_SIZE);
+
+   if (system("which addr2line") == 0) {
+   for (int i = 0; i < bt_size; ++i) {
+   memset(_info, 0, sizeof(dl_info));
+   dladdr(bt_array[i], _info);
+   ptrdiff_t offset = bt_array[i] - dl_info.dli_fbase;
+
+   snprintf(cmd_buf, sizeof(cmd_buf),
+"addr2line %tx -p -f -e %s",
+offset, dl_info.dli_fname);
+
+   fp = popen(cmd_buf, "r");
+   if (fp == NULL) {
+   syslog(LOG_ERR,
+  "popen failed: %s", strerror(errno));
+   } else {
+   if (fgets(addr2line_buf,
+ sizeof(addr2line_buf),
+ fp) != NULL) {
+   snprintf(cmd_buf, sizeof(cmd_buf),
+"# %d %s",
+i, addr2line_buf);
+   if (write(fd, cmd_buf,
+ strlen(cmd_buf)) < 0) {
+   syslog(LOG_ERR,
+  "write failed: %s",
+  strerror(errno));
+   }
+   }
+   pclose(fp);
+   }
+   }
+   }
+
+   if (write(fd, "\n", 1) < 0) {
+   syslog(LOG_ERR,
+  "write failed: %s", strerror(errno));
+   }
+
plibc_backtrace_symbols_fd(bt_array, bt_size, fd);
 
close(fd);
@@ -677,6 +720,7 @@ static void install_fatal_signal_handlers(void)
 time_string, getpid());
 
struct sigaction action;
+
memset(, 0, sizeof(action));
action.sa_sigaction = fatal_signal_handler;
sigfillset(_mask);
diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml
index b9f224360..16d49d03e 100755
--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -176,6 +176,7 @@ cmd_create_rootfs()
 test -e /usr/bin/lsof && install /usr/bin/lsof usr/bin
 test -e /bin/pidof && install /bin/pidof usr/bin
 test -e /usr/sbin/tcpdump && install /usr/sbin/tcpdump usr/sbin
+test -e /usr/bin/addr2line && install /usr/bin/addr2line usr/bin
 if test -e /usr/bin/gdb; then
install /usr/bin/gdb usr/bin
if test -d /usr/share/gdb; then
-- 
2.17.0


--
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] nid: restart opensafd on failure when systemd enabled [#2839]

2018-04-26 Thread Hans Nordeback

Hi Alex,

I tested this, immnd gets restarted and systemd reports opensafd.service 
as active (running),


so it works as expected. In your case, immnd is never restarted after 
the nid phase, or does it work


if you increase the sleep time? One thing you can check is to send an 
ABRT instead of the KILL and check


the core dump at e.g. which address you receive the signal. Perhaps you 
have found a "window"


where immnd is not monitored?

/Regards HansN


On 04/25/2018 03:23 PM, Alex Jones wrote:


Hi Hans,

    I understand. But, what if it doesn't fail in the nid phase?

    If you run this command in your setup: "systemctl start opensafd; 
sleep 2; pkill -KILL immnd", does immnd get restarted? And does 
opensafd successfully come up according to systemd?


Alex


On 04/25/2018 09:19 AM, Hans Nordebäck wrote:


NOTICE: This email was received from an EXTERNAL sender


Hi Alex,

the reboot should only happen if REBOOT_ON_FAIL_TIMEOUT is set, (i.e. 
not 0).


I checked the latest version, the reboot works fine if e.g. immnd 
fails in the nid phase and REBOOT_ON_FAIL_TIMEOUT is set.


/Thanks HansN

*From:*Alex Jones [mailto:ajo...@rbbn.com]
*Sent:* den 25 april 2018 15:05
*To:* Hans Nordebäck <hans.nordeb...@ericsson.com>; Anders Widell 
<anders.wid...@ericsson.com>

*Cc:* opensaf-devel@lists.sourceforge.net
*Subject:* Re: SV: [PATCH 1/1] nid: restart opensafd on failure when 
systemd enabled [#2839]


Hi Hans,

    There must be a hole here, then. Because in our setup, if dtmd or 
immnd crashes early in the startup process, the node doesn't reboot, 
and the executables are not restarted. If I set "Restart=on-failure" 
it works fine.


    Can you test this in your setup to see if you see the same thing?

Alex

On 04/24/2018 05:04 AM, Hans Nordeback wrote:



NOTICE: This email was received from an EXTERNAL sender



Hi Alex,

please see comment below.

/Thanks HansN

On 04/23/2018 03:56 PM, Alex Jones wrote:

Hi Hans,

    I just did some tests. Maybe there is a bug in nid, but
when I do not have "Restart=on-failure", the node does not
reboot when I run the command "systemctl start opensafd;
sleep 3; pkill -KILL immnd", and opensafd times out and
fails, with REBOOT_ON_FAIL_TIMEOUT=30.

[HansN] isn't the nid phase finished before the sleep 3 command?
It is only during the nid phase that the REBOOT_ON_FAIL_TIMEOUT
is used,
After the nid phase opensaf enters "normal" operation,  no reboot
will be performed as immnd is restartable. Instead of the sleep 3,
you can edit the nodeinit.conf.controller file and change the
immnd line to e.g.
"/usr/local/lib/opensaf/clc-cli/osaf-immndx:IMMND ... " then
nid should fail to start and REBOOT_ON_FAIL_TIMEOUT should work.


    But, opensafd restarts every time when I run that command
with "Restart=on-failure" set.

Alex

On 04/19/2018 04:02 PM, Hans Nordebäck wrote:




NOTICE: This email was received from an EXTERNAL sender




Hi Alex,

a question, if opensafd fails, (assert or exit code ne 0)
a reboot of the node will be performed if
REBOOT_ON_FAIL_TIMEOUT

is configured, I have not checked, but how do systemd
handle the reboot request if Restart=on-failure is set?

/BR HansN




*Från:* Alex Jones <ajo...@rbbn.com> <mailto:ajo...@rbbn.com>
*Skickat:* den 19 april 2018 17:27:27
*Till:* Hans Nordebäck; Anders Widell
*Kopia:* opensaf-devel@lists.sourceforge.net
<mailto:opensaf-devel@lists.sourceforge.net>; Alex Jones
*Ämne:* [PATCH 1/1] nid: restart opensafd on failure when
systemd enabled [#2839]

Under certain circumstances opensafd fails to start
(immnd or dtmd crashes,
etc).

Apr 19 15:07:31 ams-idsp-46-novnfm osafdtmd[3315]:
src/dtm/dtmnd/dtm_intra_svc.cc:1778:
dtm_process_internode_service_up_msg: Assertion '0' failed.

We can tell systemd to restart opensafd if it fails to start.
---
 src/nid/opensafd.service.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/n

Re: [devel] [PATCH 1/1] nid: restart opensafd on failure when systemd enabled [#2839]

2018-04-25 Thread Hans Nordeback

Hi Alex,

ok I'll check if there is a problem, but immnd is restartable and should 
be restarted after the nid phase is


finished.

After the nid phase the system should  be in a "well defined" state. 
That was one of the


reasons fifo monitoring was added to the nid phase.

/HansN


On 04/25/2018 03:23 PM, Alex Jones wrote:


Hi Hans,

    I understand. But, what if it doesn't fail in the nid phase?

    If you run this command in your setup: "systemctl start opensafd; 
sleep 2; pkill -KILL immnd", does immnd get restarted? And does 
opensafd successfully come up according to systemd?


Alex


On 04/25/2018 09:19 AM, Hans Nordebäck wrote:


NOTICE: This email was received from an EXTERNAL sender


Hi Alex,

the reboot should only happen if REBOOT_ON_FAIL_TIMEOUT is set, (i.e. 
not 0).


I checked the latest version, the reboot works fine if e.g. immnd 
fails in the nid phase and REBOOT_ON_FAIL_TIMEOUT is set.


/Thanks HansN

*From:*Alex Jones [mailto:ajo...@rbbn.com]
*Sent:* den 25 april 2018 15:05
*To:* Hans Nordebäck <hans.nordeb...@ericsson.com>; Anders Widell 
<anders.wid...@ericsson.com>

*Cc:* opensaf-devel@lists.sourceforge.net
*Subject:* Re: SV: [PATCH 1/1] nid: restart opensafd on failure when 
systemd enabled [#2839]


Hi Hans,

    There must be a hole here, then. Because in our setup, if dtmd or 
immnd crashes early in the startup process, the node doesn't reboot, 
and the executables are not restarted. If I set "Restart=on-failure" 
it works fine.


    Can you test this in your setup to see if you see the same thing?

Alex

On 04/24/2018 05:04 AM, Hans Nordeback wrote:



NOTICE: This email was received from an EXTERNAL sender



Hi Alex,

please see comment below.

/Thanks HansN

On 04/23/2018 03:56 PM, Alex Jones wrote:

Hi Hans,

    I just did some tests. Maybe there is a bug in nid, but
when I do not have "Restart=on-failure", the node does not
reboot when I run the command "systemctl start opensafd;
sleep 3; pkill -KILL immnd", and opensafd times out and
fails, with REBOOT_ON_FAIL_TIMEOUT=30.

[HansN] isn't the nid phase finished before the sleep 3 command?
It is only during the nid phase that the REBOOT_ON_FAIL_TIMEOUT
is used,
After the nid phase opensaf enters "normal" operation,  no reboot
will be performed as immnd is restartable. Instead of the sleep 3,
you can edit the nodeinit.conf.controller file and change the
immnd line to e.g.
"/usr/local/lib/opensaf/clc-cli/osaf-immndx:IMMND ... " then
nid should fail to start and REBOOT_ON_FAIL_TIMEOUT should work.


    But, opensafd restarts every time when I run that command
with "Restart=on-failure" set.

Alex

On 04/19/2018 04:02 PM, Hans Nordebäck wrote:




NOTICE: This email was received from an EXTERNAL sender




Hi Alex,

a question, if opensafd fails, (assert or exit code ne 0)
a reboot of the node will be performed if
REBOOT_ON_FAIL_TIMEOUT

is configured, I have not checked, but how do systemd
handle the reboot request if Restart=on-failure is set?

/BR HansN




*Från:* Alex Jones <ajo...@rbbn.com> <mailto:ajo...@rbbn.com>
*Skickat:* den 19 april 2018 17:27:27
*Till:* Hans Nordebäck; Anders Widell
*Kopia:* opensaf-devel@lists.sourceforge.net
<mailto:opensaf-devel@lists.sourceforge.net>; Alex Jones
*Ämne:* [PATCH 1/1] nid: restart opensafd on failure when
systemd enabled [#2839]

Under certain circumstances opensafd fails to start
(immnd or dtmd crashes,
etc).

Apr 19 15:07:31 ams-idsp-46-novnfm osafdtmd[3315]:
src/dtm/dtmnd/dtm_intra_svc.cc:1778:
dtm_process_internode_service_up_msg: Assertion '0' failed.

We can tell systemd to restart opensafd if it fails to start.
---
 src/nid/opensafd.service.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/nid/opensafd.service.in
b/src/nid/opensafd.service.in
index 7f4d75ee3..6050f5e88 100644
--- a/src/nid/opensafd.service.in
+++ b/sr

Re: [devel] [PATCH 1/1] nid: restart opensafd on failure when systemd enabled [#2839]

2018-04-24 Thread Hans Nordeback

Hi Alex,


please see comment below.


/Thanks HansN


On 04/23/2018 03:56 PM, Alex Jones wrote:


Hi Hans,


    I just did some tests. Maybe there is a bug in nid, but when I do 
not have "Restart=on-failure", the node does not reboot when I run the 
command "systemctl start opensafd; sleep 3; pkill -KILL immnd", and 
opensafd times out and fails, with REBOOT_ON_FAIL_TIMEOUT=30.


[HansN] isn't the nid phase finished before the sleep 3 command? It is 
only during the nid phase that the REBOOT_ON_FAIL_TIMEOUT is used,
After the nid phase opensaf enters "normal" operation,  no reboot will 
be performed as immnd is restartable. Instead of the sleep 3,
you can edit the nodeinit.conf.controller file and change the immnd line 
to e.g. "/usr/local/lib/opensaf/clc-cli/osaf-immndx:IMMND ... " then

nid should fail to start and REBOOT_ON_FAIL_TIMEOUT should work.



    But, opensafd restarts every time when I run that command with 
"Restart=on-failure" set.



Alex


On 04/19/2018 04:02 PM, Hans Nordebäck wrote:


NOTICE: This email was received from an EXTERNAL sender


Hi Alex,


a question, if opensafd fails, (assert or exit code ne 0) a reboot of 
the node will be performed if REBOOT_ON_FAIL_TIMEOUT


is configured, I have not checked, but how do systemd handle the 
reboot request if Restart=on-failure is set?



/BR HansN


*Från:* Alex Jones 
*Skickat:* den 19 april 2018 17:27:27
*Till:* Hans Nordebäck; Anders Widell
*Kopia:* opensaf-devel@lists.sourceforge.net; Alex Jones
*Ämne:* [PATCH 1/1] nid: restart opensafd on failure when systemd 
enabled [#2839]
Under certain circumstances opensafd fails to start (immnd or dtmd 
crashes,

etc).

Apr 19 15:07:31 ams-idsp-46-novnfm osafdtmd[3315]: 
src/dtm/dtmnd/dtm_intra_svc.cc:1778: 
dtm_process_internode_service_up_msg: Assertion '0' failed.


We can tell systemd to restart opensafd if it fails to start.
---
 src/nid/opensafd.service.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/nid/opensafd.service.in b/src/nid/opensafd.service.in
index 7f4d75ee3..6050f5e88 100644
--- a/src/nid/opensafd.service.in
+++ b/src/nid/opensafd.service.in
@@ -12,5 +12,7 @@ ControlGroup=cpu:/
 TimeoutStartSec=3hours
 KillMode=none
 @systemdtasksmax@
+Restart=on-failure
+
 [Install]
 WantedBy=multi-user.target
--
2.13.6





--
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] amfd: if rootCauseEntity is PLM entity don't engage lock/lock-in [#2835]

2018-04-20 Thread Hans Nordeback

Hi Alex,

please see below for some comments/questions.

/Regards HansN


On 04/18/2018 03:41 PM, Alex Jones wrote:

When using PLM an AMF node mapped to a CLM node mapped to a PLM EE, can get
stuck in locked state when rebooting, or going through a PLM EE lock/unlock.

When amfd receives a START step from CLM tracking it attempts to gracefully
shutdown the AMF node using AMF admin operations lock/lock-in. When PLM is
involved this doesn't always work correctly because PLM is also shutting down
the node by calling "opensafd stop". There is a race condition between PLM
using "opensafd stop", and amfd using the admin operations to bring down the
node, so that sometimes the AMF node gets stuck in locked state.

If the rootCauseEntity in the CLM tracking is a PLM entity then don't do
anything, as "opensafd stop" is already being called.
---
  src/amf/amfd/clm.cc | 25 -
  1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/amf/amfd/clm.cc b/src/amf/amfd/clm.cc
index 2bcea2db0..7f675d8e9 100644
--- a/src/amf/amfd/clm.cc
+++ b/src/amf/amfd/clm.cc
@@ -274,6 +274,27 @@ static void clm_track_cb(
  TRACE_3("Already got callback for start of this change.");
  continue;
}
+
+  if (strncmp(osaf_extended_name_borrow(rootCauseEntity),
+  "safEE=",
+  sizeof("safEE=") - 1) == 0 ||
+  strncmp(osaf_extended_name_borrow(rootCauseEntity),
+  "safHE=",
+  sizeof("safHE=") - 1) == 0) {
+// PLM will take care of calling opensafd stop
+TRACE("rootCause: %s from PLM operation so skipping %u",
+  osaf_extended_name_borrow(rootCauseEntity),
+  notifItem->clusterNode.nodeId);
+
+SaAisErrorT rc(saClmResponse_4(avd_cb->clmHandle,
+   invocation,
+   SA_CLM_CALLBACK_RESPONSE_OK));

[HansN] perhaps use:

SaAisErrorT rc = saClmResponse_4 or SaAisErrorT rc{saClmResponse_4 instead?


+if (rc != SA_AIS_OK)
+  LOG_ER("saClmResponse_4 failed: %i", rc);
+
[HansN] I think the amf operational state has to be checked and set to 
disabled? And should

break be used instead of continue?


+continue;
+  }
+
/* invocation to be used by pending clm response */
node->clm_pend_inv = invocation;
clm_node_exit_start(node, notifItem->clusterChange);
@@ -304,7 +325,9 @@ static void clm_track_cb(
  osaf_extended_name_borrow(rootCauseEntity),
  notifItem->clusterNode.nodeId);
if (strncmp(osaf_extended_name_borrow(rootCauseEntity),
-  "safEE=", 6) == 0) {
+  "safEE=", 6) == 0 ||
+  strncmp(osaf_extended_name_borrow(rootCauseEntity),
+  "safHE=", 6) == 0) {

[HansN] sizeof("safHE=") as above

  /* This callback is because of operation on PLM, so we need to 
mark
 the node absent, because PLCD will anyway call opensafd stop.*/
  AVD_AVND *node =


--
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 2/2] base: Example of OSAF_LOCAL_LOG_FILE environment variable in amfd.conf file [#2306]

2018-04-18 Thread Hans Nordeback

Hi Minh,

ack, review only. Minor suggestions below.

/Thanks HansN


On 04/12/2018 01:12 AM, Minh Chau wrote:

This commit is only an example to show where OSAF_LOCAL_LOG_FILE is
configured. This commit will not be pushed.
The introduction of OSAF_LOCAL_LOG_FILE for all services will be
in another commit.
---
  src/amf/amfd/amfd.conf | 6 ++
  1 file changed, 6 insertions(+)

diff --git a/src/amf/amfd/amfd.conf b/src/amf/amfd/amfd.conf
index 6ee111b..a5e4c21 100644
--- a/src/amf/amfd/amfd.conf
+++ b/src/amf/amfd/amfd.conf
@@ -19,3 +19,9 @@ export AVSV_HB_PERIOD=100
  
  # Uncomment the next line to enable info level logging

  #args="--loglevel=info"
+
+# Uncomment the next line to enable this service to log to OpenSAF local node 
log file
+# Only logging priority with equal or higher than LOG_WARNING to system log 
file
+# All logging will be recored in new local node log file
+# The log file is $PKGLOGDIR/osaf.log
+export OSAF_LOCAL_NODE_LOG=1
\ No newline at end of file

[Hans]

# Only log priority LOG_WARNING and higher to the system log file.
# All logging will be recorded in a new node local logfile $PKGLOGDIR/osaf.log.
# Uncomment the next line to enable this service to log to OpenSAF node local 
logfile.
# export OSAF_LOCAL_NODE_LOG=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


Re: [devel] [PATCH 1/2] base: Add support to direct OpenSAF logging to local node file [#2306]

2018-04-18 Thread Hans Nordeback

Hi Minh,

ack, code review only. Some comments below.

/Thanks HansN


On 04/12/2018 01:12 AM, Minh Chau wrote:

Unify TraceLog and MdsLog class to one class (TraceLog) so it can be
used as a common log client.
Add new instance TraceLog for OpenSAF logging to local file, which can
be enabled/disabled via environment variable OSAF_LOCAL_NODE_LOG
---
  src/base/logtrace.cc | 167 ++-
  src/base/logtrace.h  |  50 +--
  src/mds/mds_log.cc   | 114 +++
  3 files changed, 140 insertions(+), 191 deletions(-)

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index b046fab..857e31c 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -36,15 +36,10 @@
  #include 
  #include 
  #include 
-#include "base/buffer.h"
-#include "base/conf.h"
-#include "base/log_message.h"
-#include "base/macros.h"
-#include "base/mutex.h"
+#include "base/getenv.h"
  #include "base/ncsgl_defs.h"
  #include "base/osaf_utility.h"
  #include "base/time.h"
-#include "base/unix_client_socket.h"
  #include "dtm/common/osaflog_protocol.h"
  
  namespace global {

@@ -55,65 +50,38 @@ const char *const prefix_name[] = {"EM", "AL", "CR", "ER", "WA", 
"NO", "IN",
 "T6", "T7", "T8", ">>", "<<"};
  char *msg_id;
  int logmask;
+const char* osaf_log_file = "osaf.log";
+bool enable_osaf_log = false;
  
  }  // namespace global
  
-class TraceLog {

- public:
-  static bool Init();
-  static void Log(base::LogMessage::Severity severity, const char *fmt,
-  va_list ap);
-
- private:
-  TraceLog(const std::string , const std::string _name,
-   uint32_t proc_id, const std::string _id,
-   const std::string _name);
-  void LogInternal(base::LogMessage::Severity severity, const char *fmt,
-   va_list ap);
-  static constexpr const uint32_t kMaxSequenceId = uint32_t{0x7fff};
-  static TraceLog *instance_;
-  const base::LogMessage::HostName fqdn_;
-  const base::LogMessage::AppName app_name_;
-  const base::LogMessage::ProcId proc_id_;
-  const base::LogMessage::MsgId msg_id_;
-  uint32_t sequence_id_;
-  base::UnixClientSocket log_socket_;
-  base::Buffer<512> buffer_;
-  base::Mutex mutex_;
-
-  DELETE_COPY_AND_MOVE_OPERATORS(TraceLog);
-};
-
-TraceLog *TraceLog::instance_ = nullptr;
-
-TraceLog::TraceLog(const std::string , const std::string _name,
-   uint32_t proc_id, const std::string _id,
-   const std::string _name)
-: fqdn_{base::LogMessage::HostName{fqdn}},
-  app_name_{base::LogMessage::AppName{app_name}},
-  proc_id_{base::LogMessage::ProcId{std::to_string(proc_id)}},
-  msg_id_{base::LogMessage::MsgId{msg_id}},
-  sequence_id_{1},
-  log_socket_{socket_name, base::UnixSocket::kBlocking},
-  buffer_{},
-  mutex_{} {}
-
-bool TraceLog::Init() {
-  if (instance_ != nullptr) return false;
-  char app_name[49];
-  char pid_path[1024];
[HansN] instead of static global use unnamed namespaces instead. Also 
try to avoid globals, why change Log and Init from

static members? (An alternative is to use a singleton instead, if needed)

+static TraceLog gl_trace;
+static TraceLog gl_osaflog;
+TraceLog::TraceLog()
+: sequence_id_{1}, buffer_{} {
+  mutex_ = nullptr;
+  log_socket_ = nullptr;
+}
+
+TraceLog::~TraceLog() {
+  if (mutex_) delete mutex_;
+  if (log_socket_) delete log_socket_;
+}
+bool TraceLog::Init(const char *msg_id, WriteMode mode) {
+  char app_name[NAME_MAX];
+  char pid_path[PATH_MAX];
uint32_t process_id = getpid();
char *token, *saveptr;
char *pid_name = nullptr;
  
-  memset(app_name, 0, 49);

-  memset(pid_path, 0, 1024);
+  memset(app_name, 0, NAME_MAX);
+  memset(pid_path, 0, PATH_MAX);
  
snprintf(pid_path, sizeof(pid_path), "/proc/%" PRIu32 "/cmdline", process_id);

FILE *f = fopen(pid_path, "r");
if (f != nullptr) {
  size_t size;
-size = fread(pid_path, sizeof(char), 1024, f);
+size = fread(pid_path, sizeof(char), PATH_MAX, f);
  if (size > 0) {
if ('\n' == pid_path[size - 1]) pid_path[size - 1] = '\0';
  }
@@ -131,19 +99,28 @@ bool TraceLog::Init() {
}
base::Conf::InitFullyQualifiedDomainName();
const std::string  = base::Conf::FullyQualifiedDomainName();
-  instance_ = new TraceLog{fqdn, app_name, process_id, global::msg_id,
-   Osaflog::kServerSocketPath};
-  return instance_ != nullptr;
+
+  fqdn_ = base::LogMessage::HostName(fqdn);
+  app_name_ = base::LogMessage::AppName(app_name);
+  proc_id_ = base::LogMessage::ProcId{std::to_string(process_id)};
+  msg_id_ = base::LogMessage::MsgId{msg_id};
+  log_socket_ = new base::UnixClientSocket{Osaflog::kServerSocketPath,
+static_cast(mode)};
+  mutex_ = new base::Mutex{};
+
+  return true;
  }
  
  void TraceLog::Log(base::LogMessage::Severity severity, const char *fmt,

 va_list ap) {
-  if (instance_ != 

[devel] [PATCH 0/1] Review Request for base: Check return code from unlink in nid_create_ipc [#2829]

2018-04-05 Thread Hans Nordeback
Summary: base: Check return code from unlink in nid_create_ipc [#2829]
Review request for Ticket(s): 2829
Peer Reviewer(s): AndersW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2829
Base revision: b3c8028c3312ffe13c815dbe0249947a5c4947dc
Personal repository: git://git.code.sf.net/u/hansnordeback/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

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

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

revision c388066bbafb0dce8b4efdfe09a65a90571e8d25
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Thu, 5 Apr 2018 10:45:04 +0200

base: Check return code from unlink in nid_create_ipc [#2829]



Complete diffstat:
--
 src/nid/agent/nid_ipc.c | 9 -
 1 file changed, 8 insertions(+), 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] base: Check return code from unlink in nid_create_ipc [#2829]

2018-04-05 Thread Hans Nordeback
---
 src/nid/agent/nid_ipc.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/nid/agent/nid_ipc.c b/src/nid/agent/nid_ipc.c
index 4f43cd309..1a77fd8e2 100644
--- a/src/nid/agent/nid_ipc.c
+++ b/src/nid/agent/nid_ipc.c
@@ -28,6 +28,7 @@
 
 #include 
 #include 
+#include 
 #include "osaf/configmake.h"
 
 #include "nid/agent/nid_api.h"
@@ -56,7 +57,13 @@ uint32_t nid_create_ipc(char *strbuf)
mode_t mask;
 
/* Lets Remove any such file if it already exists */
-   unlink(NID_FIFO);
+   if (access(NID_FIFO, F_OK ) != -1 ) {
+   if (unlink(NID_FIFO) < 0) {
+   sprintf(strbuf, " FAILURE: Unable To Delete FIFO Error: 
%s\n",
+   strerror(errno));
+   return NCSCC_RC_FAILURE;
+   }
+   }
 
mask = umask(0);
 
-- 
2.16.2


--
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] build: Add support for google gmock framework V2 [#2823]

2018-04-03 Thread Hans Nordeback
---
 00-README.unittest  | 24 ++--
 src/ais/Makefile.am |  5 -
 src/amf/Makefile.am |  7 +--
 src/base/Makefile.am| 21 +
 src/base/tests/mock_turtle.cc   | 20 
 src/base/tests/mock_turtle.h| 18 ++
 src/base/tests/turtle.h | 17 +
 src/dtm/Makefile.am |  5 -
 src/experimental/immcpp/api/Makefile.am |  5 -
 src/log/Makefile.am |  5 -
 test.sh | 12 +---
 11 files changed, 116 insertions(+), 23 deletions(-)
 create mode 100644 src/base/tests/mock_turtle.cc
 create mode 100644 src/base/tests/mock_turtle.h
 create mode 100644 src/base/tests/turtle.h

diff --git a/00-README.unittest b/00-README.unittest
index 79e4b4b41..f297bccd0 100644
--- a/00-README.unittest
+++ b/00-README.unittest
@@ -1,22 +1,25 @@
-Support for using google unit test in openSAF. Using unit test during e.g. 
refactoring
+Support for using google unit test and google mock in openSAF. Using unit test 
and mocking during e.g. refactoring
 to identify units and make code unit testable should improve the overall code 
quality and robustness.
 Regarding google unit test, see:
 https://code.google.com/p/googletest/
 
 To get and install google test do the following:
 
-wget https://googletest.googlecode.com/files/gtest-1.7.0.zip
-unzip gtest-1.7.0.zip
-cd gtest-1.7.0
-./configure
-make
-export GTEST_DIR=`pwd`
+git clone https://github.com/google/googletest.git
+cd googletest
+
+autoreconf -vi
+./configure --with-pthreads
+make -j 4
+
+export GTEST_DIR=`pwd`/googletest
+export GMOCK_DIR=`pwd`/googlemock
 
 configure openSAF as usual, for example:
 ./bootstrap.ch
 ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" --enable-tipc
 
-make -j
+make -j 4
 
 To build and run the unit tests
 make check
@@ -40,8 +43,9 @@ services/saf/amf/
 └── config
 
 The test code to have the following naming convention as below:
-tests will be in file test_.cc, where  is the name of the unit test 
case,
-e.g test_amfdb.cc. No need to call the RUN_ALL_TESTS() macro, it is included 
in gtest_main 
+tests will be in file _test.cc, where  is the name of the unit test 
case,
+mocks will be in file mock_.cc, where  is the name of the mock.
+No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main and 
gmock_main
 and are automatically linked with the unit test cases.
 
 
diff --git a/src/ais/Makefile.am b/src/ais/Makefile.am
index 1af75a0f4..2ef34b219 100644
--- a/src/ais/Makefile.am
+++ b/src/ais/Makefile.am
@@ -101,7 +101,8 @@ bin_testlib_CXXFLAGS = \
 
 bin_testlib_CPPFLAGS = \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testlib_LDFLAGS = \
$(AM_LDFLAGS)
@@ -112,4 +113,6 @@ bin_testlib_SOURCES = \
 bin_testlib_LDADD = \
$(GTEST_DIR)/lib/libgtest.la \
$(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la \
lib/libopensaf_core.la
diff --git a/src/amf/Makefile.am b/src/amf/Makefile.am
index 25261fded..413571a52 100644
--- a/src/amf/Makefile.am
+++ b/src/amf/Makefile.am
@@ -194,7 +194,8 @@ bin_testamfd_CXXFLAGS =$(AM_CXXFLAGS)
 bin_testamfd_CPPFLAGS = \
-DSA_CLM_B01=1 -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testamfd_LDFLAGS = \
$(AM_LDFLAGS) \
@@ -264,7 +265,9 @@ bin_testamfd_LDADD = \
lib/libSaNtf.la \
lib/libopensaf_core.la \
$(GTEST_DIR)/lib/libgtest.la \
-   $(GTEST_DIR)/lib/libgtest_main.la
+   $(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la
 
 bin_amfpm_CPPFLAGS = \
-DSA_EXTENDED_NAME_SOURCE \
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index bb13d6c43..a7316ceb7 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -150,6 +150,8 @@ noinst_HEADERS += \
src/base/tests/mock_osaf_abort.h \
src/base/tests/mock_osafassert.h \
src/base/tests/mock_syslog.h \
+   src/base/tests/mock_turtle.h \
+   src/base/tests/turtle.h \
src/base/time.h \
src/base/unix_client_socket.h \
src/base/unix_server_socket.h \
@@ -163,7 +165,8 @@ bin_testleap_CXXFLAGS =$(AM_CXXFLAGS)
 bin_testleap_CPPFLAGS = \
-DSA_CLM_B01=1 \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testleap_LDFLAGS = \
$(AM_LDFLAGS)
@@ -175,6 +178,8 @@ bin_testleap_SOURCES = \
 bin_testleap_LDADD = \
$(GTEST_DIR)/lib/libgtest.la \
$(GTEST_DIR)/lib/libgtest_main.la \
+   

[devel] [PATCH 0/1] Review Request for build: Add support for google gmock framework V2 [#2823]

2018-04-03 Thread Hans Nordeback
Summary: build: Add support for google gmock framework V2 [#2823]
Review request for Ticket(s): 2823
Peer Reviewer(s): AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2823
Base revision: b6539a3c61115c33f049a905fc05a899b30191b2
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision 3a278a70fe455cde4cfc2c3d13f163a91f5ff2f7
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Tue, 3 Apr 2018 12:57:57 +0200

build: Add support for google gmock framework V2 [#2823]



Added Files:

 src/base/tests/mock_turtle.cc
 src/base/tests/mock_turtle.h
 src/base/tests/turtle.h


Complete diffstat:
--
 00-README.unittest  | 24 ++--
 src/ais/Makefile.am |  5 -
 src/amf/Makefile.am |  7 +--
 src/base/Makefile.am| 21 +
 src/base/tests/mock_turtle.cc   | 20 
 src/base/tests/mock_turtle.h| 18 ++
 src/base/tests/turtle.h | 17 +
 src/dtm/Makefile.am |  5 -
 src/experimental/immcpp/api/Makefile.am |  5 -
 src/log/Makefile.am |  5 -
 test.sh | 12 +---
 11 files changed, 116 insertions(+), 23 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[devel] [PATCH 0/1] Review Request for build: Add support for google gmock framework [#2823]

2018-04-03 Thread Hans Nordeback
Summary: build: Add support for google gmock framework [#2823]
Review request for Ticket(s): 2823
Peer Reviewer(s): AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2823
Base revision: 5a1d1c4c16a5959a3434089fadac67c6dce92226
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision cdbf86c2db6865ff96268f99e125ee87af59162d
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Tue, 3 Apr 2018 12:35:43 +0200

build: Add support for google gmock framework [#2823]



Added Files:

 src/base/tests/mock_turtle.cc
 src/base/tests/mock_turtle.h
 src/base/tests/turtle.h


Complete diffstat:
--
 00-README.unittest  | 24 ++--
 src/ais/Makefile.am |  5 -
 src/amf/Makefile.am |  7 +--
 src/base/Makefile.am| 21 +
 src/base/tests/mock_turtle.cc   | 20 
 src/base/tests/mock_turtle.h| 18 ++
 src/base/tests/turtle.h | 17 +
 src/dtm/Makefile.am |  5 -
 src/experimental/immcpp/api/Makefile.am |  5 -
 src/log/Makefile.am |  5 -
 test.sh |  6 --
 11 files changed, 111 insertions(+), 22 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[devel] [PATCH 1/1] build: Add support for google gmock framework [#2823]

2018-04-03 Thread Hans Nordeback
---
 00-README.unittest  | 24 ++--
 src/ais/Makefile.am |  5 -
 src/amf/Makefile.am |  7 +--
 src/base/Makefile.am| 21 +
 src/base/tests/mock_turtle.cc   | 20 
 src/base/tests/mock_turtle.h| 18 ++
 src/base/tests/turtle.h | 17 +
 src/dtm/Makefile.am |  5 -
 src/experimental/immcpp/api/Makefile.am |  5 -
 src/log/Makefile.am |  5 -
 test.sh |  6 --
 11 files changed, 111 insertions(+), 22 deletions(-)
 create mode 100644 src/base/tests/mock_turtle.cc
 create mode 100644 src/base/tests/mock_turtle.h
 create mode 100644 src/base/tests/turtle.h

diff --git a/00-README.unittest b/00-README.unittest
index 79e4b4b41..f297bccd0 100644
--- a/00-README.unittest
+++ b/00-README.unittest
@@ -1,22 +1,25 @@
-Support for using google unit test in openSAF. Using unit test during e.g. 
refactoring
+Support for using google unit test and google mock in openSAF. Using unit test 
and mocking during e.g. refactoring
 to identify units and make code unit testable should improve the overall code 
quality and robustness.
 Regarding google unit test, see:
 https://code.google.com/p/googletest/
 
 To get and install google test do the following:
 
-wget https://googletest.googlecode.com/files/gtest-1.7.0.zip
-unzip gtest-1.7.0.zip
-cd gtest-1.7.0
-./configure
-make
-export GTEST_DIR=`pwd`
+git clone https://github.com/google/googletest.git
+cd googletest
+
+autoreconf -vi
+./configure --with-pthreads
+make -j 4
+
+export GTEST_DIR=`pwd`/googletest
+export GMOCK_DIR=`pwd`/googlemock
 
 configure openSAF as usual, for example:
 ./bootstrap.ch
 ./configure CFLAGS="-DRUNASROOT -O2" CXXFLAGS="-DRUNASROOT -O2" --enable-tipc
 
-make -j
+make -j 4
 
 To build and run the unit tests
 make check
@@ -40,8 +43,9 @@ services/saf/amf/
 └── config
 
 The test code to have the following naming convention as below:
-tests will be in file test_.cc, where  is the name of the unit test 
case,
-e.g test_amfdb.cc. No need to call the RUN_ALL_TESTS() macro, it is included 
in gtest_main 
+tests will be in file _test.cc, where  is the name of the unit test 
case,
+mocks will be in file mock_.cc, where  is the name of the mock.
+No need to call the RUN_ALL_TESTS() macro, it is included in gtest_main and 
gmock_main
 and are automatically linked with the unit test cases.
 
 
diff --git a/src/ais/Makefile.am b/src/ais/Makefile.am
index 1af75a0f4..2ef34b219 100644
--- a/src/ais/Makefile.am
+++ b/src/ais/Makefile.am
@@ -101,7 +101,8 @@ bin_testlib_CXXFLAGS = \
 
 bin_testlib_CPPFLAGS = \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testlib_LDFLAGS = \
$(AM_LDFLAGS)
@@ -112,4 +113,6 @@ bin_testlib_SOURCES = \
 bin_testlib_LDADD = \
$(GTEST_DIR)/lib/libgtest.la \
$(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la \
lib/libopensaf_core.la
diff --git a/src/amf/Makefile.am b/src/amf/Makefile.am
index 25261fded..413571a52 100644
--- a/src/amf/Makefile.am
+++ b/src/amf/Makefile.am
@@ -194,7 +194,8 @@ bin_testamfd_CXXFLAGS =$(AM_CXXFLAGS)
 bin_testamfd_CPPFLAGS = \
-DSA_CLM_B01=1 -DSA_EXTENDED_NAME_SOURCE \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testamfd_LDFLAGS = \
$(AM_LDFLAGS) \
@@ -264,7 +265,9 @@ bin_testamfd_LDADD = \
lib/libSaNtf.la \
lib/libopensaf_core.la \
$(GTEST_DIR)/lib/libgtest.la \
-   $(GTEST_DIR)/lib/libgtest_main.la
+   $(GTEST_DIR)/lib/libgtest_main.la \
+   $(GMOCK_DIR)/lib/libgmock.la \
+   $(GMOCK_DIR)/lib/libgmock_main.la
 
 bin_amfpm_CPPFLAGS = \
-DSA_EXTENDED_NAME_SOURCE \
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index bb13d6c43..a7316ceb7 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -150,6 +150,8 @@ noinst_HEADERS += \
src/base/tests/mock_osaf_abort.h \
src/base/tests/mock_osafassert.h \
src/base/tests/mock_syslog.h \
+   src/base/tests/mock_turtle.h \
+   src/base/tests/turtle.h \
src/base/time.h \
src/base/unix_client_socket.h \
src/base/unix_server_socket.h \
@@ -163,7 +165,8 @@ bin_testleap_CXXFLAGS =$(AM_CXXFLAGS)
 bin_testleap_CPPFLAGS = \
-DSA_CLM_B01=1 \
$(AM_CPPFLAGS) \
-   -I$(GTEST_DIR)/include
+   -I$(GTEST_DIR)/include \
+   -I$(GMOCK_DIR)/include
 
 bin_testleap_LDFLAGS = \
$(AM_LDFLAGS)
@@ -175,6 +178,8 @@ bin_testleap_SOURCES = \
 bin_testleap_LDADD = \
$(GTEST_DIR)/lib/libgtest.la \
$(GTEST_DIR)/lib/libgtest_main.la \
+   

[devel] [PATCH 0/1] Review Request for tools: Fix trace2dot, it stopped working after ticket #2165 [#2668]

2018-03-09 Thread Hans Nordeback
Summary: tools: Fix trace2dot, it stopped working after ticket #2165 [#2668]
Review request for Ticket(s): 2668
Peer Reviewer(s): AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2668
Base revision: 30b70f4a56ab0225d3ade3cc8dda3fe403b5492c
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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


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

revision 0e9a107623599596462855ae5ddff45a83427039
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 9 Mar 2018 14:05:52 +0100

tools: Fix trace2dot, it stopped working after ticket #2165 [#2668]



Complete diffstat:
--
 tools/devel/dot/trace2dot | 22 +++---
 1 file 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] tools: Fix trace2dot, it stopped working after ticket #2165 [#2668]

2018-03-09 Thread Hans Nordeback
---
 tools/devel/dot/trace2dot | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/tools/devel/dot/trace2dot b/tools/devel/dot/trace2dot
index 160617c7a..1977276ea 100755
--- a/tools/devel/dot/trace2dot
+++ b/tools/devel/dot/trace2dot
@@ -2,7 +2,7 @@
 #
 #
 # (C) Copyright 2015 The OpenSAF Foundation
-# (C) Copyright Ericsson AB 2015, 2016, 2017. All rights reserved.
+# (C) Copyright Ericsson AB 2015, 2016, 2017, 2018. 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
@@ -59,13 +59,13 @@ def check_infile(trace_file):
 trace_leave = set()
 for line in infile:
 items = line.split()
-if items.__len__() > 6:
-if items[5] == '>>':
-name = items[6].rstrip(':')
+if len(items) > 10:
+if items[9] == '>>':
+name = items[10].rstrip(':')
 trace_enter.add(name)
 
-if items[5] == '<<':
-name = items[6].rstrip(':')
+if items[9] == '<<':
+name = items[10].rstrip(':')
 trace_leave.add(name)
 
 for name in trace_enter:
@@ -86,9 +86,9 @@ def process_infile(infile, from_function, outfile):
 
 for line in infile:
 items = line.split()
-if items.__len__() > 6:
-if items[5] == '>>':
-func_enter = items[6].rstrip(':')
+if len(items) > 10:
+if items[9] == '>>':
+func_enter = items[10].rstrip(':')
 if from_function and not from_func_found:
 if from_function != func_enter:
 continue
@@ -108,8 +108,8 @@ def process_infile(infile, from_function, outfile):
 ' [ordering=out, color=red, shape=box, label="' +
 func_enter + '"];\n')
 
-if items[5] == '<<':
-func_leave = items[6].rstrip(':')
+if items[9] == '<<':
+func_leave = items[10].rstrip(':')
 if from_function:
 if from_function == func_leave:
 break
-- 
2.16.2


--
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 fmd: Wrong unit for FMS_NODE_ISOLATION_TIMEOUT in fmd.conf [#2761]

2018-01-16 Thread Hans Nordeback
Summary: fmd: Wrong unit for FMS_NODE_ISOLATION_TIMEOUT in fmd.conf [#2761]
Review request for Ticket(s): 2761
Peer Reviewer(s): AndersW
Pull request to:
Affected branch(es): develop
Development branch: ticket-2761
Base revision: ff3b16162cac63fab85a111d00eb6c6dfd64f67c
Personal repository: git://git.code.sf.net/u/hansnordeback/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 fbafa0b50ee506200b91311b4cc286d0dc46735a
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Tue, 16 Jan 2018 12:44:46 +0100

fmd: Wrong unit for FMS_NODE_ISOLATION_TIMEOUT in fmd.conf [#2761]



Complete diffstat:
--
 src/fm/fmd/fmd.conf | 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] fmd: Wrong unit for FMS_NODE_ISOLATION_TIMEOUT in fmd.conf [#2761]

2018-01-16 Thread Hans Nordeback
---
 src/fm/fmd/fmd.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fm/fmd/fmd.conf b/src/fm/fmd/fmd.conf
index 63950ef8e..4924abfd9 100644
--- a/src/fm/fmd/fmd.conf
+++ b/src/fm/fmd/fmd.conf
@@ -14,7 +14,7 @@ export FMS_HA_ENV_HEALTHCHECK_KEY="Default"
 export FMS_PROMOTE_ACTIVE_TIMER=0
 
 # To enable self fencing either comment the following line to get a default 
value of 10 seconds,
-# or set an appropriate  timeout value, (unit is seconds).
+# or set an appropriate  timeout value, (unit is milliseconds).
 export FMS_NODE_ISOLATION_TIMEOUT=0
 
 # To enable remote fencing change to 1
-- 
2.15.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 build: Add cpplint filter to allow unapproved C++11 header [#2760]

2018-01-15 Thread Hans Nordeback
Summary: build: Add cpplint filter to allow unapproved C++11 header [#2760]
Review request for Ticket(s): 2760
Peer Reviewer(s): AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2760
Base revision: 5171aad2788d88544d484794f2d9296757ffd782
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

 Docsn
 Build systemy
 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 9e9e55185aead198d18135711356647d20b97d0b
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 15 Jan 2018 12:15:28 +0100

build: Add cpplint filter to allow unapproved C++11 header [#2760]



Added Files:

 CPPLINT.cfg


Complete diffstat:
--
 CPPLINT.cfg | 1 +
 1 file changed, 1 insertion(+)


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  y  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] build: Add cpplint filter to allow unapproved C++11 header [#2760]

2018-01-15 Thread Hans Nordeback
---
 CPPLINT.cfg | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 CPPLINT.cfg

diff --git a/CPPLINT.cfg b/CPPLINT.cfg
new file mode 100644
index 0..532509cd0
--- /dev/null
+++ b/CPPLINT.cfg
@@ -0,0 +1 @@
+filter=-build/c++11
-- 
2.15.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 amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]

2018-01-08 Thread Hans Nordeback
Summary: amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]
Review request for Ticket(s): 2755
Peer Reviewer(s): AMF maintainers
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2755
Base revision: 467a899fad561b498a11b4fca4ede5d136eb15b3
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision e0a73d77beea5dcf9a558074cfc03d1ea3d4dbd7
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 8 Jan 2018 14:37:18 +0100

amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]



Complete diffstat:
--
 src/amf/amfnd/compdb.cc | 13 +++--
 1 file changed, 7 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] amfnd: Improve log message for amf_saImmOmAccessorGet_o2 [#2755]

2018-01-08 Thread Hans Nordeback
---
 src/amf/amfnd/compdb.cc | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/amf/amfnd/compdb.cc b/src/amf/amfnd/compdb.cc
index 1ecd1a1c9..962bbec7d 100644
--- a/src/amf/amfnd/compdb.cc
+++ b/src/amf/amfnd/compdb.cc
@@ -842,15 +842,16 @@ static amf_comp_type_t *avnd_comptype_create(SaImmHandleT 
immOmHandle,
   const char *str;
   const SaImmAttrValuesT_2 **attributes;
   SaNameT saAmfCtSwBundle;
+  SaAisErrorT rc {SA_AIS_OK};
 
   TRACE_ENTER2("'%s'", dn.c_str());
 
   (void)amf_saImmOmAccessorInitialize(immOmHandle, accessorHandle);
 
-  if (amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, dn, nullptr,
-(SaImmAttrValuesT_2 ***)) !=
+  if ((rc = amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, dn, nullptr,
+(SaImmAttrValuesT_2 ***))) !=
   SA_AIS_OK) {
-LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s'", dn.c_str());
+LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s', rc: %u", dn.c_str(), 
rc);
 goto done;
   }
 
@@ -1716,10 +1717,10 @@ int avnd_comp_config_reinit(AVND_COMP *comp) {
 LOG_CR("amf_saImmOmAccessorInitialize FAILED for '%s'", 
comp->name.c_str());
 goto done2;
   }
-  if (amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, comp->name,
-nullptr, (SaImmAttrValuesT_2 ***)) 
!=
+  if ((error = amf_saImmOmAccessorGet_o2(immOmHandle, accessorHandle, 
comp->name,
+nullptr, (SaImmAttrValuesT_2 ***))) 
!=
   SA_AIS_OK) {
-LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s'", comp->name.c_str());
+LOG_ER("amf_saImmOmAccessorGet_o2 FAILED for '%s' rc: %u", 
comp->name.c_str(), error);
 goto done3;
   }
 
-- 
2.15.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] base: Fix opensaf_scale_out script to handle binary arguments [#2703]

2017-11-27 Thread Hans Nordeback
---
 scripts/opensaf_scale_out | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/opensaf_scale_out b/scripts/opensaf_scale_out
index dadb270c3..f9f5cde7a 100644
--- a/scripts/opensaf_scale_out
+++ b/scripts/opensaf_scale_out
@@ -41,7 +41,7 @@ exit 0
 # for node in "$@"
 #  do
 # logger "> [$node]"
-# IFS=","
+# IFS=$CLM_IFS
 # for arg in $node
 #  do
 #logger ">> $arg"
@@ -61,7 +61,7 @@ imm_xml=$tmpdir/imm.xml
 
 immfind -c SaClmNode | sed -e 's/^[^=]*=//;s/,.*$//' > "$nodes_cfg_tmp"
 for node in "$@"; do
-node_name=$(echo "$node" | cut -d"$CLM_IFS" -f2)
+node_name=$(echo "$node" | awk -F "$CLM_IFS" 'BEGIN{RS="$^"} {print $2}')
 echo "$node_name" >> "$nodes_cfg_tmp"
 done
 rm -f "$nodes_cfg"
-- 
2.15.0


--
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 base: Fix opensaf_scale_out script to handle binary arguments [#2703]

2017-11-27 Thread Hans Nordeback
Summary: base: Fix opensaf_scale_out script to handle binary arguments [#2703]
Review request for Ticket(s): 2703
Peer Reviewer(s): AndesW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2703
Base revision: 57459e185890e05fc4035f3d2656b099cc7b9165
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files y
 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 51f95a1e226c1617b9de48b82b3a0242fb3b6f22
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 27 Nov 2017 16:24:05 +0100

base: Fix opensaf_scale_out script to handle binary arguments [#2703]



Complete diffstat:
--
 scripts/opensaf_scale_out | 4 ++--
 1 file changed, 2 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.


--
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] base: Add KillMode=none to opensafd.service [#2706]

2017-11-26 Thread Hans Nordeback
---
 src/nid/opensafd.service.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/nid/opensafd.service.in b/src/nid/opensafd.service.in
index b14890ac2..35f290d8d 100644
--- a/src/nid/opensafd.service.in
+++ b/src/nid/opensafd.service.in
@@ -10,6 +10,7 @@ Type=forking
 PIDFile=@localstatedir@/run/opensaf/osafamfnd.pid
 ControlGroup=cpu:/
 TimeoutStartSec=3hours
+KillMode=none
 
 [Install]
 WantedBy=multi-user.target
-- 
2.15.0


--
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 base: Add KillMode=none to opensafd.service [#2706]

2017-11-26 Thread Hans Nordeback
Summary: base: Add KillMode=none to opensafd.service [#2706]
Review request for Ticket(s): 2706
Peer Reviewer(s): Ravi, Alex, AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2706
Base revision: 57459e185890e05fc4035f3d2656b099cc7b9165
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files y
 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 fcecf7778f15826bf8ca6f14c3cfad4fa835fbc8
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 27 Nov 2017 08:51:48 +0100

base: Add KillMode=none to opensafd.service [#2706]



Complete diffstat:
--
 src/nid/opensafd.service.in | 1 +
 1 file changed, 1 insertion(+)


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] base: Improve logging at daemon exit [#2704]

2017-11-24 Thread Hans Nordeback
---
 src/base/daemon.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/src/base/daemon.c b/src/base/daemon.c
index 27170d779..bfb605093 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -68,6 +68,9 @@ static unsigned int __tracemask;
 static unsigned int __nofork = 0;
 static int __logmask;
 static int fifo_fd = -1;
+static pid_t sending_pid_ = -1;
+static uid_t sending_uid_ = -1;
+
 
 static void install_fatal_signal_handlers(void);
 
@@ -519,8 +522,11 @@ extern uint32_t ncs_sel_obj_ind(NCS_SEL_OBJ *i_ind_obj);
  * TERM signal handler
  * @param sig
  */
-static void sigterm_handler(int sig)
+static void sigterm_handler(int signum, siginfo_t *info, void *ptr)
 {
+   sending_pid_ = info->si_pid;
+   sending_uid_ = info->si_uid;
+
ncs_sel_obj_ind(_sel_obj);
signal(SIGTERM, SIG_IGN);
 }
@@ -534,7 +540,8 @@ static void sigterm_handler(int sig)
  */
 void daemon_exit(void)
 {
-   syslog(LOG_NOTICE, "exiting for shutdown");
+   syslog(LOG_NOTICE, "exiting for shutdown, (sigterm from pid %d uid %d)",
+   sending_pid_, sending_uid_);
 
close(fifo_fd);
 
@@ -551,13 +558,17 @@ void daemon_exit(void)
  */
 void daemon_sigterm_install(int *term_fd)
 {
+   struct sigaction act;
+
if (ncs_sel_obj_create(_sel_obj) != NCSCC_RC_SUCCESS) {
syslog(LOG_ERR, "ncs_sel_obj_create failed");
exit(EXIT_FAILURE);
}
 
-   if (signal(SIGTERM, sigterm_handler) == SIG_ERR) {
-   syslog(LOG_ERR, "signal TERM failed: %s", strerror(errno));
+   act.sa_sigaction = sigterm_handler;
+   act.sa_flags = SA_SIGINFO | SA_RESETHAND;
+   if (sigaction(SIGTERM, , NULL) < 0) {
+   syslog(LOG_ERR, "sigaction TERM failed: %s", strerror(errno));
exit(EXIT_FAILURE);
}
 
-- 
2.15.0


--
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 base: Improve logging at daemon exit [#2704]

2017-11-24 Thread Hans Nordeback
Summary: base: Improve logging at daemon exit [#2704]
Review request for Ticket(s): 2704
Peer Reviewer(s): AndersW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2704
Base revision: b10634edc72a7b4523a1154b87b3c00703e71758
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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


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

revision 87b7ed739d5ea61f24ecf10cfa2e7dc5b82e748f
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 24 Nov 2017 15:23:52 +0100

base: Improve logging at daemon exit [#2704]



Complete diffstat:
--
 src/base/daemon.c | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)


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


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


Conditions of Submission:
-
*** 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 0/1] Review Request for base: Make pylint output format selectable V2 [#2686]

2017-11-17 Thread Hans Nordeback
Summary: base: Make pylint output format selectable V2 [#2686]
Review request for Ticket(s): 2686
Peer Reviewer(s): AndersW, Srinivas, Nguyen
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2686
Base revision: f324f713e986016dd6719cb244e31e59df8fc01d
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision 957601f5b8afb0d1dfc9b76cc58d692b7c1754d3
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 17 Nov 2017 12:32:05 +0100

base: Make pylint output format selectable V2 [#2686]

The output format can now be given, e.g.:

make pylint (defaults to text)
make pylint FORMAT=html
make pylint FORMAT=parseable
make pylint FORMAT=json



Complete diffstat:
--
 Makefile.am   | 4 +++-
 python/README | 8 
 2 files changed, 11 insertions(+), 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] base: Make pylint output format selectable V2 [#2686]

2017-11-17 Thread Hans Nordeback
The output format can now be given, e.g.:

make pylint (defaults to text)
make pylint FORMAT=html
make pylint FORMAT=parseable
make pylint FORMAT=json
---
 Makefile.am   | 4 +++-
 python/README | 8 
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index f6dd784c3..45fc5c207 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,6 +66,8 @@ AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -Wl,--as-needed -ldl -lrt 
-pthread -rdynamic
 ACLOCAL_AMFLAGS = -I m4
 OSAF_LIB_FLAGS =
 
+FORMAT = "text"
+
 systemdversion = $(systemdmodversion)
 #
 # Define some useful directory prefixes/suffixes
@@ -436,7 +438,7 @@ checkpatch:
 
 pylint:
@srcdir=$$(cd $(top_srcdir); pwd; cd - > /dev/null); \
-   cd "$$srcdir/python"; find . -name '*.py' | xargs pylint 
--rcfile=pylintrc --output-format=text > pylint.res; \
+   cd "$$srcdir/python"; find . -name '*.py' | xargs pylint 
--rcfile=pylintrc --output-format=$(FORMAT) > pylint.res; \
true
@echo "The pylint result can be found in the file python/pylint.res"
 
diff --git a/python/README b/python/README
index 798da53db..047a77b2c 100644
--- a/python/README
+++ b/python/README
@@ -228,3 +228,11 @@ for attr in unmarshalNullArray(attrDefs):
unmarshalSaImmValue(attr.attrDefaultValue, attr.attrValueType)
 
 saImmOmClassDescriptionMemoryFree_2(omHandle, attrDefs)
+
+
+To run pylint use the following command:
+
+make pylint (defaults to text)
+make pylint FORMAT=html
+make pylint FORMAT=parseable
+make pylint FORMAT=json
\ No newline at end of file
-- 
2.14.2


--
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] base: Make pylint output format selectable [#2686]

2017-11-17 Thread Hans Nordeback
The output format can now be given, e.g.:

make pylint (defaults to text)
make pylint FORMAT=html
make pylint FORMAT=parseable
make pylint FORMAT=json
---
 Makefile.am   | 2 +-
 python/README | 8 
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index f6dd784c3..84238f1f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -436,7 +436,7 @@ checkpatch:
 
 pylint:
@srcdir=$$(cd $(top_srcdir); pwd; cd - > /dev/null); \
-   cd "$$srcdir/python"; find . -name '*.py' | xargs pylint 
--rcfile=pylintrc --output-format=text > pylint.res; \
+   cd "$$srcdir/python"; find . -name '*.py' | xargs pylint 
--rcfile=pylintrc --output-format=$(FORMAT) > pylint.res; \
true
@echo "The pylint result can be found in the file python/pylint.res"
 
diff --git a/python/README b/python/README
index 798da53db..047a77b2c 100644
--- a/python/README
+++ b/python/README
@@ -228,3 +228,11 @@ for attr in unmarshalNullArray(attrDefs):
unmarshalSaImmValue(attr.attrDefaultValue, attr.attrValueType)
 
 saImmOmClassDescriptionMemoryFree_2(omHandle, attrDefs)
+
+
+To run pylint use the following command:
+
+make pylint (defaults to text)
+make pylint FORMAT=html
+make pylint FORMAT=parseable
+make pylint FORMAT=json
\ No newline at end of file
-- 
2.14.2


--
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 base: Make pylint output format selectable [#2686]

2017-11-17 Thread Hans Nordeback
Summary: base: Make pylint output format selectable [#2686]
Review request for Ticket(s): 2686
Peer Reviewer(s): AndersW, Srinivas, Nguyen
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2686
Base revision: f324f713e986016dd6719cb244e31e59df8fc01d
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision c3abd385a424fd586a011cbcbda22e2fb18aa78b
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 17 Nov 2017 09:44:09 +0100

base: Make pylint output format selectable [#2686]

The output format can now be given, e.g.:

make pylint (defaults to text)
make pylint FORMAT=html
make pylint FORMAT=parseable
make pylint FORMAT=json



Complete diffstat:
--
 Makefile.am   | 2 +-
 python/README | 8 
 2 files changed, 9 insertions(+), 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 0/1] Review Request for clm: Fix clm_user_data to not truncate data V2 [#2684]

2017-11-16 Thread Hans Nordeback
Summary: clm: Fix clm_user_data to not truncate data V2 [#2684]
Review request for Ticket(s): 2684
Peer Reviewer(s): AndersW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2684
Base revision: 6e6eb9df53eb5c089e7032d4b4a1265fe895e23d
Personal repository: git://git.code.sf.net/u/hansnordeback/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 f24e9809ba4a95d00eb3bd55890d05a687e32c1b
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Thu, 16 Nov 2017 15:38:49 +0100

clm: Fix clm_user_data to not truncate data V2 [#2684]



Complete diffstat:
--
 scripts/opensaf_scale_out | 20 +++-
 src/clm/README|  2 +-
 src/clm/clmnd/main.c  |  9 +
 3 files changed, 17 insertions(+), 14 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.


--
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] clm: Fix clm_user_data to not truncate data V2 [#2684]

2017-11-16 Thread Hans Nordeback
---
 scripts/opensaf_scale_out | 20 +++-
 src/clm/README|  2 +-
 src/clm/clmnd/main.c  |  9 +
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/scripts/opensaf_scale_out b/scripts/opensaf_scale_out
index c7e902553..714d0b8b4 100644
--- a/scripts/opensaf_scale_out
+++ b/scripts/opensaf_scale_out
@@ -36,15 +36,17 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 exit 0
 
 # Env variable CLM_IFS contains field separator for the
-# input argument, example on usage:
-# if [ -n "$CLM_IFS" ]; then
-#IFS=$CLM_IFS
-#logger "Using ifs [$IFS]"
-# fi
-#
-# for arg in "$@"
-# do
-#logger "> [$arg]"
+# input argument, for example:
+# save_ifs=IFS
+# for node in "$@"
+#  do
+# logger "> [$node]"
+# IFS=","
+# for arg in $node
+#  do
+#logger ">> $arg"
+#  done
+# IFS=$save_ifs
 # done
 
 tmpdir=$(mktemp -d -t opensaf_scale_out.XX)
diff --git a/src/clm/README b/src/clm/README
index 50e683ca5..d2dada18c 100644
--- a/src/clm/README
+++ b/src/clm/README
@@ -75,7 +75,7 @@ entries may be added to the comma-separated list. The first 
entry in the list
 is the node id represented as a decimal number. The second entry in the list is
 the name of the node. The third entry is the IP address of the node. The fourth
 entry is optional user data that can be entered in a file named
-/etc/opensaf/clm_user_data, up to 256 characters can be given.
+/etc/opensaf/clm_user_data, up to 255 characters can be given.
 
 NOTE: the script must be idempotent, i.e. it must be harmless to call it more
 than one time with the same parameters. The second call should do nothing since
diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 8b8eebc14..45f4d2f27 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -582,11 +582,12 @@ static void get_user_data(NODE_INFO *node)
return;
}
 
-   if (fgets((char*) node->user_data.value, sizeof(node->user_data.value),
-   fp) != NULL) {
-   node->user_data.length = strnlen((char *)node->user_data.value,
-   sizeof(node->user_data.value));
+   size_t size = fread((char*) node->user_data.value, sizeof(char),
+   sizeof(node->user_data.value) - 1, fp);
+   if (size > 0) {
+   node->user_data.length = size;
} else {
+   node->user_data.length = 0;
LOG_WA("Could not read file %s", PKGSYSCONFDIR 
"/clm_user_data");
}
 
-- 
2.14.2


--
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 clm: Fix clm_user_data to not truncate data [#2684]

2017-11-16 Thread Hans Nordeback
Summary: clm: Fix clm_user_data to not truncate data [#2684]
Review request for Ticket(s): 2684
Peer Reviewer(s): AndersW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2684
Base revision: 6e6eb9df53eb5c089e7032d4b4a1265fe895e23d
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision dec6c1f850cd5f103d734db7ebabe875b4264b92
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Thu, 16 Nov 2017 15:23:18 +0100

clm: Fix clm_user_data to not truncate data [#2684]



Complete diffstat:
--
 scripts/opensaf_scale_out | 20 +++-
 src/clm/README|  2 +-
 src/clm/clmnd/main.c  |  7 +++
 3 files changed, 15 insertions(+), 14 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.


--
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] clm: Fix clm_user_data to not truncate data [#2684]

2017-11-16 Thread Hans Nordeback
---
 scripts/opensaf_scale_out | 20 +++-
 src/clm/README|  2 +-
 src/clm/clmnd/main.c  |  7 +++
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/scripts/opensaf_scale_out b/scripts/opensaf_scale_out
index c7e902553..714d0b8b4 100644
--- a/scripts/opensaf_scale_out
+++ b/scripts/opensaf_scale_out
@@ -36,15 +36,17 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 exit 0
 
 # Env variable CLM_IFS contains field separator for the
-# input argument, example on usage:
-# if [ -n "$CLM_IFS" ]; then
-#IFS=$CLM_IFS
-#logger "Using ifs [$IFS]"
-# fi
-#
-# for arg in "$@"
-# do
-#logger "> [$arg]"
+# input argument, for example:
+# save_ifs=IFS
+# for node in "$@"
+#  do
+# logger "> [$node]"
+# IFS=","
+# for arg in $node
+#  do
+#logger ">> $arg"
+#  done
+# IFS=$save_ifs
 # done
 
 tmpdir=$(mktemp -d -t opensaf_scale_out.XX)
diff --git a/src/clm/README b/src/clm/README
index 50e683ca5..d2dada18c 100644
--- a/src/clm/README
+++ b/src/clm/README
@@ -75,7 +75,7 @@ entries may be added to the comma-separated list. The first 
entry in the list
 is the node id represented as a decimal number. The second entry in the list is
 the name of the node. The third entry is the IP address of the node. The fourth
 entry is optional user data that can be entered in a file named
-/etc/opensaf/clm_user_data, up to 256 characters can be given.
+/etc/opensaf/clm_user_data, up to 255 characters can be given.
 
 NOTE: the script must be idempotent, i.e. it must be harmless to call it more
 than one time with the same parameters. The second call should do nothing since
diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 8b8eebc14..a5534f936 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -582,10 +582,9 @@ static void get_user_data(NODE_INFO *node)
return;
}
 
-   if (fgets((char*) node->user_data.value, sizeof(node->user_data.value),
-   fp) != NULL) {
-   node->user_data.length = strnlen((char *)node->user_data.value,
-   sizeof(node->user_data.value));
+   size_t size = fread((char*) node->user_data.value, sizeof(char), 
sizeof(node->user_data.value) - 1, fp);
+   if (size > 0) {
+   node->user_data.length = size;
} else {
LOG_WA("Could not read file %s", PKGSYSCONFDIR 
"/clm_user_data");
}
-- 
2.14.2


--
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 base: Add TimeoutStartSec to opensafd.service [#2678]

2017-11-10 Thread Hans Nordeback
Summary: base: Add TimeoutStartSec to opensafd.service [#2678]
Review request for Ticket(s): 2678
Peer Reviewer(s): AndersW, Alex, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2678
Base revision: 27b0a983d08de94e390aa811b8971e0a82059b80
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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


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

revision 435db978f4f47b8f760847cca985aa89d9628dae
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 10 Nov 2017 12:03:22 +0100

base: Add TimeoutStartSec to opensafd.service [#2678]



Complete diffstat:
--
 src/nid/opensafd.service.in | 1 +
 1 file changed, 1 insertion(+)


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] base: Add TimeoutStartSec to opensafd.service [#2678]

2017-11-10 Thread Hans Nordeback
---
 src/nid/opensafd.service.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/nid/opensafd.service.in b/src/nid/opensafd.service.in
index 2698f796f..2dce10145 100644
--- a/src/nid/opensafd.service.in
+++ b/src/nid/opensafd.service.in
@@ -9,6 +9,7 @@ ExecStop=@initscriptdir@/opensafd stop
 Type=forking
 PIDFile=@localstatedir@/run/opensaf/osafamfnd.pid
 ControlGroup=cpu:/
+TimeoutStartSec=infinity
 
 [Install]
 WantedBy=multi-user.target
-- 
2.14.2


--
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 clm: WA Two active controllers observed at cluster [#2677]

2017-11-10 Thread Hans Nordeback
Summary: clm: WA Two active controllers observed at cluster [#2677]
Review request for Ticket(s): 2677
Peer Reviewer(s): AndersW, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2677
Base revision: 27b0a983d08de94e390aa811b8971e0a82059b80
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision c6fa67095dfcb65d8eb390f080e421e73100dfbf
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 10 Nov 2017 09:21:36 +0100

clm: WA Two active controllers observed at cluster [#2677]

With current #2542 solution there is a window in the nid phase when
reboots are overlapped leading to two active controllers . This patch solves 
this problem.



Complete diffstat:
--
 00-README.conf  | 11 ++-
 src/base/osaf_utility.c | 44 
 src/base/osaf_utility.h |  5 +
 src/clm/clmnd/main.c|  1 +
 src/nid/nodeinit.cc |  2 ++
 5 files changed, 62 insertions(+), 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] clm: WA Two active controllers observed at cluster [#2677]

2017-11-10 Thread Hans Nordeback
With current #2542 solution there is a window in the nid phase when
reboots are overlapped leading to two active controllers . This patch solves 
this problem.
---
 00-README.conf  | 11 ++-
 src/base/osaf_utility.c | 44 
 src/base/osaf_utility.h |  5 +
 src/clm/clmnd/main.c|  1 +
 src/nid/nodeinit.cc |  2 ++
 5 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/00-README.conf b/00-README.conf
index 630660e3e..5861f1089 100644
--- a/00-README.conf
+++ b/00-README.conf
@@ -643,4 +643,13 @@ If the latency exceeds 4 seconds a sigalrm will be sent 
and the process will be
 # echo 100 >  /proc/sys/net/ipv4/igmp_max_memberships
 # To collect gcov data compile and use program 
tools/devel/gcov_collect/osaf_gcov_dump.c.
 # Check the MULTICAST_PORT and MULTICAST_GROUP settings are the same as 
multicast group and port
-# above.
\ No newline at end of file
+# above.
+
+If clm adm command for cluster reboot is issued an environment variable
+OPENSAF_CLUSTER_REBOOT_WAIT_TIME_SEC can be set in opensafd script to specify
+the time to wait for nodes to be started, except for the active node.
+Default is 3 seconds. A file, "clm_cluster_reboot_in_progress", is created
+on each node, except on the active node. This file indicates that a cluster
+reboot is in progress and all nodes needs to delay their start, this to give
+the active a lead.
+
diff --git a/src/base/osaf_utility.c b/src/base/osaf_utility.c
index f19871139..fc321dbc7 100644
--- a/src/base/osaf_utility.c
+++ b/src/base/osaf_utility.c
@@ -23,10 +23,54 @@
 #include 
 #include 
 #include 
+
+#include 
+#include 
+#include 
+#include 
 #include "base/ncssysf_def.h"
 #include "base/osaf_time.h"
 #include "osaf/configmake.h"
 
+void osaf_wait_for_active_to_start(void)
+{
+   struct stat statbuf;
+   static char file[NAME_MAX];
+   const char *wait_time_str = NULL;
+   unsigned int wait_time = kDfltClusterRebootWaitTimeSec;
+
+   if ((wait_time_str = getenv("OPENSAF_CLUSTER_REBOOT_WAIT_TIME_SEC")) != 
NULL) {
+   wait_time = strtol(wait_time_str, NULL, 0);
+   }
+   snprintf(file, sizeof(file), PKGLOGDIR "/%s", 
kClmClusterRebootInProgress);
+
+   if (stat(file, ) != 0) {
+   syslog(LOG_NOTICE, "Reboot file %s not found, startup 
continue...", file);
+   return;
+   }
+
+   syslog(LOG_NOTICE, "Cluster reboot in progress, this node will start in 
%u second(s)", wait_time);
+
+   sleep(wait_time);
+
+   if (unlink(file) == -1) {
+   syslog(LOG_ERR, "cannot remove file %s: %s", file, 
strerror(errno));
+   }
+}
+
+void osaf_create_cluster_reboot_in_progress_file(void)
+{
+   static char file[NAME_MAX];
+   snprintf(file, sizeof(file), PKGLOGDIR "/%s", 
kClmClusterRebootInProgress);
+   int fd;
+
+   if ((fd = open(file, O_RDWR | O_CREAT, 0644)) < 0) {
+   syslog(LOG_ERR, "Open %s failed, %s", file, strerror(errno));
+   return;
+   }
+   close(fd);
+}
+
 void osaf_abort(long i_cause)
 {
syslog(LOG_ERR, "osaf_abort(%ld) called from %p with errno=%d", i_cause,
diff --git a/src/base/osaf_utility.h b/src/base/osaf_utility.h
index b935c5003..825cf07d2 100644
--- a/src/base/osaf_utility.h
+++ b/src/base/osaf_utility.h
@@ -30,6 +30,8 @@
 extern "C" {
 #endif
 
+#define kClmClusterRebootInProgress "clm_cluster_reboot_in_progress"
+enum { kDfltClusterRebootWaitTimeSec = 3 };
 enum { kOsafUseSafeReboot = 1 };
 
 /**
@@ -71,6 +73,9 @@ extern void osaf_abort(long i_cause) __attribute__((
 
 extern void osaf_safe_reboot(void) __attribute__((nothrow));
 
+extern void osaf_wait_for_active_to_start(void);
+extern void osaf_create_cluster_reboot_in_progress_file(void);
+
 static inline void osaf_mutex_lock_ordie(pthread_mutex_t* io_mutex) {
   int result = pthread_mutex_lock(io_mutex);
   if (result != 0) osaf_abort(result);
diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 926c5b718..fa46b780f 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -125,6 +125,7 @@ static uint32_t clmna_mds_dec(struct ncsmds_callback_info 
*info)
// Reboot will be performed by CLMS for this node.
if (clmna_cb->node_info.node_id !=
msg->info.reboot_info.node_id) {
+   osaf_create_cluster_reboot_in_progress_file();
osaf_safe_reboot();
}
break;
diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc
index 9eddd743d..5a4b73cc6 100644
--- a/src/nid/nodeinit.cc
+++ b/src/nid/nodeinit.cc
@@ -1625,6 +1625,8 @@ int main(int argc, char *argv[]) {
 
   TRACE_ENTER();
 
+  osaf_wait_for_active_to_start();
+
 #ifdef RLIMIT_RTPRIO
   struct rlimit mylimit;
   mylimit.rlim_max = mylimit.rlim_cur = sched_get_priority_max(SCHED_RR);
-- 
2.14.2


--
Check out the 

[devel] [PATCH 1/1] dtm: Fix segv in osafdtmd [#2669]

2017-11-07 Thread Hans Nordeback
---
 src/dtm/dtmnd/dtm_main.cc | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/dtm/dtmnd/dtm_main.cc b/src/dtm/dtmnd/dtm_main.cc
index f8d7e531a..cf0b81f8a 100644
--- a/src/dtm/dtmnd/dtm_main.cc
+++ b/src/dtm/dtmnd/dtm_main.cc
@@ -282,21 +282,21 @@ int main(int argc, char *argv[]) {
   }
 
   /*/
-  /* Set up the initial node_discovery_task  */
+  /* Set up the initialservice_discovery_task */
   /*/
-  rc = dtm_node_discovery_task_create();
+  rc = dtm_service_discovery_init(dtms_cb);
   if (NCSCC_RC_SUCCESS != rc) {
-LOG_ER("DTM: node_discovery thread CREATE failed rc : %d ", rc);
-goto done2;
+LOG_ER("DTM:service_discovery thread CREATE failed rc : %d ", rc);
+goto done1;
   }
 
   /*/
-  /* Set up the initialservice_discovery_task */
+  /* Set up the initial node_discovery_task  */
   /*/
-  rc = dtm_service_discovery_init(dtms_cb);
+  rc = dtm_node_discovery_task_create();
   if (NCSCC_RC_SUCCESS != rc) {
-LOG_ER("DTM:service_discovery thread CREATE failed rc : %d ", rc);
-goto done1;
+LOG_ER("DTM: node_discovery thread CREATE failed rc : %d ", rc);
+goto done2;
   }
 
   rc = nid_notify("TRANSPORT", NCSCC_RC_SUCCESS, nullptr);
-- 
2.14.2


--
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 dtm: Fix segv in osafdtmd [#2669]

2017-11-07 Thread Hans Nordeback
Summary: dtm: Fix segv in osafdtmd [#2669]
Review request for Ticket(s): 2669
Peer Reviewer(s): AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2669
Base revision: 39ff6baecdda95d205d251c7fa33971dc22503c1
Personal repository: git://git.code.sf.net/u/hansnordeback/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 e5df4618bd987df0362cb2a8207417dcfc59a813
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Tue, 7 Nov 2017 13:39:31 +0100

dtm: Fix segv in osafdtmd [#2669]



Complete diffstat:
--
 src/dtm/dtmnd/dtm_main.cc | 16 
 1 file changed, 8 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 0/1] Review Request for clm: Fix unexpected join response error when executing immadm -o 4, 5 commands [#2661]

2017-11-01 Thread Hans Nordeback
Summary: clm: Fix unexpected join response error when executing immadm -o 4, 5 
commands [#2661]
Review request for Ticket(s): 2661
Peer Reviewer(s): Ravi, Zoran, AndersW
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2661
Base revision: 36be8313c70f110d1245fc76980b53c7ea45770a
Personal repository: git://git.code.sf.net/u/hansnordeback/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 95fbfe4510da88f6424d2a2beb64a9576333f612
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Wed, 1 Nov 2017 16:16:10 +0100

clm: Fix unexpected join response error when executing immadm -o 4, 5 commands 
[#2661]



Complete diffstat:
--
 src/clm/clmnd/main.c | 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.


--
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] clm: Fix unexpected join response error when executing immadm -o 4, 5 commands [#2661]

2017-11-01 Thread Hans Nordeback
---
 src/clm/clmnd/main.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 926c5b718..948703426 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -215,6 +215,13 @@ static uint32_t clmna_mds_dec_flat(struct 
ncsmds_callback_info *info)
 static uint32_t clmna_mds_rcv(struct ncsmds_callback_info *mds_cb_info)
 {
CLMSV_MSG *msg = (CLMSV_MSG *)mds_cb_info->info.receive.i_msg;
+
+   if (msg->evt_type == CLMSV_CLMS_TO_CLMNA_REBOOT_MSG ||
+   msg->evt_type == CLMSV_CLMS_TO_CLMNA_NODE_REBOOT_MSG ||
+   msg->evt_type == CLMSV_CLMS_TO_CLMNA_ACTION_MSG) {
+   return NCSCC_RC_SUCCESS;
+   }
+
CLMNA_EVT *evt = calloc(1, sizeof(CLMNA_EVT));
evt->type = CLMNA_EVT_JOIN_RESPONSE;
evt->join_response.rc = msg->info.api_resp_info.rc;
-- 
2.14.2


--
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 amfnd: fix segv in ncs_tmr_stop V2 [#2658]

2017-10-30 Thread Hans Nordeback
Summary: amfnd: fix segv in ncs_tmr_stop V2 [#2658]
Review request for Ticket(s): 2658
Peer Reviewer(s): Gary, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2658
Base revision: a46627453d9fcadc67f651bbb3d8560dccdc57c7
Personal repository: git://git.code.sf.net/u/hansnordeback/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 553ce52d7f1026923a8b72a4cea4d8a13af70d94
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 30 Oct 2017 15:50:12 +0100

amfnd: fix segv in ncs_tmr_stop V2 [#2658]



Complete diffstat:
--
 src/amf/amfnd/di.cc | 3 ++-
 1 file changed, 2 insertions(+), 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] amfnd: fix segv in ncs_tmr_stop V2 [#2658]

2017-10-30 Thread Hans Nordeback
---
 src/amf/amfnd/di.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc
index 7aac34260..2043c6064 100644
--- a/src/amf/amfnd/di.cc
+++ b/src/amf/amfnd/di.cc
@@ -1300,13 +1300,14 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) 
{
 
 // matching record
 if (msg_id == mid) {
+  cb->dnd_list.erase(iter);
+  // iter is now invalid, exit iterator loop asap
   if (rec->msg.info.avd->msg_type == AVSV_N2D_NODE_DOWN_MSG) {
 // first to stop timer to avoid processing timeout event
 // then perform last step clean up
 avnd_stop_tmr(cb, >resp_tmr);
 avnd_last_step_clean(cb);
   }
-  cb->dnd_list.erase(iter);
   TRACE("remove msg %u from queue", msg_id);
   avnd_diq_rec_del(cb, rec);
   break;
-- 
2.14.2


--
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 amfnd: fix segv in ncs_tmr_stop [#2658]

2017-10-27 Thread Hans Nordeback
Summary: amfnd: fix segv in ncs_tmr_stop [#2658]
Review request for Ticket(s): 2658
Peer Reviewer(s): Gary, Minh, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2658
Base revision: d8de354eb803664c7ad9389071f7be624b237aa9
Personal repository: git://git.code.sf.net/u/hansnordeback/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 2210f4fdaae570fb9f8e4ef6bd180fab9d11bc41
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 27 Oct 2017 17:30:26 +0200

amfnd: fix segv in ncs_tmr_stop [#2658]



Complete diffstat:
--
 src/amf/amfnd/di.cc | 7 +--
 1 file changed, 5 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] amfnd: fix segv in ncs_tmr_stop [#2658]

2017-10-27 Thread Hans Nordeback
---
 src/amf/amfnd/di.cc | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc
index 7aac34260..6e5aaf54b 100644
--- a/src/amf/amfnd/di.cc
+++ b/src/amf/amfnd/di.cc
@@ -1293,7 +1293,9 @@ uint32_t avnd_di_node_down_msg_send(AVND_CB *cb)
 void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) {
   TRACE_ENTER2("%u", mid);
 
-  for (auto iter =  cb->dnd_list.begin(); iter != cb->dnd_list.end(); ++iter) {
+  std::vector tmp = cb->dnd_list;
+
+  for (auto iter =  tmp.begin(); iter != tmp.end(); ++iter) {
 auto rec = *iter;
 osafassert(rec->msg.type == AVND_MSG_AVD);
 const uint32_t msg_id = 
*(reinterpret_cast(&(rec->msg.info.avd->msg_info)));
@@ -1306,12 +1308,13 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) 
{
 avnd_stop_tmr(cb, >resp_tmr);
 avnd_last_step_clean(cb);
   }
-  cb->dnd_list.erase(iter);
+  tmp.erase(iter);
   TRACE("remove msg %u from queue", msg_id);
   avnd_diq_rec_del(cb, rec);
   break;
 }
   }
+  cb->dnd_list = tmp;
 
   TRACE_LEAVE2();
   return;
-- 
2.14.2


--
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 pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]

2017-10-23 Thread Hans Nordeback
Summary: pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]
Review request for Ticket(s): 2636
Peer Reviewer(s): AndersW, Srinivas, Nguyen
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2636
Base revision: e775385d9e20175f6cb0a1efa94a6f4f1fe3d337
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision bd05358407b2f11cfaeb76163993b9a1ba8fabe4
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Mon, 23 Oct 2017 14:07:09 +0200

pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]



Added Files:

 python/pylintrc


Complete diffstat:
--
 Makefile.am |   9 +-
 python/pylintrc | 381 
 2 files changed, 389 insertions(+), 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] pyosaf: Create a pylint makefile target for pyosaf V2 [#2636]

2017-10-23 Thread Hans Nordeback
---
 Makefile.am |   9 +-
 python/pylintrc | 381 
 2 files changed, 389 insertions(+), 1 deletion(-)
 create mode 100644 python/pylintrc

diff --git a/Makefile.am b/Makefile.am
index a7548d274..f9ba87b35 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -429,7 +429,14 @@ checkpatch:
perl "$$builddir/bin/checkpatch.pl" --no-tree --file --ignore 
SPLIT_STRING --summary-file $$(cat "$$builddir/checkpatch_files.txt") 1>&2; \
true
 
-.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch
+pylint:
+   @srcdir=$$(cd $(top_srcdir); pwd; cd - > /dev/null); \
+   cd "$$srcdir/python"; find . -name '*.py' | xargs pylint 
--rcfile=pylintrc --output-format=html > pylint.html; \
+   true
+   @echo "The pylint result can be found in the file python/pylint.html"
+   @echo "Use the follwing command to view it: firefox python/pylint.html"
+
+.PHONY: cppcheck.xml cppcheck cpplint shellcheck checkpatch pylint
 
 clean-local:
-rm -f $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.gz
diff --git a/python/pylintrc b/python/pylintrc
new file mode 100644
index 0..c4d2e222d
--- /dev/null
+++ b/python/pylintrc
@@ -0,0 +1,381 @@
+[MASTER]
+
+# Specify a configuration file.
+#rcfile=
+
+# Python code to execute, usually for sys.path manipulation such as
+# pygtk.require().
+#init-hook=
+
+# Profiled execution.
+# option profile is obsolete and it is slated for removal in Pylint 1.6.
+# profile=no
+
+# Add files or directories to the blacklist. They should be base names, not
+# paths.
+ignore=CVS
+
+# Pickle collected data for later comparisons.
+persistent=yes
+
+# List of plugins (as comma separated values of python modules names) to load,
+# usually to register additional checkers.
+load-plugins=
+
+# Use multiple processes to speed up Pylint.
+jobs=1
+
+# Allow loading of arbitrary C extensions. Extensions are imported into the
+# active Python interpreter and may run arbitrary code.
+unsafe-load-any-extension=no
+
+# A comma-separated list of package or module names from where C extensions may
+# be loaded. Extensions are loading into the active Python interpreter and may
+# run arbitrary code
+extension-pkg-whitelist=
+
+# Allow optimization of some AST trees. This will activate a peephole AST
+# optimizer, which will apply various small optimizations. For instance, it can
+# be used to obtain the result of joining multiple strings with the addition
+# operator. Joining a lot of strings can lead to a maximum recursion error in
+# Pylint and this flag can prevent that. It has one side effect, the resulting
+# AST will be different than the one from reality.
+optimize-ast=no
+
+
+[MESSAGES CONTROL]
+
+# Only show warnings with the listed confidence levels. Leave empty to show
+# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED
+confidence=
+
+# Enable the message, report, category or checker with the given id(s). You can
+# either give multiple identifier separated by comma (,) or put this option
+# multiple time. See also the "--disable" option for examples.
+#enable=
+
+# Disable the message, report, category or checker with the given id(s). You
+# can either give multiple identifiers separated by comma (,) or put this
+# option multiple times (only on the command line, not in the configuration
+# file where it should appear only once).You can also use "--disable=all" to
+# disable everything first and then reenable specific checks. For example, if
+# you want to run only the similarities checker, you can use "--disable=all
+# --enable=similarities". If you want to run only the classes checker, but have
+# no Warning level messages displayed, use"--disable=all --enable=classes
+# --disable=W"
+#
+# Added "W0105": pointless-string-statement
+# Added "W0511": Used when a warning note as FIXME or XXX is detected.
+# Added "W0511": Used when a warning note as FIXME or XXX is detected.
+#disable=W0511,W0105,E1608,W1627,E1601,E1603,E1602,E1605,E1604,E1607,E1606,W1621,W1620,W1623,W1622,W1625,W1624,W1609,#W1608,W1607,W1606,W1605,W1604,W1603,W1602,W1601,W1639,W1640,I0021,W1638,I0020,W1618,W1619,W1630,W1626,W1637,W1634,W1#635,W1610,W1611,W1612,W1613,W1614,W1615,W1616,W1617,W1632,W1633,W0704,W1628,W1629,W1636
+
+
+[REPORTS]
+
+# Set the output format. Available formats are text, parseable, colorized, msvs
+# (visual studio) and html. You can also give a reporter class, eg
+# mypackage.mymodule.MyReporterClass.
+# output-format=text
+
+# Put messages in a separate file for each module / package specified on the
+# command line instead of printing them on stdout. Reports (if any) will be
+# written in a file name "pylint_global.[txt|html]".
+files-output=no
+
+# Tells whether to display a full report or only the messages
+reports=yes
+
+# Python expression which should return a note less than 10 (10 is the highest
+# note). You have access to the variables errors warning, statement which
+# respectively contain the number of 

[devel] [PATCH 0/1] Review Request for base: Add IPv6 support to gcov collect [#2620]

2017-10-06 Thread Hans Nordeback
Summary: base: Add IPv6 support to gcov collect [#2620]
Review request for Ticket(s): 2620
Peer Reviewer(s): AnderW, Lennart, Ravi
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2620
Base revision: 44d113c4fa669065afe78d70bc81c5297d79ec0e
Personal repository: git://git.code.sf.net/u/hansnordeback/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

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

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

revision b3035d08020fc96af12578e732d7ed5fa91258e8
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 6 Oct 2017 16:03:24 +0200

base: Add IPv6 support to gcov collect [#2620]



Added Files:

 src/base/osaf_gcov.c
 src/base/osaf_gcov.h


Complete diffstat:
--
 00-README.conf|   3 +
 src/base/Makefile.am  |   1 +
 src/base/daemon.c |  87 +
 src/base/osaf_gcov.c  | 199 ++
 src/base/osaf_gcov.h  |  40 ++
 src/nid/opensafd.in   |   3 +
 tools/devel/gcov_collect/osaf_gcov_dump.c | 110 ++---
 7 files changed, 343 insertions(+), 100 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

[devel] [PATCH 1/1] base: Add IPv6 support to gcov collect [#2620]

2017-10-06 Thread Hans Nordeback
---
 00-README.conf|   3 +
 src/base/Makefile.am  |   1 +
 src/base/daemon.c |  87 +
 src/base/osaf_gcov.c  | 199 ++
 src/base/osaf_gcov.h  |  40 ++
 src/nid/opensafd.in   |   3 +
 tools/devel/gcov_collect/osaf_gcov_dump.c | 110 ++---
 7 files changed, 343 insertions(+), 100 deletions(-)
 create mode 100644 src/base/osaf_gcov.c
 create mode 100644 src/base/osaf_gcov.h

diff --git a/00-README.conf b/00-README.conf
index b67da8ee7..0cbc778ab 100644
--- a/00-README.conf
+++ b/00-README.conf
@@ -615,7 +615,10 @@ If the latency exceeds 4 seconds a sigalrm will be sent 
and the process will be
 # To enable gcov run ./configure --enable-gcov
 # In each daemon a thread will be created that listens to a default multicast 
group 239.0.0.1 port 4712.
 # To change default, update /etc/init.d/opensafd setup_env function, example:
+# IPv4:
 # export OPENSAF_GCOV_MULTICAST_GROUP="224.0.0.1"
+# IPv6:
+# export OPENSAF_GCOV_MULTICAST_GROUP="ff02::1"
 # export OPENSAF_GCOV_MULTICAST_PORT="4711"
 # and if running in UML uncomment the line:
 # echo 100 >  /proc/sys/net/ipv4/igmp_max_memberships
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index f278a8ffb..4717af863 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -60,6 +60,7 @@ lib_libopensaf_core_la_SOURCES += \
src/base/osaf_timerfd.c \
src/base/osaf_unicode.c \
src/base/osaf_utility.c \
+   src/base/osaf_gcov.c \
src/base/patricia.c \
src/base/process.cc \
src/base/saf_edu.c \
diff --git a/src/base/daemon.c b/src/base/daemon.c
index c1efbce00..47684d611 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -19,9 +19,6 @@
 #include "osaf/config.h"
 #endif
 
-#include 
-#include 
-#include 
 #include 
 #include 
 #include 
@@ -53,6 +50,10 @@
 #include "base/osaf_secutil.h"
 #include "base/osaf_time.h"
 
+#ifdef ENABLE_GCOV
+#include "base/osaf_gcov.h"
+#endif
+
 #include 
 #include 
 
@@ -73,86 +74,6 @@ static int fifo_fd = -1;
 
 static void install_fatal_signal_handlers(void);
 
-#ifdef ENABLE_GCOV
-
-// default multicast group for gcov collection
-#define DFLT_MULTICAST_GROUP "239.0.0.1"
-
-extern void __gcov_dump();
-extern void __gcov_reset();
-
-static void* gcov_flush_thread(void* arg) {
-   int listenfd;
-   const int on = 1;
-   struct sockaddr_in servaddr;
-   struct ip_mreq mreq;
-   char buf[40];
-   struct sockaddr_in addr;
-   socklen_t addr_len;
-   int multicast_port = 4712; // default multicast group for gcov 
collection
-   const char *multicast_port_str;
-   const char *multicast_group;
-
-   if ((multicast_group = getenv("OPENSAF_GCOV_MULTICAST_GROUP")) == NULL) 
{
-   multicast_group = DFLT_MULTICAST_GROUP;
-   }
-
-   if ((multicast_port_str = getenv("OPENSAF_GCOV_MULTICAST_PORT")) != 
NULL) {
-   multicast_port = strtol(multicast_port_str, NULL, 0);
-   }
-
-   listenfd = socket(AF_INET, SOCK_DGRAM, 0);
-
-   if ((setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, , sizeof(on)) == 
-1)) {
-   syslog(LOG_ERR, "%s: setsockpot failed: %s", __FUNCTION__, 
strerror(errno));
-   return 0;
-   }
-
-   memset(, 0, sizeof(servaddr));
-   servaddr.sin_family = AF_INET;
-   servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
-   servaddr.sin_port = htons(multicast_port);
-
-   if (bind(listenfd, (struct sockaddr*) , sizeof(servaddr)) < 0) 
{
-   syslog(LOG_ERR, "%s: bind failed: %s", __FUNCTION__, 
strerror(errno));
-   return 0;
-   }
-
-   mreq.imr_multiaddr.s_addr=inet_addr(multicast_group);
-   mreq.imr_interface.s_addr=htonl(INADDR_ANY);
-   if (setsockopt(listenfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, , 
sizeof(mreq)) < 0) {
-   syslog(LOG_ERR, "%s: setsockopt failed: %s", __FUNCTION__, 
strerror(errno));
-   return 0;
-   } else {
-   syslog(LOG_NOTICE, "%s: joined multicast group %s port %d\n",
-   __FUNCTION__, multicast_group, multicast_port);
-   }
-
-   for(;;) {
-   addr_len = sizeof(addr);
-   recvfrom(listenfd, , sizeof(buf), 0, (struct sockaddr *) 
, _len);
-   __gcov_dump();
-   __gcov_reset();
-   syslog(LOG_NOTICE, "__gov_dump() and __gcov_reset() called");
-   }
-   return 0;
-}
-
-static void create_gcov_flush_thread(void) {
-   pthread_t thread;
-   pthread_attr_t attr;
-   pthread_attr_init();
-   pthread_attr_setdetachstate(, PTHREAD_CREATE_DETACHED);
-
-   if (pthread_create(, , gcov_flush_thread, 0) != 0) {
-   syslog(LOG_ERR, "pthread_create FAILED: %s", strerror(errno));
-   }
-
-   pthread_attr_destroy();
-}
-
-#endif
-
 static void 

[devel] [PATCH 0/1] Review Request for clm: Add user data in CLMSV_CLUSTER_JOIN_REQ message V2 [#2590]

2017-10-06 Thread Hans Nordeback
Summary: clm: Add user data in CLMSV_CLUSTER_JOIN_REQ message V2 [#2590]
Review request for Ticket(s): 2590
Peer Reviewer(s): AndersW, Srinivas
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2590
Base revision: 44d113c4fa669065afe78d70bc81c5297d79ec0e
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision 4a03d2278aed4f5477bdd10ea77e17bf38136ede
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Fri, 6 Oct 2017 10:56:27 +0200

clm: Add user data in CLMSV_CLUSTER_JOIN_REQ message V2 [#2590]



Complete diffstat:
--
 scripts/opensaf_scale_out  | 14 +-
 src/clm/README | 17 
 src/clm/clmd/clms_cb.h |  2 ++
 src/clm/clmd/clms_evt.c| 32 ++-
 src/clm/clmd/clms_mds.c| 21 +++
 src/clm/clmnd/cb.h |  2 ++
 src/clm/clmnd/clmna.conf   |  4 +++
 src/clm/clmnd/main.c   | 64 --
 src/clm/common/clmsv_msg.h |  2 ++
 9 files changed, 143 insertions(+), 15 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] clm: Add user data in CLMSV_CLUSTER_JOIN_REQ message V2 [#2590]

2017-10-06 Thread Hans Nordeback
---
 scripts/opensaf_scale_out  | 14 +-
 src/clm/README | 17 
 src/clm/clmd/clms_cb.h |  2 ++
 src/clm/clmd/clms_evt.c| 32 ++-
 src/clm/clmd/clms_mds.c| 21 +++
 src/clm/clmnd/cb.h |  2 ++
 src/clm/clmnd/clmna.conf   |  4 +++
 src/clm/clmnd/main.c   | 64 --
 src/clm/common/clmsv_msg.h |  2 ++
 9 files changed, 143 insertions(+), 15 deletions(-)

diff --git a/scripts/opensaf_scale_out b/scripts/opensaf_scale_out
index 6fdcba75e..51ebcff74 100644
--- a/scripts/opensaf_scale_out
+++ b/scripts/opensaf_scale_out
@@ -35,6 +35,18 @@ export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH
 # Remove the following line when customizing this script.
 exit 0
 
+# Env variable CLM_IFS contains field separator for the
+# input argument, example on usage:
+# if [ -n "$CLM_IFS" ]; then
+#IFS=$CLM_IFS
+#logger "Using ifs [$IFS]"
+# fi
+#
+# for arg in $@
+# do
+#logger "> [$arg]"
+# done
+
 tmpdir=$(mktemp -d -t opensaf_scale_out.XX)
 destructor() {
   rm -rf "$tmpdir"
@@ -47,7 +59,7 @@ imm_xml=$tmpdir/imm.xml
 
 immfind -c SaClmNode | sed -e 's/^[^=]*=//;s/,.*$//' > "$nodes_cfg_tmp"
 for node in "$@"; do
-node_name=$(echo "$node" | cut -d, -f2)
+node_name=$(echo "$node" | cut -d$CLM_IFS -f2)
 echo "$node_name" >> "$nodes_cfg_tmp"
 done
 rm -f "$nodes_cfg"
diff --git a/src/clm/README b/src/clm/README
index dee3e64f2..50e683ca5 100644
--- a/src/clm/README
+++ b/src/clm/README
@@ -64,11 +64,18 @@ the script will check if the new node is eligible to be 
added to the cluster,
 and if so add the necessary IMM objects so that the node will be able to join
 the next time it tries. The script will be called with one or more command-line
 arguments, where each argument is a comma-separated list of properties of a 
node
-that wishes to join the cluster. Currently, the comma-separated list in each
-command-line argument contains only two entries, but the script should be
-forwards compatible with future extensions where more entries may be added to
-the comma-separated list. The first entry in the list is the node id 
represented
-as a decimal number. The second entry in the list is the name of the node.
+that wishes to join the cluster. The comma separator can be changed by
+setting variable CLMNA_IFS in clmna.conf to use another field separator, the
+field separator is passed in environment variable CLM_IFS to the
+opensaf_scale_out script.
+Currently, the comma-separated list in each command-line argument contains
+four entries, node-id, node-name, node-ipaddress, user-data.
+But the script should be forwards compatible with future extensions where more
+entries may be added to the comma-separated list. The first entry in the list
+is the node id represented as a decimal number. The second entry in the list is
+the name of the node. The third entry is the IP address of the node. The fourth
+entry is optional user data that can be entered in a file named
+/etc/opensaf/clm_user_data, up to 256 characters can be given.
 
 NOTE: the script must be idempotent, i.e. it must be harmless to call it more
 than one time with the same parameters. The second call should do nothing since
diff --git a/src/clm/clmd/clms_cb.h b/src/clm/clmd/clms_cb.h
index 1bcc451cf..e381f8f2f 100644
--- a/src/clm/clmd/clms_cb.h
+++ b/src/clm/clmd/clms_cb.h
@@ -254,6 +254,8 @@ typedef struct clms_cb_t {
   bool is_scale_out_thread_running;
   /* Full path to the scale-out script, or NULL if feature is disabled */
   char *scale_out_script;
+  /* internal field separator */
+  char ifs;
 } CLMS_CB;
 
 typedef struct clms_lock_tmr_t { SaNameT node_name; } CLMS_LOCK_TMR;
diff --git a/src/clm/clmd/clms_evt.c b/src/clm/clmd/clms_evt.c
index 84e7b3c6d..8352af869 100644
--- a/src/clm/clmd/clms_evt.c
+++ b/src/clm/clmd/clms_evt.c
@@ -44,7 +44,7 @@ static uint32_t proc_rda_evt(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_mds_quiesced_ack_msg(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_node_lock_tmr_exp_msg(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_node_up_msg(CLMS_CB *cb, CLMSV_CLMS_EVT *evt);
-static void execute_scale_out_script(int argc, char *argv[]);
+static void execute_scale_out_script(int argc, char *argv[], char clm_ifs);
 static void *scale_out_thread(void *arg);
 static void start_scale_out_thread(CLMS_CB *cb);
 static void scale_out_node(CLMS_CB *cb,
@@ -300,15 +300,17 @@ done:
  * and the second string is the node name. This function blocks until the 
script
  * has exited.
  */
-static void execute_scale_out_script(int argc, char *argv[])
+static void execute_scale_out_script(int argc, char *argv[], char clm_ifs)
 {
struct rlimit rlim;
int nofile = 1024;
-   char *const env[] = {scale_out_path_env, NULL};
+   char *env[3];
+   char ifs[10];
 
TRACE_ENTER();
osafassert(argc >= 1 && argv[argc] == NULL);
-   LOG_NO("Running script %s to scale out %d node(s)", 

[devel] [PATCH 1/1] clm: Make the cluster reset admin op safe V3 [#2451]

2017-09-27 Thread Hans Nordeback
---
 00-README.conf  | 10 +-
 src/base/osaf_utility.c | 44 
 src/base/osaf_utility.h |  5 +
 src/clm/clmnd/main.c|  1 +
 src/nid/nodeinit.cc |  2 ++
 5 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/00-README.conf b/00-README.conf
index f64aa031c..5b06b15d5 100644
--- a/00-README.conf
+++ b/00-README.conf
@@ -610,4 +610,12 @@ A message will be written if the latency is > 0.1 second, 
example below shows a
 
 messages.1:Sep 12 13:09:26 SC-1 osafimmd[26732]: NO MDS timerfd expired 10 
times
 
-If the latency exceeds 4 seconds a sigalrm will be sent and the process will 
be aborted.
\ No newline at end of file
+If the latency exceeds 4 seconds a sigalrm will be sent and the process will 
be aborted.
+
+If clm adm command for cluster reboot is issued an environment variable
+OPENSAF_CLUSTER_REBOOT_WAIT_TIME_SEC can be set in opensafd script to specify
+the time to wait for nodes to be started, except for the active node.
+Default is two seconds. A file, "clm_cluster_reboot_in_progress", is created
+on each node, except on the active node. This file indicates that a cluster
+reboot is in progress and all nodes needs to delay their start, this to give
+the active a lead.
diff --git a/src/base/osaf_utility.c b/src/base/osaf_utility.c
index 230cd7e0f..6ee6c3d8f 100644
--- a/src/base/osaf_utility.c
+++ b/src/base/osaf_utility.c
@@ -23,9 +23,53 @@
 #include 
 #include 
 #include 
+
+#include 
+#include 
+#include 
+#include 
 #include "base/ncssysf_def.h"
 #include "osaf/configmake.h"
 
+void osaf_wait_for_active_to_start(void)
+{
+   struct stat statbuf;
+   static char file[NAME_MAX];
+   const char *wait_time_str = NULL;
+   unsigned int wait_time = kDfltClusterRebootWaitTimeSec;
+
+   if ((wait_time_str = getenv("OPENSAF_CLUSTER_REBOOT_WAIT_TIME_SEC")) != 
NULL) {
+   wait_time = strtol(wait_time_str, NULL, 0);
+   }
+   snprintf(file, sizeof(file), PKGLOGDIR "/%s", 
kClmClusterRebootInProgress);
+
+   if (stat(file, ) != 0) {
+   syslog(LOG_NOTICE, "Reboot file %s not found, startup 
continue...", file);
+   return;
+   }
+
+   syslog(LOG_NOTICE, "Cluster reboot in progress, this node will start in 
%u second(s)", wait_time);
+
+   sleep(wait_time);
+
+   if (unlink(file) == -1) {
+   syslog(LOG_ERR, "cannot remove file %s: %s", file, 
strerror(errno));
+   }
+}
+
+void osaf_create_cluster_reboot_in_progress_file(void)
+{
+   static char file[NAME_MAX];
+   snprintf(file, sizeof(file), PKGLOGDIR "/%s", 
kClmClusterRebootInProgress);
+   int fd;
+
+   if ((fd = open(file, O_RDWR | O_CREAT, 0644)) < 0) {
+   syslog(LOG_ERR, "Open %s failed, %s", file, strerror(errno));
+   return;
+   }
+   close(fd);
+}
+
 void osaf_abort(long i_cause)
 {
syslog(LOG_ERR, "osaf_abort(%ld) called from %p with errno=%d", i_cause,
diff --git a/src/base/osaf_utility.h b/src/base/osaf_utility.h
index b935c5003..f7b5a07b3 100644
--- a/src/base/osaf_utility.h
+++ b/src/base/osaf_utility.h
@@ -30,6 +30,8 @@
 extern "C" {
 #endif
 
+#define kClmClusterRebootInProgress "clm_cluster_reboot_in_progress"
+enum { kDfltClusterRebootWaitTimeSec = 2 };
 enum { kOsafUseSafeReboot = 1 };
 
 /**
@@ -71,6 +73,9 @@ extern void osaf_abort(long i_cause) __attribute__((
 
 extern void osaf_safe_reboot(void) __attribute__((nothrow));
 
+extern void osaf_wait_for_active_to_start(void);
+extern void osaf_create_cluster_reboot_in_progress_file(void);
+
 static inline void osaf_mutex_lock_ordie(pthread_mutex_t* io_mutex) {
   int result = pthread_mutex_lock(io_mutex);
   if (result != 0) osaf_abort(result);
diff --git a/src/clm/clmnd/main.c b/src/clm/clmnd/main.c
index 3a8479600..2801c218f 100644
--- a/src/clm/clmnd/main.c
+++ b/src/clm/clmnd/main.c
@@ -122,6 +122,7 @@ static uint32_t clmna_mds_dec(struct ncsmds_callback_info 
*info)
// Reboot will be performed by CLMS for this node.
if (clmna_cb->node_info.node_id !=
msg->info.reboot_info.node_id) {
+   osaf_create_cluster_reboot_in_progress_file();
osaf_safe_reboot();
}
break;
diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc
index 9eddd743d..5a4b73cc6 100644
--- a/src/nid/nodeinit.cc
+++ b/src/nid/nodeinit.cc
@@ -1625,6 +1625,8 @@ int main(int argc, char *argv[]) {
 
   TRACE_ENTER();
 
+  osaf_wait_for_active_to_start();
+
 #ifdef RLIMIT_RTPRIO
   struct rlimit mylimit;
   mylimit.rlim_max = mylimit.rlim_cur = sched_get_priority_max(SCHED_RR);
-- 
2.14.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

[devel] [PATCH 0/1] Review Request for clm: Make the cluster reset admin op safe V3 [#2451]

2017-09-27 Thread Hans Nordeback
Summary: clm: Make the cluster reset admin op safe V3 [#2451]
Review request for Ticket(s): 2451
Peer Reviewer(s): AndersW, Praveen
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2451
Base revision: ea24f77bcb58fbfd7ba430bb46143b9f1aaa5110
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision d71eddab22f5e48ad9a354aee6ebc71ab68a174e
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Wed, 27 Sep 2017 13:08:03 +0200

clm: Make the cluster reset admin op safe V3 [#2451]



Complete diffstat:
--
 00-README.conf  | 10 +-
 src/base/osaf_utility.c | 44 
 src/base/osaf_utility.h |  5 +
 src/clm/clmnd/main.c|  1 +
 src/nid/nodeinit.cc |  2 ++
 5 files changed, 61 insertions(+), 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


[devel] [PATCH 1/1] clm: Add user data in CLMSV_CLUSTER_JOIN_REQ message [#2590]

2017-09-25 Thread Hans Nordeback
---
 src/clm/README |  8 +---
 src/clm/clmd/clms_evt.c| 11 +--
 src/clm/clmd/clms_mds.c| 11 +++
 src/clm/clmnd/cb.h |  1 +
 src/clm/clmnd/main.c   | 28 +++-
 src/clm/common/clmsv_msg.h |  1 +
 6 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/src/clm/README b/src/clm/README
index dee3e64f2..10e60849b 100644
--- a/src/clm/README
+++ b/src/clm/README
@@ -65,10 +65,12 @@ and if so add the necessary IMM objects so that the node 
will be able to join
 the next time it tries. The script will be called with one or more command-line
 arguments, where each argument is a comma-separated list of properties of a 
node
 that wishes to join the cluster. Currently, the comma-separated list in each
-command-line argument contains only two entries, but the script should be
-forwards compatible with future extensions where more entries may be added to
+command-line argument contains four entries, node-id, node-name, 
node-ipaddress, user-data.
+But the script should be forwards compatible with future extensions where more 
entries may be added to
 the comma-separated list. The first entry in the list is the node id 
represented
-as a decimal number. The second entry in the list is the name of the node.
+as a decimal number. The second entry in the list is the name of the node. The 
third entry is the
+IP address of the node. The fourth entry is optional user data that can be 
entered in a file named
+/etc/opensaf/user_data, up to 256 characters can be given.
 
 NOTE: the script must be idempotent, i.e. it must be harmless to call it more
 than one time with the same parameters. The second call should do nothing since
diff --git a/src/clm/clmd/clms_evt.c b/src/clm/clmd/clms_evt.c
index 84e7b3c6d..eb771c105 100644
--- a/src/clm/clmd/clms_evt.c
+++ b/src/clm/clmd/clms_evt.c
@@ -453,6 +453,7 @@ static void scale_out_node(CLMS_CB *cb,
   const clmsv_clms_node_up_info_t *nodeup_info)
 {
char node_name[SA_MAX_NAME_LENGTH];
+   char user_data[SA_MAX_NAME_LENGTH];
 
TRACE_ENTER();
size_t name_len = nodeup_info->node_name.length < SA_MAX_NAME_LENGTH
@@ -461,6 +462,12 @@ static void scale_out_node(CLMS_CB *cb,
memcpy(node_name, nodeup_info->node_name.value, name_len);
node_name[name_len] = '\0';
 
+   size_t user_data_len = nodeup_info->user_data.length < 
SA_MAX_NAME_LENGTH
+ ? nodeup_info->user_data.length
+ : (SA_MAX_NAME_LENGTH - 1);
+   memcpy(user_data, nodeup_info->user_data.value, user_data_len);
+   user_data[user_data_len] = '\0';
+
osaf_mutex_lock_ordie(>scale_out_data_mutex);
size_t no_of_pending_nodes = cb->no_of_pending_nodes;
size_t no_of_inprogress_nodes = cb->no_of_inprogress_nodes;
@@ -497,8 +504,8 @@ static void scale_out_node(CLMS_CB *cb,
memcpy(node_address, nodeup_info->address.value, addr_len);
node_address[addr_len] = '\0';
char *strp;
-   if (asprintf(, "%" PRIu32 ",%s,%s,", nodeup_info->node_id,
-node_name, node_address) != -1) {
+   if (asprintf(, "%" PRIu32 ",%s,%s,%s", 
nodeup_info->node_id,
+node_name, node_address, user_data) != -1) {
LOG_NO("Queuing request to scale out node 0x%" PRIx32
   " (%s)",
   nodeup_info->node_id, node_name);
diff --git a/src/clm/clmd/clms_mds.c b/src/clm/clmd/clms_mds.c
index 1eb0e1e62..ecfe0da3b 100644
--- a/src/clm/clmd/clms_mds.c
+++ b/src/clm/clmd/clms_mds.c
@@ -787,6 +787,17 @@ static uint32_t clms_dec_nodeup_msg(NCS_UBAID *uba, 
CLMSV_MSG *msg)
TRACE("nodename %s length %d",
  msg->info.api_info.param.nodeup_info.node_name.value,
  msg->info.api_info.param.nodeup_info.node_name.length);
+
+   memset(>info.api_info.param.nodeup_info.user_data, 0, 
sizeof(SaNameT));
+   p8 = ncs_dec_flatten_space(uba, local_data, 2);
+   if (p8 != NULL) {
+   total_bytes += clmsv_decodeSaNameT(
+   uba, &(msg->info.api_info.param.nodeup_info.user_data));
+   TRACE("userdata %s length %d",
+ msg->info.api_info.param.nodeup_info.user_data.value,
+ msg->info.api_info.param.nodeup_info.user_data.length);
+   }
+
p8 = ncs_dec_flatten_space(uba, local_data, 8);
// Old protocol versions don't have the boot_time field. Use the current
// wall clock time if boot_time isn't present in the message.
diff --git a/src/clm/clmnd/cb.h b/src/clm/clmnd/cb.h
index 9b26a9bf5..cb66ffe8b 100644
--- a/src/clm/clmnd/cb.h
+++ b/src/clm/clmnd/cb.h
@@ -37,6 +37,7 @@
 typedef struct node_detail_t {
   SaUint32T node_id;
   SaNameT node_name;
+  SaNameT user_data;
   SaTimeT boot_time;
   SaUint16T no_of_addresses;
   

[devel] [PATCH 0/1] Review Request for osaf: Add gcov support [#2589]

2017-09-21 Thread Hans Nordeback
Summary: osaf: Add gcov support [#2589]
Review request for Ticket(s): 2589
Peer Reviewer(s): AndersW, Ravi
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2589
Base revision: 61e9fd96d66786cfb6e607a2594fc168c799a95d
Personal repository: git://git.code.sf.net/u/hansnordeback/review


Impacted area   Impact y/n

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

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

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

revision d72a6fbc6e6526f1cbf4433432856f314608e315
Author: Hans Nordeback <hans.nordeb...@ericsson.com>
Date:   Thu, 21 Sep 2017 16:10:22 +0200

osaf: Add gcov support [#2589]



Added Files:

 tools/devel/gcov_collect/osaf_gcov_dump.c


Complete diffstat:
--
 00-README.conf| 13 -
 Makefile.am   |  8 ++-
 README|  1 +
 configure.ac  | 18 ++
 src/base/daemon.c | 96 +--
 src/nid/opensafd.in   |  7 +++
 tools/devel/gcov_collect/osaf_gcov_dump.c | 40 +
 7 files changed, 176 insertions(+), 7 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  y  y
powerpc n  n
powerpc64   n  n


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

[devel] [PATCH 1/1] osaf: Add gcov support [#2589]

2017-09-21 Thread Hans Nordeback
---
 00-README.conf| 13 -
 Makefile.am   |  8 ++-
 README|  1 +
 configure.ac  | 18 ++
 src/base/daemon.c | 96 +--
 src/nid/opensafd.in   |  7 +++
 tools/devel/gcov_collect/osaf_gcov_dump.c | 40 +
 7 files changed, 176 insertions(+), 7 deletions(-)
 create mode 100644 tools/devel/gcov_collect/osaf_gcov_dump.c

diff --git a/00-README.conf b/00-README.conf
index f64aa031c..c42a37563 100644
--- a/00-README.conf
+++ b/00-README.conf
@@ -610,4 +610,15 @@ A message will be written if the latency is > 0.1 second, 
example below shows a
 
 messages.1:Sep 12 13:09:26 SC-1 osafimmd[26732]: NO MDS timerfd expired 10 
times
 
-If the latency exceeds 4 seconds a sigalrm will be sent and the process will 
be aborted.
\ No newline at end of file
+If the latency exceeds 4 seconds a sigalrm will be sent and the process will 
be aborted.
+
+# To enable gcov run ./configure --enable-gcov
+# In each daemon a thread will be created that listens to a default multicast 
group 239.0.0.1 port 4712.
+# To change default, update /etc/init.d/opensafd setup_env function, example:
+# export OPENSAF_GCOV_MULTICAST_GROUP="224.0.0.1"
+# export OPENSAF_GCOV_MULTICAST_PORT="4711"
+# and if running in UML uncomment the line:
+# echo 100 >  /proc/sys/net/ipv4/igmp_max_memberships
+# To collect gcov data use program tools/develop/gcov_collect/osaf_gcov_dump.
+# Check the MULTICAST_PORT and MULTICAST_GROUP settings are the same as 
multicast group and port
+# above.
\ No newline at end of file
diff --git a/Makefile.am b/Makefile.am
index 7763f313c..0a69f752d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,7 +56,13 @@ AM_CPPFLAGS = \
 
 AM_CFLAGS = -pipe -std=gnu11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2 -Werror
 AM_CXXFLAGS = -pipe -std=gnu++11 @OSAF_HARDEN_FLAGS@ -Wall -Wformat=2 -Werror
-AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -Wl,--as-needed -ldl -lrt -pthread -rdynamic
+
+if ENABLE_GCOV
+AM_CFLAGS += --coverage
+AM_CXXFLAGS += --coverage
+endif
+
+AM_LDFLAGS = @OSAF_HARDEN_FLAGS@ -Wl,--as-needed -ldl -lrt -pthread -rdynamic 
-lgcov
 ACLOCAL_AMFLAGS = -I m4
 OSAF_LIB_FLAGS =
 
diff --git a/README b/README
index 13c0eb352..d51314a4b 100644
--- a/README
+++ b/README
@@ -534,6 +534,7 @@ available w.r.t enabling/disabling the build for a 
particular OpenSAF service:
   produced.
   --disable-rpm-targetdisable support for the "make rpm" target
   [default=no]
+  --enable-gcov   enable code coverage [default=no]
   --enable-experimental   enable experimental code [default=no]
   --enable-python enable the Python AIS bindings [default=yes]
   --enable-java   enable the Java AIS interface mapping [default=no]
diff --git a/configure.ac b/configure.ac
index 74655ddce..56b17ab36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,6 +188,24 @@ fi
 AM_CONDITIONAL([ENABLE_EXPERIMENTAL], [test "$enable_experimental" = yes])
 AC_SUBST([EXPERIMENTAL_ENABLED], ["$enable_experimental"])
 
+#
+# Enable/disable gcov
+#
+AC_MSG_CHECKING([whether to build with gcov])
+AC_ARG_ENABLE([gcov],
+[AS_HELP_STRING([--enable-gcov],
+[enable building with gcov [default=no]])],
+[],
+[enable_gcov=no])
+AC_MSG_RESULT([$enable_gcov])
+
+if test "$enable_gcov" = yes; then
+AC_DEFINE([ENABLE_GCOV], 1, [Define if gcov is enabled])
+fi
+
+AM_CONDITIONAL([ENABLE_GCOV], [test "$enable_gcov" = yes])
+AC_SUBST([GCOV_ENABLED], ["$enable_gcov"])
+
 #
 # Enable/disable the Python AIS bindings
 #
diff --git a/src/base/daemon.c b/src/base/daemon.c
index 575588575..3e6ca7357 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -15,7 +15,13 @@
  * Author(s): Wind River Systems
  *
  */
+#ifdef HAVE_CONFIG_H
+#include "osaf/config.h"
+#endif
 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -56,8 +62,6 @@
 
 static const char *internal_version_id_;
 
-extern void __gcov_flush(void) __attribute__((weak));
-
 static char fifo_file[NAME_MAX];
 static char __pidfile[NAME_MAX];
 static char __tracefile[NAME_MAX];
@@ -69,6 +73,87 @@ static int fifo_fd = -1;
 
 static void install_fatal_signal_handlers(void);
 
+#ifdef ENABLE_GCOV
+
+// default multicast group for gcov collection
+#define DFLT_MULTICAST_GROUP "239.0.0.1"
+
+extern void __gcov_dump();
+extern void __gcov_reset();
+
+static void* gcov_flush_thread(void* arg) {
+   int listenfd;
+   const int on = 1;
+   struct sockaddr_in servaddr;
+   struct ip_mreq mreq;
+   char buf[40];
+   struct sockaddr_in addr;
+   socklen_t addr_len;
+   int multicast_port = 4712; // default multicast group for gcov 
collection
+   const char *multicast_port_str;
+   const char *multicast_group;
+
+   if ((multicast_group = getenv("OPENSAF_GCOV_MULTICAST_GROUP")) == 

[devel] [PATCH 1/1] clm: Make the cluster reset admin op safe V2 [#2451]

2017-09-14 Thread Hans Nordeback
The active node reboots all nodes in the cluster excepts itself, the active 
node.
When the peer CLMS node has been rebooted and is in a "well defined" state
it sends a peer up message to the active CLMS node. If a cluster
reboot is ongoing, the active CLM node will be rebooted as the last step
when the CLMS peer up message is received.
TODO(uabhano) the peer up message should be sent when this node is in
a state where the other node can be rebooted, i.e this node should be in
a "well defined" state where e.g. all the cold syncs are performed, etc.
This feature to get a notification when the system is in a "well defined"
state.
This can be implemented with e.g. a new IMM object and using an applier
to subscribe to a set of events that together forms a "well defined" state.
---
 src/clm/clmd/clms_amf.c| 19 +++
 src/clm/clmd/clms_cb.h |  1 +
 src/clm/clmd/clms_evt.c| 28 +---
 src/clm/clmd/clms_imm.c|  7 ---
 src/clm/clmd/clms_main.c   |  2 ++
 src/clm/clmd/clms_mds.c| 18 +-
 src/clm/common/clmsv_msg.h |  2 ++
 7 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/src/clm/clmd/clms_amf.c b/src/clm/clmd/clms_amf.c
index c63357056..4b9972ee2 100644
--- a/src/clm/clmd/clms_amf.c
+++ b/src/clm/clmd/clms_amf.c
@@ -65,8 +65,27 @@ static SaAisErrorT amf_active_state_handler(CLMS_CB *cb,
 static SaAisErrorT amf_standby_state_handler(CLMS_CB *cb,
 SaInvocationT invocation)
 {
+   CLMSV_MSG msg;
+   int rc;
+
TRACE_ENTER2("HA STANDBY request");
 
+   //TODO(uabhano) the peer up message should be sent when this node is in
+   // a state where the other node can be rebooted, i.e this node should 
be in
+   // a "well defined" state where e.g. all the cold syncs are performed, 
etc.
+   // This feature to get a notification when the system is in a "well 
defined"
+   // state.
+   // This can be implemented with e.g. a new IMM object and using an 
applier
+   // to subscribe to a set of events that together forms a "well defined" 
state,
+   // a separate ticket can be created for this.
+   msg.evt_type = CLMSV_CLMS_TO_CLMS_PEER_UP_MSG;
+   msg.info.api_info.type = CLMSV_PEER_UP_REQ;
+   rc = clms_mds_msg_send(cb, , _cb->vaddr, NULL, 
MDS_SEND_PRIORITY_HIGH,
+  NCSMDS_SVC_ID_CLMS);
+   if (rc != NCSCC_RC_SUCCESS) {
+   LOG_NO("%s: send failed. dest: %" PRIx64, __FUNCTION__, 
clms_cb->vaddr);
+   }
+
cb->mds_role = V_DEST_RL_STANDBY;
 
TRACE_LEAVE();
diff --git a/src/clm/clmd/clms_cb.h b/src/clm/clmd/clms_cb.h
index 1bcc451cf..de5f8317f 100644
--- a/src/clm/clmd/clms_cb.h
+++ b/src/clm/clmd/clms_cb.h
@@ -254,6 +254,7 @@ typedef struct clms_cb_t {
   bool is_scale_out_thread_running;
   /* Full path to the scale-out script, or NULL if feature is disabled */
   char *scale_out_script;
+  bool cluster_reboot_requested;
 } CLMS_CB;
 
 typedef struct clms_lock_tmr_t { SaNameT node_name; } CLMS_LOCK_TMR;
diff --git a/src/clm/clmd/clms_evt.c b/src/clm/clmd/clms_evt.c
index 84e7b3c6d..0b3a4b8da 100644
--- a/src/clm/clmd/clms_evt.c
+++ b/src/clm/clmd/clms_evt.c
@@ -44,6 +44,7 @@ static uint32_t proc_rda_evt(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_mds_quiesced_ack_msg(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_node_lock_tmr_exp_msg(CLMSV_CLMS_EVT *evt);
 static uint32_t proc_node_up_msg(CLMS_CB *cb, CLMSV_CLMS_EVT *evt);
+static uint32_t proc_peer_up(CLMS_CB *cb, CLMSV_CLMS_EVT *evt);
 static void execute_scale_out_script(int argc, char *argv[]);
 static void *scale_out_thread(void *arg);
 static void start_scale_out_thread(CLMS_CB *cb);
@@ -82,7 +83,7 @@ static const CLMSV_CLMS_EVT_HANDLER 
clms_clmsv_top_level_evt_dispatch_tbl[] = {
 static const CLMSV_CLMS_CLMA_API_MSG_HANDLER clms_clma_api_msg_dispatcher[] = {
 proc_initialize_msg,   proc_finalize_msg, proc_track_start_msg,
 proc_track_stop_msg,   proc_node_get_msg, proc_node_get_async_msg,
-proc_clm_response_msg, proc_node_up_msg};
+proc_clm_response_msg, proc_node_up_msg, proc_peer_up};
 
 static char scale_out_path_env[] = "PATH=" SCALE_OUT_PATH_ENV;
 
@@ -521,6 +522,29 @@ static void scale_out_node(CLMS_CB *cb,
TRACE_LEAVE();
 }
 
+/**
+ * Processing peer up msg from the standby clms director
+ *
+ * @param evt : Ptr to CLMSV_CLMS_EVT
+ *
+ * @return  NCSCC_RC_SUCCESS/NCSCC_RC_FAILURE
+ *
+ */
+uint32_t proc_peer_up(CLMS_CB *cb, CLMSV_CLMS_EVT *evt) {
+   uint32_t rc = NCSCC_RC_SUCCESS;
+
+   if (cb->cluster_reboot_requested == true) {
+   LOG_NO("Reboot this node to complete cluster reboot");
+   //TODO(uabhano) the peer up message should be received when the 
other node is in
+   // a "well defined" state, so the sleep() should be removed, 
see TODO(uabahno) comment
+   // in "amf_standby_state_handler()"
+   sleep(4);

  1   2   3   4   5   >