Ack,
Mathi.

>-----Original Message-----
>From: Anders Widell [mailto:[email protected]]
>Sent: Monday, February 29, 2016 8:01 PM
>To: Mathivanan Naickan Palanivelu
>Cc: [email protected]
>Subject: [PATCH 1 of 1] lck: Support AMF configurations containing more than
>two OpenSAF 2N SUs [#79]
>
> osaf/libs/common/glsv/include/gld_api.h |    6 +
> osaf/libs/common/glsv/include/gld_cb.h  |    2 +
> osaf/services/saf/glsv/gld/gld_amf.c    |    9 ++
> osaf/services/saf/glsv/gld/gld_api.c    |  111 ++++++++++++++++++------------
>-
> 4 files changed, 80 insertions(+), 48 deletions(-)
>
>
>Add support for configuring the system with more than two OpenSAF 2N SUs.
>In particular, this means that all OpenSAF directors must support starting up
>and running without (initially) getting any assignment from AMF. Locking of an
>OpenSAF 2N SU is currently not supported on a system configured with more
>than two OpenSAF 2N SUs.
>
>diff --git a/osaf/libs/common/glsv/include/gld_api.h
>b/osaf/libs/common/glsv/include/gld_api.h
>--- a/osaf/libs/common/glsv/include/gld_api.h
>+++ b/osaf/libs/common/glsv/include/gld_api.h
>@@ -17,7 +17,13 @@
>
> #ifndef GLD_API_H
> #define GLD_API_H
>+
>+#include <stdint.h>
>+#include "saAmf.h"
>+
> uint32_t gld_se_lib_init(NCS_LIB_REQ_INFO *req_info);
>+uint32_t initialize_for_assignment(GLSV_GLD_CB *cb,
>+                                   SaAmfHAStateT ha_state);
> uint32_t gld_se_lib_destroy(NCS_LIB_REQ_INFO *req_info);  void
>gld_process_mbx(SYSF_MBX *mbx);
>
>diff --git a/osaf/libs/common/glsv/include/gld_cb.h
>b/osaf/libs/common/glsv/include/gld_cb.h
>--- a/osaf/libs/common/glsv/include/gld_cb.h
>+++ b/osaf/libs/common/glsv/include/gld_cb.h
>@@ -18,6 +18,7 @@
> #ifndef GLD_CB_H
> #define GLD_CB_H
>
>+#include <stdbool.h>
> #include "gld_tmr.h"
> #include "saImmOi.h"
>
>@@ -110,6 +111,7 @@ typedef struct glsv_gld_cb_tag {
>       SaSelectionObjectT imm_sel_obj; /*Selection object to wait for
>                                          IMM events */
>       bool is_impl_set;
>+      bool fully_initialized;
> } GLSV_GLD_CB;
>
> #define GLD_CB_NULL  ((GLSV_GLD_CB *)0) diff --git
>a/osaf/services/saf/glsv/gld/gld_amf.c
>b/osaf/services/saf/glsv/gld/gld_amf.c
>--- a/osaf/services/saf/glsv/gld/gld_amf.c
>+++ b/osaf/services/saf/glsv/gld/gld_amf.c
>@@ -74,10 +74,19 @@ gld_amf_CSI_set_callback(SaInvocationT i
>       GLSV_GLD_CB *gld_cb;
>       SaAisErrorT error = SA_AIS_OK;
>       V_DEST_RL mds_role;
>+      uint32_t rc;
>       TRACE_ENTER2("component name %s haState %d", compName-
>>value, haState);
>
>       gld_cb = m_GLSV_GLD_RETRIEVE_GLD_CB;
>       if (gld_cb != NULL) {
>+              if ((rc = initialize_for_assignment(gld_cb, haState)) !=
>+                  NCSCC_RC_SUCCESS) {
>+                      LOG_ER("initialize_for_assignment FAILED %u",
>(unsigned) rc);
>+                      error = SA_AIS_ERR_FAILED_OPERATION;
>+                      saAmfResponse(gld_cb->amf_hdl, invocation, error);
>+                      m_GLSV_GLD_GIVEUP_GLD_CB;
>+                      goto end;
>+              }
>               if (gld_cb->ha_state == SA_AMF_HA_ACTIVE && haState ==
>SA_AMF_HA_QUIESCED) {
>                       mds_role = SA_AMF_HA_QUIESCED;
>
>diff --git a/osaf/services/saf/glsv/gld/gld_api.c
>b/osaf/services/saf/glsv/gld/gld_api.c
>--- a/osaf/services/saf/glsv/gld/gld_api.c
>+++ b/osaf/services/saf/glsv/gld/gld_api.c
>@@ -25,9 +25,11 @@
>
>***********************************************************
>*******************/
>
> #include "gld.h"
>-#include "gld_imm.h"
> #include <poll.h>
> #include <string.h>
>+#include <stdlib.h>
>+#include "gld_imm.h"
>+
> uint32_t gl_gld_hdl;
>
> void gld_main_process(SYSF_MBX *mbx);
>@@ -145,49 +147,10 @@ uint32_t gld_se_lib_init(NCS_LIB_REQ_INF
>       }
>       TRACE_1("AMF Initialize success");
>
>-      /* Bind to MDS */
>-      if (gld_mds_init(gld_cb) != NCSCC_RC_SUCCESS) {
>-              saAmfFinalize(gld_cb->amf_hdl);
>-              m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>-              TRACE_2("MDS Install failed");
>-              res = NCSCC_RC_FAILURE;
>-              goto end;
>-      } else
>-              TRACE_1("MDS Install success");
>-
>-      /*   Initialise with the MBCSV service  */
>-      if (glsv_gld_mbcsv_register(gld_cb) != NCSCC_RC_SUCCESS) {
>-              TRACE_2("GLD mbcsv init failed");
>-              gld_mds_shut(gld_cb);
>-              saAmfFinalize(gld_cb->amf_hdl);
>-              m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>-              res = NCSCC_RC_FAILURE;
>-              goto end;
>-
>-      } else {
>-              TRACE_1("GLD mbcsv init success");
>-
>-      }
>-
>-      /* register glsv with imm */
>-      amf_error = gld_imm_init(gld_cb);
>-      if (amf_error != SA_AIS_OK) {
>-              glsv_gld_mbcsv_unregister(gld_cb);
>-              gld_mds_shut(gld_cb);
>-              saAmfFinalize(gld_cb->amf_hdl);
>-              m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>-              LOG_ER("Imm Init Failed %u\n", amf_error);
>-              res = NCSCC_RC_FAILURE;
>-              goto end;
>-      }
>-
>       /* TASK CREATION AND INITIALIZING THE MAILBOX */
>       if ((m_NCS_IPC_CREATE(&gld_cb->mbx) != NCSCC_RC_SUCCESS) ||
>           (m_NCS_IPC_ATTACH(&gld_cb->mbx) != NCSCC_RC_SUCCESS)) {
>               LOG_ER("Failure in task initiation");
>-              saImmOiFinalize(gld_cb->immOiHandle);
>-              glsv_gld_mbcsv_unregister(gld_cb);
>-              gld_mds_shut(gld_cb);
>               saAmfFinalize(gld_cb->amf_hdl);
>               m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL);
>               m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>@@ -203,9 +166,6 @@ uint32_t gld_se_lib_init(NCS_LIB_REQ_INF
>               LOG_ER("AMF Registration Failed");
>               m_NCS_EDU_HDL_FLUSH(&gld_cb->edu_hdl);
>               m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL);
>-              saImmOiFinalize(gld_cb->immOiHandle);
>-              glsv_gld_mbcsv_unregister(gld_cb);
>-              gld_mds_shut(gld_cb);
>               saAmfFinalize(gld_cb->amf_hdl);
>               m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>               res = NCSCC_RC_FAILURE;
>@@ -233,18 +193,66 @@ uint32_t gld_se_lib_init(NCS_LIB_REQ_INF
>               saAmfComponentUnregister(gld_cb->amf_hdl, &gld_cb-
>>comp_name, (SaNameT *)NULL);
>               m_NCS_EDU_HDL_FLUSH(&gld_cb->edu_hdl);
>               m_NCS_IPC_RELEASE(&gld_cb->mbx, NULL);
>-              saImmOiFinalize(gld_cb->immOiHandle);
>-              glsv_gld_mbcsv_unregister(gld_cb);
>-              gld_mds_shut(gld_cb);
>               saAmfFinalize(gld_cb->amf_hdl);
>               m_MMGR_FREE_GLSV_GLD_CB(gld_cb);
>       } else
>               TRACE_1("AMF Health Check started");
>+
>+      if ((res = initialize_for_assignment(gld_cb, gld_cb->ha_state)) !=
>+              NCSCC_RC_SUCCESS) {
>+              LOG_ER("initialize_for_assignment FAILED %u", (unsigned)
>res);
>+              exit(EXIT_FAILURE);
>+      }
>+
>  end:
>       TRACE_LEAVE();
>       return (res);
> }
>
>+uint32_t initialize_for_assignment(GLSV_GLD_CB *cb, SaAmfHAStateT
>+ha_state) {
>+      TRACE_ENTER2("ha_state = %d", (int) ha_state);
>+      uint32_t rc = NCSCC_RC_SUCCESS;
>+      SaAisErrorT amf_error;
>+      if (cb->fully_initialized || ha_state == SA_AMF_HA_QUIESCED) {
>+              goto done;
>+      }
>+
>+      /* Bind to MDS */
>+      if (gld_mds_init(cb) != NCSCC_RC_SUCCESS) {
>+              TRACE_2("MDS Install failed");
>+              rc = NCSCC_RC_FAILURE;
>+              goto done;
>+      } else {
>+              TRACE_1("MDS Install success");
>+      }
>+
>+      /*   Initialise with the MBCSV service  */
>+      if (glsv_gld_mbcsv_register(cb) != NCSCC_RC_SUCCESS) {
>+              TRACE_2("GLD mbcsv init failed");
>+              gld_mds_shut(cb);
>+              rc = NCSCC_RC_FAILURE;
>+              goto done;
>+      } else {
>+              TRACE_1("GLD mbcsv init success");
>+      }
>+
>+      /* register glsv with imm */
>+      amf_error = gld_imm_init(cb);
>+      if (amf_error != SA_AIS_OK) {
>+              glsv_gld_mbcsv_unregister(cb);
>+              gld_mds_shut(cb);
>+              LOG_ER("Imm Init Failed %u\n", (unsigned) amf_error);
>+              rc = NCSCC_RC_FAILURE;
>+              goto done;
>+      }
>+
>+      cb->fully_initialized = true;
>+done:
>+      TRACE_LEAVE2("rc = %u", rc);
>+      return rc;
>+}
>+
>
>/**********************************************************
>******************
>  * Name          : gld_se_lib_destroy
>  *
>@@ -338,6 +346,11 @@ uint32_t gld_cb_init(GLSV_GLD_CB *gld_cb
>
>       /* Initialize the next resource id */
>       gld_cb->nxt_rsc_id = 1;
>+
>+      gld_cb->ha_state = SA_AMF_HA_QUIESCED;
>+      gld_cb->mbcsv_sel_obj = -1;
>+      gld_cb->imm_sel_obj = -1;
>+      gld_cb->fully_initialized = false;
>  end:
>       TRACE_LEAVE();
>       return rc;
>@@ -504,14 +517,14 @@ void gld_main_process(SYSF_MBX *mbx)
>       fds[FD_TERM].events = POLLIN;
>       fds[FD_AMF].fd = amf_sel_obj;
>       fds[FD_AMF].events = POLLIN;
>-      fds[FD_MBCSV].fd = gld_cb->mbcsv_sel_obj;
>-      fds[FD_MBCSV].events = POLLIN;
>       fds[FD_MBX].fd = mbx_fd.rmv_obj;
>       fds[FD_MBX].events = POLLIN;
>       fds[FD_IMM].fd = gld_cb->imm_sel_obj;
>       fds[FD_IMM].events = POLLIN;
>
>       while (1) {
>+              fds[FD_MBCSV].fd = gld_cb->mbcsv_sel_obj;
>+              fds[FD_MBCSV].events = POLLIN;
>               if ((gld_cb->immOiHandle != 0) && (gld_cb->is_impl_set ==
>true)){
>                       fds[FD_IMM].fd = gld_cb->imm_sel_obj;
>                       fds[FD_IMM].events = POLLIN;
>@@ -581,7 +594,9 @@ void gld_main_process(SYSF_MBX *mbx)
>                                ** close resource requests. That is needed
>since the IMM OI
>                                ** is used in context of these functions.
>                                */
>+                              saImmOiFinalize(gld_cb->immOiHandle);
>                               gld_cb->immOiHandle = 0;
>+                              gld_cb->imm_sel_obj = -1;
>                               gld_cb->is_impl_set = false;
>                               gld_imm_reinit_bg(gld_cb);
>                       } else if (error != SA_AIS_OK) {

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to