osaf/libs/core/common/daemon.c      |  2 +-
 osaf/services/saf/amf/amfd/ndfsm.cc |  5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)


amfd to exit immediately upon receiving local amfnd down [#728]
Today amfd exits when the /etc/init.d/opensafd script invokes osaf-amfd clc-cli
script. This delayed exit can cause two problems 1) amfd exit can create a
race with dtmd exit 2) The delayed exit can create problems during failover
like say the amfd on the new active becomes functionally active and the old
active still has a stale amfd.
This patch makes AMFD exit immediately using daemon_exit()
upon recieving amfnd down event.

diff --git a/osaf/libs/core/common/daemon.c b/osaf/libs/core/common/daemon.c
--- a/osaf/libs/core/common/daemon.c
+++ b/osaf/libs/core/common/daemon.c
@@ -369,7 +369,7 @@ static void sigterm_handler(int sig)
  */
 void daemon_exit(void)
 {
-       syslog(LOG_NOTICE, "exiting on signal %d", SIGTERM);
+       syslog(LOG_NOTICE, "exiting for opensaf shutdown");
 
        if (__gcov_flush) {
                __gcov_flush();
diff --git a/osaf/services/saf/amf/amfd/ndfsm.cc 
b/osaf/services/saf/amf/amfd/ndfsm.cc
--- a/osaf/services/saf/amf/amfd/ndfsm.cc
+++ b/osaf/services/saf/amf/amfd/ndfsm.cc
@@ -27,6 +27,7 @@
 
 #include <amfd.h>
 #include <cluster.h>
+#include <daemon.h>
 
 /*****************************************************************************
  * Function: avd_node_up_func
@@ -321,8 +322,7 @@ void avd_mds_avnd_down_evh(AVD_CL_CB *cb
                // Do nothing if the local node goes down. Most likely due to 
system shutdown.
                // If node director goes down due to a bug, the AMF watchdog 
will restart the node.
                if (node->node_info.nodeId == cb->node_id_avd) {
-                       TRACE("Ignoring down event for local node director");
-                       goto done;
+                       daemon_exit();
                }
 
                if (avd_cb->avail_state_avd == SA_AMF_HA_ACTIVE) {
@@ -356,7 +356,6 @@ void avd_mds_avnd_down_evh(AVD_CL_CB *cb
                        delete node_fovr;
                }
        }
-done:
        TRACE_LEAVE();
 }
 

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to