Blob Blame History Raw
From: Andrew Beekhof <andrew@beekhof.net>
Date: Thu, 3 Sep 2015 14:29:27 +1000
Subject: [PATCH] Fix: pacemakerd: Track node state in pacemakerd

(cherry picked from commit c186f54241c49bf20b1620767933b006063d613c)
---
 mcp/pacemaker.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
index 88a6a1f..9f00a21 100644
--- a/mcp/pacemaker.c
+++ b/mcp/pacemaker.c
@@ -901,7 +901,6 @@ mcp_cpg_membership(cpg_handle_t handle,
 static gboolean
 mcp_quorum_callback(unsigned long long seq, gboolean quorate)
 {
-    /* Nothing to do */
     pcmk_quorate = quorate;
     return TRUE;
 }
@@ -909,8 +908,23 @@ mcp_quorum_callback(unsigned long long seq, gboolean quorate)
 static void
 mcp_quorum_destroy(gpointer user_data)
 {
+    crm_info("connection lost");
+}
+
+#if SUPPORT_CMAN
+static gboolean
+mcp_cman_dispatch(unsigned long long seq, gboolean quorate)
+{
+    pcmk_quorate = quorate;
+    return TRUE;
+}
+
+static void
+mcp_cman_destroy(gpointer user_data)
+{
     crm_info("connection closed");
 }
+#endif
 
 int
 main(int argc, char **argv)
@@ -1122,6 +1136,12 @@ main(int argc, char **argv)
         }
     }
 
+#if SUPPORT_CMAN
+    if (rc == pcmk_ok && is_cman_cluster()) {
+        init_cman_connection(mcp_cman_dispatch, mcp_cman_destroy);
+    }
+#endif
+
     if(rc == pcmk_ok) {
         local_name = get_local_node_name();
         update_node_processes(local_nodeid, local_name, get_process_list());