Re: [devel] [PATCH 1/1] amf: Improve SC status change callback style [#2594]

2017-09-25 Thread Gary Lee
Ack

Thanks
Gary

On 26/9/17, 2:56 pm, "Quyen Dao"  wrote:

Make SC status change callback style to be consistent with other AMF 
callbacks
* Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status 
change callback type
* Use osafAmfSCStatusChangeCallback as callback name
* Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"
---
 src/ais/include/saAmf_B_04_02.h |  6 +-
 src/amf/README_SC_ABSENCE   |  4 ++--
 src/amf/agent/ava_mds.cc| 21 +++--
 src/amf/agent/ava_mds.h |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/ais/include/saAmf_B_04_02.h 
b/src/ais/include/saAmf_B_04_02.h
index e52564a..f8b31d6 100644
--- a/src/ais/include/saAmf_B_04_02.h
+++ b/src/ais/include/saAmf_B_04_02.h
@@ -65,9 +65,13 @@ typedef enum {
 OSAF_AMF_SC_ABSENT = 2,
 } OsafAmfSCStatusT;
 
+typedef void
+(*OsafAmfSCStatusChangeCallbackT)(
+OsafAmfSCStatusT status);
+
 extern SaAisErrorT osafAmfInstallSCStatusChangeCallback(
 SaAmfHandleT amfHandle,
-void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+OsafAmfSCStatusChangeCallbackT callback);
 
 #ifdef  __cplusplus
 }
diff --git a/src/amf/README_SC_ABSENCE b/src/amf/README_SC_ABSENCE
index 42042de..6f38237 100644
--- a/src/amf/README_SC_ABSENCE
+++ b/src/amf/README_SC_ABSENCE
@@ -168,7 +168,7 @@ Information about the resources:
 
   -Callback and its argument:
 
-  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
+  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status)
   where OsafAmfSCStatusT is defined as:
 typedef enum {
   OSAF_AMF_SC_PRESENT = 1,
@@ -188,7 +188,7 @@ Information about the resources:
 
 * An API to register/install above callback function:
void osafAmfInstallSCStatusChangeCallback(SaAmfHandleT amfHandle,
- void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+ 
OsafAmfSCStatusChangeCallbackT callback);
If 0 is passed as amfHandle, then callback will be invoked in the
context of MDS thread. If a valid amfHandle is passed then callback
will be invoked in the context of thread which is calling 
saAmfDispatch()
diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 4957b4f..4408853 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -73,32 +73,32 @@ static void (*amf_down_cb)(void);
  * @brief  SC status change callback. It is called when cluster becomes
  * without SCs and with SCs. It can be used by a client to know
  * when cluster runs without SCs and with SCs.
- * @param  state.
  */
-static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
+static OsafAmfSCStatusChangeCallbackT osafAmfSCStatusChangeCallback;
 
 //Wrapper function that AMFA uses to invoke SC status change callback.
-void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT status) {
   TRACE_ENTER();
-  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+  if (osafAmfSCStatusChangeCallback == nullptr) {
  TRACE("Callback not registered");
   } else {
  TRACE("Invoking SC status change callback");
 /* A client has installed a callback pointer, call it */
-OsafAmfSCStatusChangeCallbackT(state);
+osafAmfSCStatusChangeCallback(status);
   }
   TRACE_LEAVE();
 }
+
 bool is_osafAmfSCStatusChangeCallback_registered() {
-  if (OsafAmfSCStatusChangeCallbackT == nullptr)
+  if (osafAmfSCStatusChangeCallback == nullptr)
 return false;
   else
 return true;
 }
 
 void uninstall_osafAmfSCStatusChangeCallback() {
-  TRACE("uninstalling OsafAmfSCStatusChangeCallbackT.");
-  OsafAmfSCStatusChangeCallbackT = nullptr;
+  TRACE("uninstalling osafAmfSCStatusChangeCallback.");
+  osafAmfSCStatusChangeCallback = nullptr;
 }
 
/
   Name  : ava_mds_reg
@@ -1206,7 +1206,7 @@ extern "C" void ava_install_amf_down_cb(void 
(*cb)(void)) {
  * @brief   API for client to install SC status change callback.
  */
 SaAisErrorT osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
- void (*cb)(OsafAmfSCStatusT status)) {
+ 
OsafAmfSCStatusChangeCallbackT cb) {
   TRACE_ENTER2("handle:%llx", hdl);
 
   AVA_CB *ava_cb = 0;
@@ -1237,7 +1237,8 @@ SaAisErrorT 
osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
 

[devel] [PATCH 1/1] amf: Improve SC status change callback style [#2594]

2017-09-25 Thread Quyen Dao
Make SC status change callback style to be consistent with other AMF callbacks
* Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status change 
callback type
* Use osafAmfSCStatusChangeCallback as callback name
* Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"
---
 src/ais/include/saAmf_B_04_02.h |  6 +-
 src/amf/README_SC_ABSENCE   |  4 ++--
 src/amf/agent/ava_mds.cc| 21 +++--
 src/amf/agent/ava_mds.h |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/ais/include/saAmf_B_04_02.h b/src/ais/include/saAmf_B_04_02.h
index e52564a..f8b31d6 100644
--- a/src/ais/include/saAmf_B_04_02.h
+++ b/src/ais/include/saAmf_B_04_02.h
@@ -65,9 +65,13 @@ typedef enum {
 OSAF_AMF_SC_ABSENT = 2,
 } OsafAmfSCStatusT;
 
+typedef void
+(*OsafAmfSCStatusChangeCallbackT)(
+OsafAmfSCStatusT status);
+
 extern SaAisErrorT osafAmfInstallSCStatusChangeCallback(
 SaAmfHandleT amfHandle,
-void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+OsafAmfSCStatusChangeCallbackT callback);
 
 #ifdef  __cplusplus
 }
diff --git a/src/amf/README_SC_ABSENCE b/src/amf/README_SC_ABSENCE
index 42042de..6f38237 100644
--- a/src/amf/README_SC_ABSENCE
+++ b/src/amf/README_SC_ABSENCE
@@ -168,7 +168,7 @@ Information about the resources:
 
   -Callback and its argument:
 
-  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state)
+  void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status)
   where OsafAmfSCStatusT is defined as:
 typedef enum {
   OSAF_AMF_SC_PRESENT = 1,
@@ -188,7 +188,7 @@ Information about the resources:
 
 * An API to register/install above callback function:
void osafAmfInstallSCStatusChangeCallback(SaAmfHandleT amfHandle,
- void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT status));
+ OsafAmfSCStatusChangeCallbackT 
callback);
If 0 is passed as amfHandle, then callback will be invoked in the
context of MDS thread. If a valid amfHandle is passed then callback
will be invoked in the context of thread which is calling saAmfDispatch()
diff --git a/src/amf/agent/ava_mds.cc b/src/amf/agent/ava_mds.cc
index 4957b4f..4408853 100644
--- a/src/amf/agent/ava_mds.cc
+++ b/src/amf/agent/ava_mds.cc
@@ -73,32 +73,32 @@ static void (*amf_down_cb)(void);
  * @brief  SC status change callback. It is called when cluster becomes
  * without SCs and with SCs. It can be used by a client to know
  * when cluster runs without SCs and with SCs.
- * @param  state.
  */
-static void (*OsafAmfSCStatusChangeCallbackT)(OsafAmfSCStatusT state);
+static OsafAmfSCStatusChangeCallbackT osafAmfSCStatusChangeCallback;
 
 //Wrapper function that AMFA uses to invoke SC status change callback.
-void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT state) {
+void osafAmfSCStatusChangeCallback_invoke(OsafAmfSCStatusT status) {
   TRACE_ENTER();
-  if (OsafAmfSCStatusChangeCallbackT == nullptr) {
+  if (osafAmfSCStatusChangeCallback == nullptr) {
  TRACE("Callback not registered");
   } else {
  TRACE("Invoking SC status change callback");
 /* A client has installed a callback pointer, call it */
-OsafAmfSCStatusChangeCallbackT(state);
+osafAmfSCStatusChangeCallback(status);
   }
   TRACE_LEAVE();
 }
+
 bool is_osafAmfSCStatusChangeCallback_registered() {
-  if (OsafAmfSCStatusChangeCallbackT == nullptr)
+  if (osafAmfSCStatusChangeCallback == nullptr)
 return false;
   else
 return true;
 }
 
 void uninstall_osafAmfSCStatusChangeCallback() {
-  TRACE("uninstalling OsafAmfSCStatusChangeCallbackT.");
-  OsafAmfSCStatusChangeCallbackT = nullptr;
+  TRACE("uninstalling osafAmfSCStatusChangeCallback.");
+  osafAmfSCStatusChangeCallback = nullptr;
 }
 /
   Name  : ava_mds_reg
@@ -1206,7 +1206,7 @@ extern "C" void ava_install_amf_down_cb(void (*cb)(void)) 
{
  * @brief   API for client to install SC status change callback.
  */
 SaAisErrorT osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
- void (*cb)(OsafAmfSCStatusT status)) {
+ 
OsafAmfSCStatusChangeCallbackT cb) {
   TRACE_ENTER2("handle:%llx", hdl);
 
   AVA_CB *ava_cb = 0;
@@ -1237,7 +1237,8 @@ SaAisErrorT 
osafAmfInstallSCStatusChangeCallback(SaAmfHandleT hdl,
 goto done;
   }
   ava_cb->ava_sc_status_handle = hdl;
-  OsafAmfSCStatusChangeCallbackT = cb;
+  osafAmfSCStatusChangeCallback = cb;
+
 
 done:
   if (ava_cb) {
diff --git a/src/amf/agent/ava_mds.h b/src/amf/agent/ava_mds.h
index 3de61db..8f35f75 100644
--- a/src/amf/agent/ava_mds.h
+++ b/src/amf/agent/ava_mds.h
@@ -102,7 +102,7 @@ uint32_t ava_mds_cbk(NCSMDS_CALLBACK_INFO*);
 uint32_t ava_mds_send(struct ava_cb_tag*, AVSV_NDA_AVA_MSG*,
   AVSV_NDA_AVA_MSG**);
 
-void 

[devel] [PATCH 0/1] Review Request for amf: Improve SC status change callback style [#2594]

2017-09-25 Thread Quyen Dao
Summary: amf: Improve SC status change callback style [#2594]
Review request for Ticket(s): 2594
Peer Reviewer(s): Gary, Hans, Praveen, Ravi
Pull request to: Gary
Affected branch(es): develop
Development branch: ticket-2594
Base revision: f3ef8eebf44f0eab4dcc65f83fe3119a77ef5067
Personal repository: git://git.code.sf.net/u/xquydao/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):
-
amf: Improve SC status change callback style [#2594]

Make SC status change callback style to be consistent with other AMF callbacks
* Define an alias named OsafAmfSCStatusChangeCallbackT for the SC status change 
callback type
* Use osafAmfSCStatusChangeCallback as callback name
* Change "OsafAmfSCStatusT state" to "OsafAmfSCStatusT status"



Complete diffstat:
--
 src/ais/include/saAmf_B_04_02.h |  6 +-
 src/amf/README_SC_ABSENCE   |  4 ++--
 src/amf/agent/ava_mds.cc| 21 +++--
 src/amf/agent/ava_mds.h |  2 +-
 4 files changed, 19 insertions(+), 14 deletions(-)


Testing Commands:
-
# amfclusterstatus


Testing, Expected Results:
--
amfclusterstatus works well


Conditions of Submission:
-
ACK from reviewers


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


--
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: choose unlocked instantiable SU for instantiation [#2462]

2017-09-25 Thread Ravi Sekhar Reddy Konda
Hi Minh,

Addressed your comments, please find the attached patch(this is on top of the 
original patch).
If you are fine, I will push the patch

Thanks,
Ravi

- Original Message -
From: minh.c...@dektech.com.au
To: ravi.sek...@oracle.com, hans.nordeb...@ericsson.com, gary@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Sent: Wednesday, September 13, 2017 10:36:55 AM GMT +05:30 Chennai, Kolkata, 
Mumbai, New Delhi
Subject: Re: [devel] [PATCH 1/1] amfd: choose unlocked instantiable SU for 
instantiation [#2462]

Hi Ravi,

Minor comments in line.

Thanks,
Minh
On 08/09/17 17:03, Ravi Sekhar wrote:
> ---
>   src/amf/amfd/sgproc.cc | 23 +--
>   1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
> index 6ca4261..0dbaa59 100644
> --- a/src/amf/amfd/sgproc.cc
> +++ b/src/amf/amfd/sgproc.cc
> @@ -1924,7 +1924,20 @@ uint32_t in_serv_su(AVD_SG *sg) {
> TRACE_LEAVE2("%u", in_serv);
> return in_serv;
>   }
> -
> +/**
> + * @brief   This function checks if there is any same ranked SU
> + *  which is Unlocked and can be Instantiated
> + *
> + * @param   pointer to su
> + *
> + */
> +uint32_t find_instantiable_same_rank_su(AVD_SU *su) {
> +  for (const auto _su : su->sg_of_su->list_of_su) {
> +if (i_su->is_instantiable() && (i_su->saAmfSURank == su->saAmfSURank))
> +  return true;
> +  }
> +  return false;
> +}
[Minh]: Returned value of function should be bool, if possible please 
consider the new find_instantantiable_same_rank_su() as a method of class.
>   
> /*
>* Function: avd_sg_app_su_inst_func
>*
> @@ -2011,7 +2024,13 @@ uint32_t avd_sg_app_su_inst_func(AVD_CL_CB *cb, AVD_SG 
> *sg) {
>   TRACE("%u, %u", sg->pref_inservice_sus(), num_try_insvc_su);
>   if (sg->pref_inservice_sus() >
>   (sg_instantiated_su_count(i_su->sg_of_su) + num_try_insvc_su)) {
> -  /* Try to Instantiate this SU */
> +  /* If SU is in Locked State, find if there is any other SU in the 
> same rank
> +   * which can provide Service(Unlocked SU)
> +   */
> +  if(i_su->saAmfSUAdminState == SA_AMF_ADMIN_LOCKED) {
> +if (find_instantiable_same_rank_su(i_su))
> +  continue;
> +  }
[Minh]: Patch works fine with reported scenario. However, if replace 
"lock SU1, lock SU2" in scenario of ticket by "lock SC1, lock SC2", we 
have the same problem - SI is still PARTIALLY_ASSIGNED.
If I change the *if* as below, it works for me in both cases.
   if(i_su->is_instantiable() == false) {
 if (find_instantiable_same_rank_su(i_su))
   continue;
   }
> if (avd_snd_presence_msg(cb, i_su, false) == NCSCC_RC_SUCCESS) {
>   num_try_insvc_su++;
> }


--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! 
https://urldefense.proofpoint.com/v2/url?u=http-3A__sdm.link_slashdot=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=Ex2RmugAaf80RUUKinucP8YznGguSqRGYzwecTZIdvI=
 
___
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.sourceforge.net_lists_listinfo_opensaf-2Ddevel=DwICAg=RoP1YumCXCgaWHvlZYR8PQcxBKCX5YTpkKY057SbK10=rFCQ76TW5HZUgA7b20ApVcXgXru6mvz4fvCm1_H6w1k=ICtz-8NcHlILP8LBUdTUuikcCD3s8_aYlcsx5gQ_MxI=91ManmbaZoIBHsmXK3kReGUsb5EcSNIe3wYPHT8V_VA=
 


amfd_2462_2.patch
Description: Binary data
--
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 imm: Update admo id after resurrecting [#2591]

2017-09-25 Thread Hung Nguyen
Summary: imm: Update admo id after resurrecting [#2591]
Review request for Ticket(s): 2591
Peer Reviewer(s): Zoran
Pull request to: 
Affected branch(es): develop, release
Development branch: ticket-2591
Base revision: f3ef8eebf44f0eab4dcc65f83fe3119a77ef5067
Personal repository: git://git.code.sf.net/u/xhunngu/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):
-


revision 83fefdd98edcc47d82eb8a59f32145f40ad0fb30
Author: Hung Nguyen 
Date:   Tue, 26 Sep 2017 09:51:10 +0700

imm: Update admo id after resurrecting [#2591]

Update admo id after resurrecting.



Complete diffstat:
--
 src/imm/agent/imma_om_api.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


Testing Commands:
-



Testing, Expected Results:
--



Conditions of Submission:
-
Ack from reviewers.


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


--
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] uml: Add support for IPv6 and update Linux version [#2593]

2017-09-25 Thread Anders Widell
You can now select to use IPv6 addresses in UML, by using e.g. the following
command before starting the UML cluster:

  export IPADDRBASE=fe80::

Linux kernel has also been updated to version 4.13.3.
---
 tools/cluster_sim_uml/README   |   6 +
 tools/cluster_sim_uml/archive/scripts/10net.rc |  17 ++-
 tools/cluster_sim_uml/archive/scripts/40opensaf.rc |   6 +-
 tools/cluster_sim_uml/build_uml|   6 +
 tools/cluster_sim_uml/opensaf  |  45 +--
 tools/cluster_sim_uml/uml/build_uml|  13 +-
 .../uml/config/{busybox-1.26.2 => busybox-1.27.2}  | 146 +
 .../{linux-4.10.1-i686 => linux-4.13.3-i686}   | 108 +++
 .../{linux-4.10.1-x86_64 => linux-4.13.3-x86_64}   | 108 +++
 9 files changed, 325 insertions(+), 130 deletions(-)
 rename tools/cluster_sim_uml/uml/config/{busybox-1.26.2 => busybox-1.27.2} 
(94%)
 rename tools/cluster_sim_uml/uml/config/{linux-4.10.1-i686 => 
linux-4.13.3-i686} (92%)
 rename tools/cluster_sim_uml/uml/config/{linux-4.10.1-x86_64 => 
linux-4.13.3-x86_64} (92%)

diff --git a/tools/cluster_sim_uml/README b/tools/cluster_sim_uml/README
index 384a2ee13..1d5912156 100644
--- a/tools/cluster_sim_uml/README
+++ b/tools/cluster_sim_uml/README
@@ -135,6 +135,12 @@ OSAF_UML_DYNAMIC_MAC to 1:
 
 export OSAF_UML_DYNAMIC_MAC=1
 
+It is possible to choose IP address range, and select IPv4 or IPv6 addresses,
+using the IPADDRBASE environment variable. For example, to use IPv6 address you
+can use the following command:
+
+export IPADDRBASE=fe80::
+
 Running the cluster adds the following directories:
 
 repl-opensaf This directory contains a simulated shared replicated disk
diff --git a/tools/cluster_sim_uml/archive/scripts/10net.rc 
b/tools/cluster_sim_uml/archive/scripts/10net.rc
index 79d701f36..e93224578 100644
--- a/tools/cluster_sim_uml/archive/scripts/10net.rc
+++ b/tools/cluster_sim_uml/archive/scripts/10net.rc
@@ -21,12 +21,25 @@ errquit() {
 exit 1
 }
 
+grep -q ::1 /etc/hosts
+ipv6_address=$?
+
 p=$(ifconfig eth0 | grep HWaddr | sed -e 's,.*HWaddr,,' |cut -d: -f6 |tr -d ' 
')
 q=$(ifconfig eth0 | grep HWaddr | sed -e 's,.*HWaddr,,' |cut -d: -f5 |tr -d ' 
')
 test -n "$p" || errquit "No eth0 address found"
 test -n "$q" || errquit "No eth0 address found"
-ifconfig eth0 192.168.$((0x$q)).$((0x$p)) netmask 255.255.0.0
-route add default gw 192.168.254.1
+if [ $ipv6_address -eq 0 ]; then
+#  echo 0 > /proc/sys/net/ipv6/conf/eth0/accept_dad
+   IPADDRBASE=$(tail -1 /etc/hosts| cut -d" " -f1 | sed -e 's/[^\:]*$//')
+   IPADDRSUFFIX=$(echo $q$p | sed -e 's/^0*//')
+   ifconfig eth0 up add $IPADDRBASE$IPADDRSUFFIX/64
+   route add default gw 192.168.254.1
+else
+   IPADDRBASE=$(tail -1 /etc/hosts| cut -d" " -f1 | sed -e 
's/[^\.]*\.[^\.]*$//')
+   IPADDRSUFFIX=$((0x$q)).$((0x$p))
+   ifconfig eth0 $IPADDRBASE$IPADDRSUFFIX netmask 255.255.0.0
+   route add default gw ${IPADDRBASE}254.1
+fi
 
 inetd || errquit "Failed to start inetd"
 
diff --git a/tools/cluster_sim_uml/archive/scripts/40opensaf.rc 
b/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
index 0df971c8d..7df4cfee6 100644
--- a/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
+++ b/tools/cluster_sim_uml/archive/scripts/40opensaf.rc
@@ -63,11 +63,13 @@ rm -f /etc/opensaf/subslot_id
 rm -f /etc/opensaf/node_id
 echo "$hostnumber" > /etc/opensaf/slot_id
 echo 15 > /etc/opensaf/subslot_id
-sed -i "s/DTM_NODE_IP=.*/DTM_NODE_IP=192.168.$((hostnumber / 
256)).$((hostnumber % 256))/" /etc/opensaf/dtmd.conf
+node_name=$(hostname)
+node_ip=$(grep "$node_name.opensaf.org  $node_name" /etc/hosts | cut -d" " -f 
1)
+sed -i "s/DTM_NODE_IP=.*/DTM_NODE_IP=$node_ip/" /etc/opensaf/dtmd.conf
 
 # Generate node unique node_name & node_id files
 rm -f /etc/opensaf/node_name /etc/opensaf/node_id
-hostname > /etc/opensaf/node_name
+echo "$node_name" > /etc/opensaf/node_name
 
 # Enable core dumps for opensaf and AMF started programs
 # Somehow the UML kernel cannot write to hostfs
diff --git a/tools/cluster_sim_uml/build_uml b/tools/cluster_sim_uml/build_uml
index 39b0bee69..b9f224360 100755
--- a/tools/cluster_sim_uml/build_uml
+++ b/tools/cluster_sim_uml/build_uml
@@ -313,6 +313,12 @@ cmd_installibs() {
if [ -e $d/libthread_db.so.? ]; then
echo $d/libthread_db.so.? >> $deplib
fi
+   if [ -e $d/libffi.so.? ]; then
+   echo $d/libffi.so.? >> $deplib
+   fi
+   if [ -e /usr$d/libffi.so.? ]; then
+   echo /usr$d/libffi.so.? >> $deplib
+   fi
 done
 
 for n in $(cat $deplib | sort | uniq); do
diff --git a/tools/cluster_sim_uml/opensaf b/tools/cluster_sim_uml/opensaf
index 55e7339ba..5c3f23c62 100755
--- a/tools/cluster_sim_uml/opensaf
+++ b/tools/cluster_sim_uml/opensaf
@@ -54,11 +54,15 @@ if test -d ./rootfs; then
 NUMNODES=${2:-$immxml_node_count}
 fi
 OSAF_UML_MAX_TERMS=${OSAF_UML_MAX_TERMS:-5}

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

Re: [devel] [PATCH 1/1] smf: try to wait for opensafd status before reboot [#2464]

2017-09-25 Thread Lennart Lund
Ack

Thanks
Lennart

> -Original Message-
> From: Rafael Odzakow
> Sent: den 14 september 2017 13:34
> To: Lennart Lund 
> Cc: opensaf-devel@lists.sourceforge.net; Rafael Odzakow
> 
> Subject: [PATCH 1/1] smf: try to wait for opensafd status before reboot
> [#2464]
> 
> There are cases when opensafd startup is still ongoing and SMF will send
> out a reboot command for a node. Because opensafd has taken a lock the
> reboot command will not be able to call opensafd stop. It is suggested
> that SMF tries to wait for the release of the lock with "opensafd
> status". The waiting time is short and SMF continues with reboot even if
> the lock is not released.
> 
> - Change smf remote command to have two versions, one that logs errors of
>   the endpoint command and one without error logging.
> ---
>  src/smf/smfd/SmfUpgradeStep.cc |  24 ++
>  src/smf/smfd/smfd_smfnd.c  | 100 ++--
> -
>  src/smf/smfd/smfd_smfnd.h  |   8 +++-
>  3 files changed, 95 insertions(+), 37 deletions(-)
> 
> diff --git a/src/smf/smfd/SmfUpgradeStep.cc
> b/src/smf/smfd/SmfUpgradeStep.cc
> index ddd96a0..d40fac4 100644
> --- a/src/smf/smfd/SmfUpgradeStep.cc
> +++ b/src/smf/smfd/SmfUpgradeStep.cc
> @@ -54,6 +54,7 @@
>  #include "smf/smfd/SmfRollback.h"
>  #include "smf/smfd/SmfUtils.h"
>  #include "osaf/immutil/immutil.h"
> +#include "osaf/configmake.h"
>  #include "smf/smfd/smfd_smfnd.h"
>  #include "smfd.h"
>  #include "base/osaf_time.h"
> @@ -2316,6 +2317,29 @@ bool SmfUpgradeStep::nodeReboot() {
>goto done;
>  }
> 
> +// Wait for a good opensafd status. If retrying fails give up and reboot
> +// anyway.
> +int counter = 0;
> +while (counter < 5) {
> +  TRACE("check status of opensafd");
> +  std::string command = LSBINITDIR;
> +  command += "/opensafd status";
> +  cmdrc = smfnd_exec_remote_cmdnolog(command.c_str(), ,
> + cliTimeout, localTimeout);
> +  if ((cmdrc  & 0x) == SMFSV_CMD_RESULT_CODE &&
> +  (cmdrc & 0x) != 0) {
> +  // The status is not OK, try again
> +  LOG_WA("opensafd status, retcode[%u] retry in 2 seconds",
> + cmdrc & 0x);
> +  struct timespec time = {2, 0};
> +  osaf_nanosleep();
> +  counter += 1;
> +  } else {
> +LOG_NO("opensafd status OK");
> +break;
> +  }
> +}
> +
>  /* When executing a reboot command on a node the command will never
> return
> so we want a short local timeout. Since the smfnd is handling the
> cli timeout we want that to be much longer so that the reboot command
> diff --git a/src/smf/smfd/smfd_smfnd.c b/src/smf/smfd/smfd_smfnd.c
> index 7aadaf9..c48adb2 100644
> --- a/src/smf/smfd/smfd_smfnd.c
> +++ b/src/smf/smfd/smfd_smfnd.c
> @@ -230,6 +230,44 @@ uint32_t smfnd_down(SaClmNodeIdT i_node_id)
>   return NCSCC_RC_FAILURE;
>  }
> 
> +/*
> +   Log errors from smfnd_main_remote_command
> + * @param i_cmd Name of remote command that was executed
> + * @param i_timeout Max time out for the remote command in 10 ms
> + * @param i_result Result code from smfnd_main_remote_cmd
> +*/
> +void log_rsp_errors(const char *i_cmd, uint32_t i_timeout, uint32_t
> i_result) {
> +  if (i_result != 0) { /* 0 = cmd OK */
> +switch (i_result & 0x) {
> +  case SMFSV_CMD_EXEC_FAILED: {
> +LOG_ER("Command %s failed to start (%u)",
> +   i_cmd, i_result & 0x);
> +break;
> +  }
> +  case SMFSV_CMD_TIMEOUT: {
> +LOG_ER("Command %s timed out (timeout %u ms)",
> +   i_cmd, i_timeout * 10);
> +break;
> +  }
> +  case SMFSV_CMD_RESULT_CODE: {
> +LOG_ER("Command %s returned error %u",
> +   i_cmd, i_result & 0x);
> +break;
> +  }
> +  case SMFSV_CMD_SIGNAL_TERM: {
> +LOG_ER("Command %s terminated by signal %u",
> +   i_cmd, i_result & 0x);
> +break;
> +  }
> +  default: {
> +LOG_ER("Command %s failed by unknown reason %x",
> +   i_cmd, i_result);
> +break;
> +  }
> +} // switch
> +  } // if
> +}
> +
>  /**
>   * smfnd_exec_remote_cmd
>   * @param i_cmd Remote command to be executed
> @@ -237,9 +275,11 @@ uint32_t smfnd_down(SaClmNodeIdT i_node_id)
>   * the command
>   * @param i_timeout Max time the command may take in 10 ms
>   */
> -uint32_t smfnd_exec_remote_cmd(const char *i_cmd, const
> SmfndNodeDest *i_smfnd,
> -uint32_t i_timeout, uint32_t i_localTimeout)
> -{
> +uint32_t smfnd_main_remote_cmd(const char *i_cmd,
> +   const SmfndNodeDest *i_smfnd,
> +   uint32_t i_timeout,
> +   uint32_t i_localTimeout,
> +   bool error_log) {
>