Blame SOURCES/0013-Fix-cman-Suppress-implied-node-names.patch

3d71c6
From: Andrew Beekhof <andrew@beekhof.net>
3d71c6
Date: Wed, 2 Sep 2015 12:08:52 +1000
3d71c6
Subject: [PATCH] Fix: cman: Suppress implied node names
3d71c6
3d71c6
(cherry picked from commit e94fbcd0c49db9d3c69b7c0e478ba89a4d360dde)
3d71c6
---
3d71c6
 tools/crm_node.c | 20 +++++++++++++++++++-
3d71c6
 1 file changed, 19 insertions(+), 1 deletion(-)
3d71c6
3d71c6
diff --git a/tools/crm_node.c b/tools/crm_node.c
3d71c6
index d0195e3..24cc4d7 100644
3d71c6
--- a/tools/crm_node.c
3d71c6
+++ b/tools/crm_node.c
3d71c6
@@ -434,6 +434,21 @@ try_heartbeat(int command, enum cluster_type_e stack)
3d71c6
 #if SUPPORT_CMAN
3d71c6
 #  include <libcman.h>
3d71c6
 #  define MAX_NODES 256
3d71c6
+static bool valid_cman_name(const char *name, uint32_t nodeid) 
3d71c6
+{
3d71c6
+    bool rc = TRUE;
3d71c6
+
3d71c6
+    /* Yes, %d, because that's what CMAN does */
3d71c6
+    char *fakename = crm_strdup_printf("Node%d", nodeid);
3d71c6
+
3d71c6
+    if(crm_str_eq(fakename, name, TRUE)) {
3d71c6
+        rc = FALSE;
3d71c6
+        crm_notice("Ignoring inferred name from cman: %s", fakename);
3d71c6
+    }
3d71c6
+    free(fakename);
3d71c6
+    return rc;
3d71c6
+}
3d71c6
+
3d71c6
 static gboolean
3d71c6
 try_cman(int command, enum cluster_type_e stack)
3d71c6
 {
3d71c6
@@ -478,7 +493,10 @@ try_cman(int command, enum cluster_type_e stack)
3d71c6
             }
3d71c6
 
3d71c6
             for (lpc = 0; lpc < node_count; lpc++) {
3d71c6
-                if (command == 'l') {
3d71c6
+                if(valid_cman_name(cman_nodes[lpc].cn_name, cman_nodes[lpc].cn_nodeid) == FALSE) {
3d71c6
+                    /* Do not print */
3d71c6
+
3d71c6
+                } if (command == 'l') {
3d71c6
                     printf("%s ", cman_nodes[lpc].cn_name);
3d71c6
 
3d71c6
                 } else if (cman_nodes[lpc].cn_nodeid != 0 && cman_nodes[lpc].cn_member) {