Skip to contentSkip to conversation

dlm_tools: support corosync3/knet multi-link

PATCH In review Heming Zhao 1 participant 3 messages Dec 20, 2024

lore
Share & tools
lore
#0 lore raw

cover dlm_tools: support corosync3/knet multi-link

This patch is to support corosync3/knet multi-link.

btw, this mailing list ([email protected]) is the right place to send this patch?

Heming Zhao (1):
dlm_controld: support corosync3/knet multi-link

 dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
 dlm_controld/dlm_daemon.h |  4 ++--
 dlm_sand/sand_internal.h  |  4 ++--
 3 files changed, 24 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/1 dlm_controld: support corosync3/knet multi-link

The totem.rrp_mode config item was obsolete in corosync3. And this patch gives dlm_controld the ability to detect multiple links

And this patch should be work with updated kernel dlm module. Because the DLM_MAX_ADDR_COUNT is changed from 3 to 8.

---
 dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
 dlm_controld/dlm_daemon.h |  4 ++--
 dlm_sand/sand_internal.h  |  4 ++--
 3 files changed, 24 insertions(+), 15 deletions(-)
dlm_controld/action.c +20 -11
index 60eb22a78c56..48a30a20f00f 100644
@@ -20,12 +20,15 @@ static int comms_nodes_count;
 #define CLUSTER_DIR   "/sys/kernel/config/dlm/cluster"
 #define SPACES_DIR    "/sys/kernel/config/dlm/cluster/spaces"
 #define COMMS_DIR     "/sys/kernel/config/dlm/cluster/comms"
+#define CMAP_STR_LEN  27
 
 static int detect_protocol(void)
 {
 	cmap_handle_t handle;
 	char *str = NULL;
+	char key[CMAP_STR_LEN];
 	int rv, proto = -1;
+	int i, link = 0;
 
 	rv = cmap_initialize(&handle);
 	if (rv != CS_OK) {
@@ -33,19 +36,25 @@ static int detect_protocol(void)
 		return -1; 
 	}
 
-	rv = cmap_get_string(handle, "totem.rrp_mode", &str);
-	if (rv != CS_OK)
-		goto out;
-
-	log_debug("cmap totem.rrp_mode = '%s'", str);
+	/* corosync3 supports MAX_NODE_ADDRESSES links at max */
+	for (i = 0; i < MAX_NODE_ADDRESSES; i++) {
+		snprintf(key, CMAP_STR_LEN, "nodelist.node.0.ring%d_addr", i);
+		rv = cmap_get_string(handle, key, &str);
+		if (rv != CS_OK) {
+			/* we just care the link number, ignore all error here */
+			log_debug("[%d] %s rv:%d", i, key, rv);
+			continue;
+		}
+		log_debug("[%d] %s : %s", i, key, str);
+		link++;
+		free(str);
+	}
 
-	if (!strcmp(str, "none"))
-		proto = PROTO_TCP;
-	else
+	if (link > 1)
 		proto = PROTO_SCTP;
- out:
-	if (str)
-		free(str);
+	else
+		proto = PROTO_TCP;
+
 	cmap_finalize(handle);
 	return proto;
 }
dlm_controld/dlm_daemon.h +2 -2
index 4a533e3451e2..3ed4e235a83c 100644
@@ -176,9 +176,9 @@ EXTERN struct dlm_option dlm_options[dlm_options_max];
 #define MAX_NODES	128
 
 /* Maximum number of IP addresses per node, when using SCTP and multi-ring in
-   corosync  In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+   corosync  In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 8. */
 
-#define MAX_NODE_ADDRESSES 4
+#define MAX_NODE_ADDRESSES 8
 
 #define PROTO_TCP  0
 #define PROTO_SCTP 1
dlm_sand/sand_internal.h +2 -2
index 4c2fc0897051..c17287abcd47 100644
@@ -138,9 +138,9 @@ EXTERN struct dlm_option dlm_options[dlm_options_max];
    Copied in libdlm.h so apps don't need to include the kernel header. */
 
 /* Maximum number of IP addresses per node, when using SCTP.
-   In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 3. */
+   In dlm-kernel this is DLM_MAX_ADDR_COUNT, currently 8. */
 
-#define MAX_NODE_ADDRESSES 4
+#define MAX_NODE_ADDRESSES 8
 
 #define PROTO_TCP  0
 #define PROTO_SCTP 1
Signature · 1 line
2.43.0
#2 lore raw
In reply to Heming Zhao

Hi all,

Nicholas notified me the new code is not compatible with corosync2 multicast mode. I withdraw this patch and will send a new patch.

Thanks,
Heming

Quoted 13 lines · Heming Zhao

This patch is to support corosync3/knet multi-link.

btw, this mailing list ([email protected]) is the right place to send this patch?

Heming Zhao (1):
dlm_controld: support corosync3/knet multi-link

  dlm_controld/action.c     | 31 ++++++++++++++++++++-----------
  dlm_controld/dlm_daemon.h |  4 ++--
  dlm_sand/sand_internal.h  |  4 ++--
  3 files changed, 24 insertions(+), 15 deletions(-)