[devel] [PATCH 1/1] amfnd: Buffered not-ack susi assignment response after both SC go down [#2105]

2017-05-15 Thread Minh Chau
When amfnd-payload responds susi assignment response just before both SC
go down, and that response message does not come to director. Therefore,
the status of that assignment could be seen as "modifying" in IMM. When
SC comes back, active amfd will be waiting for that response forever.

Patch checks if a susi assignment response is sent but not-ack just before
both SC come down, amfnd-payload will buffer it in a way as a susi get
assigned during SC absence
---
 src/amf/amfnd/di.cc | 53 +
 1 file changed, 45 insertions(+), 8 deletions(-)

diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc
index e06b9260d..3776a09dc 100644
--- a/src/amf/amfnd/di.cc
+++ b/src/amf/amfnd/di.cc
@@ -1282,16 +1282,53 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t mid) 
{
   Notes : None.
 **/
 void avnd_diq_del(AVND_CB *cb) {
-  AVND_DND_MSG_LIST *rec = 0;
 
-  do {
-/* pop the record */
-m_AVND_DIQ_REC_POP(cb, rec);
-if (!rec) break;
+  if ((cb->dnd_list.head != nullptr)) {
+AVND_DND_MSG_LIST *rec = 0;
+bool found = true;
+while (found) {
+  found = false;
+  for (rec = cb->dnd_list.head; rec != nullptr;
+   rec = rec->next) {
+osafassert(rec->msg.type == AVND_MSG_AVD);
+// delete all pending messages that haven't been sent out
+if (rec->no_retries == 0) {
+  m_AVND_DIQ_REC_POP(cb, rec);
+  avnd_diq_rec_del(cb, rec);
+  break;
+} else {
+  // Assignment response had been sent, but not ack because last
+  // controller go down, reset msg_id and will be resent later
+  if (rec->msg.info.avd->msg_type == AVSV_N2D_INFO_SU_SI_ASSIGN_MSG) {
+if (rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id != 0) {
+  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id = 0;
+  found = true;
+  LOG_NO(
+  "Found not-ack su_si_assign msg for SU:'%s', "
+  "SI:'%s', ha_state:'%u', msg_act:'%u', single_csi:'%u', "
+  "error:'%u', msg_id:'%u'",
+  osaf_extended_name_borrow(>msg.info.avd->msg_info
+ .n2d_su_si_assign.su_name),
+  osaf_extended_name_borrow(>msg.info.avd->msg_info
+ .n2d_su_si_assign.si_name),
+  rec->msg.info.avd->msg_info.n2d_su_si_assign.ha_state,
+  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_act,
+  rec->msg.info.avd->msg_info.n2d_su_si_assign
+  .single_csi,
+  rec->msg.info.avd->msg_info.n2d_su_si_assign.error,
+  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id);
+}
+  } else {
+// delete other messages for now
+m_AVND_DIQ_REC_POP(cb, rec);
+avnd_diq_rec_del(cb, rec);
+break;
+  }
+}
 
-/* delete the record */
-avnd_diq_rec_del(cb, rec);
-  } while (1);
+  }
+}
+  }
 
   return;
 }
-- 
2.11.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 amfnd: Buffered not-ack susi assignment response after both SC go down [#2105]

2017-05-15 Thread Minh Chau
Summary: amfnd: Buffered not-ack susi assignment response after both SC go down 
[#2105]
Review request for Ticket(s): 2105
Peer Reviewer(s): AMF maintainers
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop, release
Development branch: ticket-2105
Base revision: 8c09ce778f01cd0b202a2b7b9fd51dbc14648674
Personal repository: git://git.code.sf.net/u/minh-chau/review


Impacted area   Impact y/n

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


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

revision 5a9aa990ec25dc2b1a12d82abe336b075ad0ad6a
Author: Minh Chau 
Date:   Mon, 15 May 2017 17:15:38 +1000

amfnd: Buffered not-ack susi assignment response after both SC go down [#2105]

When amfnd-payload responds susi assignment response just before both SC
go down, and that response message does not come to director. Therefore,
the status of that assignment could be seen as "modifying" in IMM. When
SC comes back, active amfd will be waiting for that response forever.

Patch checks if a susi assignment response is sent but not-ack just before
both SC come down, amfnd-payload will buffer it in a way as a susi get
assigned during SC absence



Complete diffstat:
--
 src/amf/amfnd/di.cc | 53 +
 1 file changed, 45 insertions(+), 8 deletions(-)


Testing Commands:
-
Add sleep a few seconds in avnd_mds_svc_evt() when amfnd receives NCSMDS_DOWN
Repeat the test case of #2416


Testing, Expected Results:
--
All app SIs get assigned after SC comes back


Conditions of Submission:
-
ack from reviewers


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

[devel] [PATCH 0/1] Review Request for log: refactor log agent - 2nd increment [#2412] V4

2017-05-15 Thread Vu Minh Nguyen
Summary: log: refactor log agent - 2nd increment [#2412]
Review request for Ticket(s): 2412
Peer Reviewer(s): LOG Devs
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2412
Base revision: 8c09ce778f01cd0b202a2b7b9fd51dbc14648674
Personal repository: git://git.code.sf.net/u/winhvu/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 ab6cf7db983cc97ad4e4b5e39327bd9c72004d11
Author: Vu Minh Nguyen 
Date:   Mon, 15 May 2017 12:39:12 +0200

log: refactor log agent - 2nd increment [#2412]

The major changes are:
1) Replacing C database of client list and stream list to C++.
2) Centralizing databases read/write to one place
3) Remove global log agent control block



Added Files:

 src/log/agent/lga_agent.cc
 src/log/agent/lga_agent.h
 src/log/agent/lga_client.cc
 src/log/agent/lga_client.h
 src/log/agent/lga_common.h
 src/log/agent/lga_stream.cc
 src/log/agent/lga_stream.h
 src/log/apitest/tet_multiple_thread.c


Removed Files:
--
 src/log/agent/lga_api.h
 src/log/agent/lga.h


Complete diffstat:
--
 src/log/Makefile.am   |   16 +-
 src/log/agent/lga.h   |  137 
 src/log/agent/lga_agent.cc| 1445 +
 src/log/agent/lga_agent.h |  408 ++
 src/log/agent/lga_api.cc  | 1435 +---
 src/log/agent/lga_api.h   |   70 --
 src/log/agent/lga_client.cc   |  439 ++
 src/log/agent/lga_client.h|  305 +++
 src/log/agent/lga_common.h|   68 ++
 src/log/agent/lga_mds.cc  |  428 +-
 src/log/agent/lga_mds.h   |7 +-
 src/log/agent/lga_state.cc|  509 ++--
 src/log/agent/lga_state.h |   25 +-
 src/log/agent/lga_stream.cc   |  147 
 src/log/agent/lga_stream.h|  175 
 src/log/agent/lga_util.cc |  770 +-
 src/log/agent/lga_util.h  |   31 +-
 src/log/apitest/tet_multiple_thread.c |  317 
 18 files changed, 3624 insertions(+), 3108 deletions(-)


Testing Commands:
-
Run `logtest`. One new test suite is introduced
to verify if having any deadlock or coredump.


Testing, Expected Results:
--
All tests PASS


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 

[devel] [PATCH 0/1] Review Request for osaf: Support DESTDIR when installing OpenSAF samples [#2460]

2017-05-15 Thread Anders Widell
Summary: osaf: Support DESTDIR when installing OpenSAF samples [#2460]
Review request for Ticket(s): 2460
Peer Reviewer(s): Ramesh
Pull request to: 
Affected branch(es): develop
Development branch: ticket-2460
Base revision: 8c09ce778f01cd0b202a2b7b9fd51dbc14648674
Personal repository: git://git.code.sf.net/u/anders-w/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF 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 4b8b2ff831fb6ed818d400e30a7a035b70b77ad8
Author: Anders Widell 
Date:   Mon, 15 May 2017 12:31:07 +0200

osaf: Support DESTDIR when installing OpenSAF samples [#2460]

Add support for using DESTDIR to point to the installation root directory when
installing the OpenSAF sample programs.



Complete diffstat:
--
 samples/amf/proxy/Makefile.am| 6 +++---
 samples/amf/sa_aware/Makefile.am | 8 
 samples/amf/wrapper/Makefile.am  | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)


Testing Commands:
-
#Build the samples and then do:
make install DESTDIR=/tmp/sample_install_root


Testing, Expected Results:
--
Samples shall be installed in the specified directory


Conditions of Submission:
-
Ack from reviewer(s)


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


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


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

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

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

___ Your patches do not have proper short+long header

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

___ Your changes affect user manual and documentation, your patch series
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] osaf: Support DESTDIR when installing OpenSAF samples [#2460]

2017-05-15 Thread Anders Widell
Add support for using DESTDIR to point to the installation root directory when
installing the OpenSAF sample programs.
---
 samples/amf/proxy/Makefile.am| 6 +++---
 samples/amf/sa_aware/Makefile.am | 8 
 samples/amf/wrapper/Makefile.am  | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/samples/amf/proxy/Makefile.am b/samples/amf/proxy/Makefile.am
index 4ec2804..82ade4e 100644
--- a/samples/amf/proxy/Makefile.am
+++ b/samples/amf/proxy/Makefile.am
@@ -38,9 +38,9 @@ proxy_LDADD = \
@SAF_AIS_AMF_LIBS@
 
 install-data-hook:
-   mkdir -p /opt/amf_proxy_demo
-   cp proxy proxy_script proxied_script /opt/amf_proxy_demo
+   $(mkinstalldirs) $(DESTDIR)/opt/amf_proxy_demo
+   cp proxy proxy_script proxied_script $(DESTDIR)/opt/amf_proxy_demo
 
 uninstall-hook:
-   rm -rf /opt/amf_proxy_demo
+   rm -rf $(DESTDIR)/opt/amf_proxy_demo
 
diff --git a/samples/amf/sa_aware/Makefile.am b/samples/amf/sa_aware/Makefile.am
index c34f94a..dbb7c14 100644
--- a/samples/amf/sa_aware/Makefile.am
+++ b/samples/amf/sa_aware/Makefile.am
@@ -37,10 +37,10 @@ amf_demo_LDADD = \
@SAF_AIS_AMF_LIBS@
 
 install-data-hook:
-   mkdir -p /opt/amf_demo
-   cp amf_demo /opt/amf_demo
-   cp amf_demo_script /opt/amf_demo
+   $(mkinstalldirs) $(DESTDIR)/opt/amf_demo
+   cp amf_demo $(DESTDIR)/opt/amf_demo
+   cp amf_demo_script $(DESTDIR)/opt/amf_demo
 
 uninstall-hook:
-   rm -rf /opt/amf_demo
+   rm -rf $(DESTDIR)/opt/amf_demo
 
diff --git a/samples/amf/wrapper/Makefile.am b/samples/amf/wrapper/Makefile.am
index 529ae6b..ddb072b 100644
--- a/samples/amf/wrapper/Makefile.am
+++ b/samples/amf/wrapper/Makefile.am
@@ -37,8 +37,8 @@ wrapper_LDADD = \
@SAF_AIS_AMF_LIBS@
 
 install-data-hook:
-   cp wrapper.sh /usr/local/sbin
+   cp wrapper.sh $(DESTDIR)/usr/local/sbin
 
 uninstall-hook:
-   rm -f /usr/local/sbin/wrapper.sh
+   rm -f $(DESTDIR)/usr/local/sbin/wrapper.sh
 
-- 
1.9.1


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


Re: [devel] [PATCH 1/1] clm: add tool commands clm-adm, clm-state, clm-find [#2394]

2017-05-15 Thread Anders Widell
Ack with one comment: --admin_op should be renamed to --admin-op (dash instead 
of underscore as word separator).

regards,
Anders Widell


On 05/12/2017 11:54 AM, Praveen wrote:
> This is V2 which incorporates comments given on V1.
>
> clm-adm:  for performing CLM admin operations on CLM node and cluser.
> clm-find: for finding out object(s) configured for CLM classes SaClmCluster
>and SaClmNode. Additional options like membership status and admin 
> state
> can also be given to find out objects which satisfy this criteria.
> clm-state: for listing CLM node(s) and their important attributes.
> ---
>   opensaf.spec.in |   3 +
>   src/clm/Makefile.am |   5 ++
>   src/clm/tools/clm-adm   | 105 ++
>   src/clm/tools/clm-find  |  84 +++
>   src/clm/tools/clm-state | 148 
> 
>   5 files changed, 345 insertions(+)
>   create mode 100644 src/clm/tools/clm-adm
>   create mode 100644 src/clm/tools/clm-find
>   create mode 100644 src/clm/tools/clm-state
>
> diff --git a/opensaf.spec.in b/opensaf.spec.in
> index 0078fc2..70056b6 100644
> --- a/opensaf.spec.in
> +++ b/opensaf.spec.in
> @@ -1445,6 +1445,9 @@ fi
>   %{_bindir}/ntfsubscribe
>   %{_bindir}/ntfread
>   %{_bindir}/saflogger
> +%{_bindir}/clm-adm
> +%{_bindir}/clm-find
> +%{_bindir}/clm-state
>   %if %is_ais_smf
>   %{_bindir}/smf-adm
>   %{_bindir}/smf-find
> diff --git a/src/clm/Makefile.am b/src/clm/Makefile.am
> index ad9f90a..da2d7d9 100644
> --- a/src/clm/Makefile.am
> +++ b/src/clm/Makefile.am
> @@ -166,6 +166,11 @@ bin_osafclmna_LDADD = \
>   lib/libSaAmf.la \
>   lib/libopensaf_core.la
>   
> +dist_bin_SCRIPTS += \
> +   src/clm/tools/clm-adm \
> +   src/clm/tools/clm-find \
> +   src/clm/tools/clm-state
> +
>   if ENABLE_TESTS
>   
>   bin_PROGRAMS += bin/clmtest
> diff --git a/src/clm/tools/clm-adm b/src/clm/tools/clm-adm
> new file mode 100644
> index 000..ae75fe5
> --- /dev/null
> +++ b/src/clm/tools/clm-adm
> @@ -0,0 +1,105 @@
> +#! /bin/sh
> +#  -*- OpenSAF  -*-
> +#
> +# Copyright (C) 2017, Oracle and/or its affiliates. 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.
> +#
> +
> +usage()
> +{
> +  echo ""
> +  echo "USAGE: $(basename "$0") [-t value] <-o op_name>  "
> +  echo ""
> +  echo "OPTIONS:"
> +  echo "-t or --timeout : command timeout in seconds (default=60) 
> (optional)"
> +  echo "-o or --admin_op: operation name (mandatory)"
> +  echo " 'lock' for admin lock "
> +  echo " 'unlock'   for admin unlock "
> +  echo " 'shutdown' for admin shutdown "
> +  echo " 'reset'for admin reset of cluster"
> +  echo "DN  : a valid DN name of CLM node or cluster 
> (mandatory)"
> +  echo ""
> +  echo ""
> +}
> +
> +options=$(getopt -o t:o:h -l timeout:,admin_op:,help -- "$@")
> +status=$?
> +if [ $status -ne 0 ] ; then
> +  echo "Try '$(basename "$0") -h or --help' for more information"
> +  exit 1
> +fi
> +eval set -- "$options"
> +
> +DN=""
> +CMD=""
> +TIMEOUT=""
> +
> +while true; do
> +  case $1 in
> +-t|--timeout)
> +shift 1
> +TIMEOUT=$1;
> +shift 1
> +;;
> +-o|--admin_op)
> +shift 1
> +if [ "$1" = "unlock" ]; then
> +  CMD=1
> +elif [ "$1" = "lock" ]; then
> +  CMD=2
> +elif [ "$1" = "shutdown" ]; then
> +  CMD=3
> +elif [ "$1" = "reset" ]; then
> +  CMD=4
> +else
> +  echo "Invalid operation name"
> +  exit 1
> +fi
> +shift 1
> +;;
> +-h|--help)
> +usage
> +exit 0
> +;;
> +\?)
> +echo "Invalid option"
> +exit 1
> +;;
> +--)
> +shift;
> +break;
> +;;
> +esac
> +done
> +
> +if [ "$CMD" = "" ]; then
> +  echo "operation name is mandatory"
> +  echo "Try '$(basename "$0") -h or --help' for more information"
> +  exit 1
> +fi
> +
> +shift $((OPTIND -1))
> +
> +DN="$*"
> +if [ "$DN" = "" ]; then
> +  echo "DN name is mandatory"
> +  echo "Try '$(basename "$0") -h or 

[devel] [PATCH 1/1] base: Improve state report for opensafd [#2459]

2017-05-15 Thread Rafael Odzakow
Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"
---
 src/nid/opensafd.in | 19 ++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/nid/opensafd.in b/src/nid/opensafd.in
index e7683bd7e..54841c372 100644
--- a/src/nid/opensafd.in
+++ b/src/nid/opensafd.in
@@ -12,6 +12,17 @@
 # Description: Start and stop the OpenSAF node
 ### END INIT INFO
 
+# Exit codes:
+# 0: OK
+# 1: General error
+# 2: Argument error
+#
+# 'status' exit codes:
+# 0: OK
+# 1: AMF state error
+# 3: No AMF PID found
+# 4: Lockfile is taken, opensafd start/stop is in progress
+
 osafdirfile=@sysconfdir@/@PACKAGE_NAME@/osafdir.conf
 osafprog="opensafd"
 osafprog_inprogress="opensafd_inprogress"
@@ -326,9 +337,15 @@ forcereload() {
 }
 
 status() {
+
amfpid=`pidofproc -p $amfnd_pid $amfnd_bin`
-   if [ -n "$amfpid" ]; then
+
+   if [ -e "$lockfile_inprogress" ]; then
+echo "Lockfile taken, OpenSAF start/stop is in progress"
+RETVAL=4
+elif [ -n "$amfpid" ]; then
amf-state siass ha
+# Two possible error codes: 0 or 1
RETVAL=$?
else
echo "The OpenSAF HA Framework is not running"
-- 
2.11.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 state report for opensafd [#2459]

2017-05-15 Thread Rafael Odzakow
Summary: base: Improve state report for opensafd [#2459]
Review request for Ticket(s): 2459
Peer Reviewer(s): anders/hans
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop
Development branch: ticket-2459
Base revision: 8c09ce778f01cd0b202a2b7b9fd51dbc14648674
Personal repository: git://git.code.sf.net/u/erafodz/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts 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 5e1e02e828aa6be52034fdf134456cffbd94e9b9
Author: Rafael Odzakow 
Date:   Mon, 15 May 2017 15:49:13 +0200

base: Improve state report for opensafd [#2459]

Internally opensafd creates a lock file during start/stop to avoid
parallel execution. To allow others to query the state this ticket will
use the opensafd lockfile to report the status of start/stop when
requested with "opensafd status"



Complete diffstat:
--
 src/nid/opensafd.in | 19 ++-
 1 file changed, 18 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


Re: [devel] [PATCH 1/1] amfnd: Buffered not-ack susi assignment response after both SC go down [#2105]

2017-05-15 Thread praveen malviya
Hi Minh,

I am reviewing this patch.

Thanks,
Praveen

On 15-May-17 1:06 PM, Minh Chau wrote:
> When amfnd-payload responds susi assignment response just before both SC
> go down, and that response message does not come to director. Therefore,
> the status of that assignment could be seen as "modifying" in IMM. When
> SC comes back, active amfd will be waiting for that response forever.
> 
> Patch checks if a susi assignment response is sent but not-ack just before
> both SC come down, amfnd-payload will buffer it in a way as a susi get
> assigned during SC absence
> ---
>   src/amf/amfnd/di.cc | 53 
> +
>   1 file changed, 45 insertions(+), 8 deletions(-)
> 
> diff --git a/src/amf/amfnd/di.cc b/src/amf/amfnd/di.cc
> index e06b9260d..3776a09dc 100644
> --- a/src/amf/amfnd/di.cc
> +++ b/src/amf/amfnd/di.cc
> @@ -1282,16 +1282,53 @@ void avnd_di_msg_ack_process(AVND_CB *cb, uint32_t 
> mid) {
> Notes : None.
>   
> **/
>   void avnd_diq_del(AVND_CB *cb) {
> -  AVND_DND_MSG_LIST *rec = 0;
>   
> -  do {
> -/* pop the record */
> -m_AVND_DIQ_REC_POP(cb, rec);
> -if (!rec) break;
> +  if ((cb->dnd_list.head != nullptr)) {
> +AVND_DND_MSG_LIST *rec = 0;
> +bool found = true;
> +while (found) {
> +  found = false;
> +  for (rec = cb->dnd_list.head; rec != nullptr;
> +   rec = rec->next) {
> +osafassert(rec->msg.type == AVND_MSG_AVD);
> +// delete all pending messages that haven't been sent out
> +if (rec->no_retries == 0) {
> +  m_AVND_DIQ_REC_POP(cb, rec);
> +  avnd_diq_rec_del(cb, rec);
> +  break;
> +} else {
> +  // Assignment response had been sent, but not ack because last
> +  // controller go down, reset msg_id and will be resent later
> +  if (rec->msg.info.avd->msg_type == AVSV_N2D_INFO_SU_SI_ASSIGN_MSG) 
> {
> +if (rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id != 0) {
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id = 0;
> +  found = true;
> +  LOG_NO(
> +  "Found not-ack su_si_assign msg for SU:'%s', "
> +  "SI:'%s', ha_state:'%u', msg_act:'%u', single_csi:'%u', "
> +  "error:'%u', msg_id:'%u'",
> +  osaf_extended_name_borrow(>msg.info.avd->msg_info
> + .n2d_su_si_assign.su_name),
> +  osaf_extended_name_borrow(>msg.info.avd->msg_info
> + .n2d_su_si_assign.si_name),
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign.ha_state,
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_act,
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign
> +  .single_csi,
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign.error,
> +  rec->msg.info.avd->msg_info.n2d_su_si_assign.msg_id);
> +}
> +  } else {
> +// delete other messages for now
> +m_AVND_DIQ_REC_POP(cb, rec);
> +avnd_diq_rec_del(cb, rec);
> +break;
> +  }
> +}
>   
> -/* delete the record */
> -avnd_diq_rec_del(cb, rec);
> -  } while (1);
> +  }
> +}
> +  }
>   
> return;
>   }
> 

--
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: send oper_state when NCS SUs already instantiated [#2443]

2017-05-15 Thread praveen malviya

Hi Long,

This check is very generic.
During su restart cases, a PI SU having NPI components will send 
unnecessary enabled events to AMFD. When AMFD will receive this events 
it will try to assign this SU and can lead to assignments in other than 
2N red models cases.
I think check should be moved to the event handler of presence state 
message. Attached is the patch based on this idea.

What do you think?


Thanks
Praveen

On 28-Apr-17 9:42 AM, Long H Buu Nguyen wrote:

---
  src/amf/amfnd/susm.cc | 10 ++
  1 file changed, 10 insertions(+)

diff --git a/src/amf/amfnd/susm.cc b/src/amf/amfnd/susm.cc
index 52af63b83..04ced426d 100644
--- a/src/amf/amfnd/susm.cc
+++ b/src/amf/amfnd/susm.cc
@@ -1608,6 +1608,16 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *cb, AVND_SU *su, 
AVND_COMP *comp,
/* process state change */
if (prv_st != final_st)
  rc = avnd_su_pres_st_chng_prc(cb, su, prv_st, final_st);
+  else {
+// If SU has been already instantiated, inform amfd
+if (SA_AMF_PRESENCE_INSTANTIATED == final_st &&
+su_all_pi_comps_instantiated(su) == true) {
+  if (m_AVND_SU_OPER_STATE_IS_ENABLED(su)) {
+TRACE("SU oper state is enabled");
+rc = avnd_di_oper_send(cb, su, 0);
+  }
+}
+  }
  
  done:

TRACE_LEAVE2("%u", rc);

diff --git a/src/amf/amfnd/susm.cc b/src/amf/amfnd/susm.cc
index 04ced42..18b8fc8 100644
--- a/src/amf/amfnd/susm.cc
+++ b/src/amf/amfnd/susm.cc
@@ -1608,16 +1608,6 @@ uint32_t avnd_su_pres_fsm_run(AVND_CB *cb, AVND_SU *su, 
AVND_COMP *comp,
   /* process state change */
   if (prv_st != final_st)
 rc = avnd_su_pres_st_chng_prc(cb, su, prv_st, final_st);
-  else {
-// If SU has been already instantiated, inform amfd
-if (SA_AMF_PRESENCE_INSTANTIATED == final_st &&
-su_all_pi_comps_instantiated(su) == true) {
-  if (m_AVND_SU_OPER_STATE_IS_ENABLED(su)) {
-TRACE("SU oper state is enabled");
-rc = avnd_di_oper_send(cb, su, 0);
-  }
-}
-  }
 
 done:
   TRACE_LEAVE2("%u", rc);
@@ -4133,7 +4123,16 @@ uint32_t avnd_evt_ir_evh(struct avnd_cb_tag *cb, struct 
avnd_evt_tag *evt) {
 }
 TRACE("SU instantiation for PI SUs, running the SU presence state 
FSM:'%s'",
   su->name.c_str());
-rc = avnd_su_pres_fsm_run(cb, su, 0, AVND_SU_PRES_FSM_EV_INST);
+// If SU has been already instantiated, inform amfd
+if ((cb->led_state == AVND_LED_STATE_RED) &&
+(su->pres == SA_AMF_PRESENCE_INSTANTIATED) &&
+(su_all_pi_comps_instantiated(su) == true) &&
+(m_AVND_SU_OPER_STATE_IS_ENABLED(su))) {
+TRACE("SU oper state is enabled and pres state is instantiated.");
+rc = avnd_di_oper_send(cb, su, 0);
+} else {
+rc = avnd_su_pres_fsm_run(cb, su, 0, AVND_SU_PRES_FSM_EV_INST);
+}
   } else {
 if (m_AVND_SU_IS_REG_FAILED(su)) {
   /* The SU configuration is bad, we cannot do much other transition to
--
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