In the ticket 3291, a new message was introduced.
We need increase the log subpart version to figure
out a log director support that message or not.
---
 src/log/agent/lga_agent.cc | 26 +++++++++++++-------------
 src/log/agent/lga_mds.cc   | 23 +++++++++++++++++++----
 src/log/agent/lga_mds.h    |  2 ++
 3 files changed, 34 insertions(+), 17 deletions(-)

diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
index acbb18884..8cc8d6cfa 100644
--- a/src/log/agent/lga_agent.cc
+++ b/src/log/agent/lga_agent.cc
@@ -339,19 +339,19 @@ unsigned int LogAgent::WaitLogServerUp(int64_t 
polling_timeout) {
     goto done;
   }
 
-  // Wait for initial clm status
-  status = osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(init_clm_status_sel_),
-                            timeout);
-  if (status == 0) {
-    // The server may not support this signal
-    // or it's dropped.
-    TRACE("Waiting for initial clm status timeout");
-    rc = NCSCC_RC_SUCCESS;
-    goto done;
-  } else if (status < 0) {
-    TRACE("Waiting for initial clm status failed: %s", strerror(errno));
-    rc = NCSCC_RC_FAILURE;
-    goto done;
+  if (lga_mds_msg_does_support_init_clm_status()) {
+    // Wait for initial clm status
+    status = osaf_poll_one_fd(m_GET_FD_FROM_SEL_OBJ(init_clm_status_sel_),
+                              timeout);
+    if (status == 0) {
+      TRACE("Waiting for initial clm status timeout");
+      rc = NCSCC_RC_SUCCESS;
+      goto done;
+    } else if (status < 0) {
+      TRACE("Waiting for initial clm status failed: %s", strerror(errno));
+      rc = NCSCC_RC_FAILURE;
+      goto done;
+    }
   }
 
   // Log server was up and detected this agent. Stop waiting
diff --git a/src/log/agent/lga_mds.cc b/src/log/agent/lga_mds.cc
index a7ce61b47..828a25445 100644
--- a/src/log/agent/lga_mds.cc
+++ b/src/log/agent/lga_mds.cc
@@ -29,16 +29,19 @@
 #include "log/agent/lga_common.h"
 #include "log/common/lgsv_defs.h"
 
-#define LGA_SVC_PVT_SUBPART_VERSION 1
+#define LGA_SVC_PVT_SUBPART_VERSION 2
 #define LGA_WRT_LGS_SUBPART_VER_AT_MIN_MSG_FMT 1
-#define LGA_WRT_LGS_SUBPART_VER_AT_MAX_MSG_FMT 1
+#define LGA_WRT_LGS_SUBPART_VER_AT_MAX_MSG_FMT 2
 #define LGA_WRT_LGS_SUBPART_VER_RANGE       \
   (LGA_WRT_LGS_SUBPART_VER_AT_MAX_MSG_FMT - \
    LGA_WRT_LGS_SUBPART_VER_AT_MIN_MSG_FMT + 1)
+#define LGA_SVC_PVT_INIT_CLM_STATE_SUBPART_VERSION 2
 
-// msg format version for LGA subpart version 1
+// msg format version for LGA subpart version 2
 static MDS_CLIENT_MSG_FORMAT_VER
-    LGA_WRT_LGS_MSG_FMT_ARRAY[LGA_WRT_LGS_SUBPART_VER_RANGE] = {1};
+    LGA_WRT_LGS_MSG_FMT_ARRAY[LGA_WRT_LGS_SUBPART_VER_RANGE] = {1, 2};
+
+static MDS_SVC_PVT_SUB_PART_VER rem_svc_pvt_ver = LGA_SVC_PVT_SUBPART_VERSION;
 
 /****************************************************************************
   Name          : lga_enc_initialize_msg
@@ -719,6 +722,7 @@ static uint32_t lga_mds_svc_evt(struct ncsmds_callback_info 
*mds_cb_info) {
               mds_cb_info->info.svc_evt.i_dest);
           // Inform LOG server is up
           LogAgent::instance()->MarkLogServerUp();
+          rem_svc_pvt_ver = mds_cb_info->info.svc_evt.i_rem_svc_pvt_ver;
           // Start recovery
           lga_serv_recov1state_set();
           break;
@@ -1459,6 +1463,17 @@ uint32_t lga_mds_msg_async_send(lgsv_msg_t *i_msg, 
uint32_t prio) {
   return rc;
 }
 
+/****************************************************************************
+ * Name          : lga_mds_msg_does_support_init_clm_status
+ *
+ * Description   : Check if the init clm status is supported or not
+ *
+ * Return Values : true/false
+ *****************************************************************************/
+bool lga_mds_msg_does_support_init_clm_status() {
+  return rem_svc_pvt_ver >= LGA_SVC_PVT_INIT_CLM_STATE_SUBPART_VERSION;
+}
+
 /****************************************************************************
  * Name          : lga_msg_destroy
  *
diff --git a/src/log/agent/lga_mds.h b/src/log/agent/lga_mds.h
index af5608849..b06b25bd4 100644
--- a/src/log/agent/lga_mds.h
+++ b/src/log/agent/lga_mds.h
@@ -32,4 +32,6 @@ uint32_t lga_mds_msg_sync_send(lgsv_msg_t *i_msg, lgsv_msg_t 
**o_msg,
                                SaTimeT timeout, uint32_t prio);
 uint32_t lga_mds_msg_async_send(lgsv_msg_t *i_msg, uint32_t prio);
 
+bool lga_mds_msg_does_support_init_clm_status();
+
 #endif  // SRC_LOG_AGENT_LGA_MDS_H_
-- 
2.25.1



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

Reply via email to