Skip to contentSkip to conversation

dlm: enhancing dlm_controld (pcmk) to be able to handle redundant rings

RFC PATCH jjzhang 5 participants 8 messages Oct 23, 2009 – Oct 26, 2009

lore
Share & tools
lore

jjzhang

author
#0 lore raw

<[email protected]>, Lars Marowsky-Bree <[email protected]>
Cc: cluster-devel at redhat.com
Bcc:
Subject: Re: [Cluster-devel] Re: [RFC PATCH] dlm: enhancing dlm_controld
(pcmk) to be able to handle redundant rings
Reply-To:
In-Reply-To: <[email protected]>

Quoted 8 lines · Lars Marowsky-Bree
Quoted 6 lines · David Teigland
Quoted 4 lines · Andrew Beekhof

Looks good to me :-)
Although it might be nice to have the automated detection in place too.

Less things for the admin to get wrong. What do you think Dave?

Quoted 8 lines
Quoted 3 lines

I don't mind, now that I've taken a moment to think how it should work... There should be three protocol options, "tcp", "sctp", "detect". Detect should work by reading the totem/rrp_mode value in setup_ccs().

Can we then also agree on "detect" being the default?

(Experience shows that admins will misconfigure just about anything if they have to deviate from the defaults.)

Hello,

Below is the improved patch. I have set the "default" as the same logic as "detect", but I'm not sure if this is OK.

Thanks a lot for your kindly review and comments :)

---

 configure.ac                   |    1 +
 group/dlm_controld/Makefile.am |    4 ++-
 group/dlm_controld/main.c      |    9 ++++++-
 group/dlm_controld/pacemaker.c |   48 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 60 insertions(+), 2 deletions(-)
configure.ac +1 -0
index d50de87..e0a1a0d 100644
@@ -131,6 +131,7 @@ if test "x${enable_pacemaker}" = xyes; then
 	PKG_CHECK_MODULES([totempg],[libtotem_pg])
 	PKG_CHECK_MODULES([xml],[libxml-2.0])
 	PKG_CHECK_MODULES([glib],[glib-2.0])
+	PKG_CHECK_MODULES([cfg],[libcfg])
 	check_lib_no_libs cib cib_new
 	check_lib_no_libs crmcluster crm_set_status_callback
 	check_lib_no_libs crmcommon init_server_ipc_comms
group/dlm_controld/Makefile.am +3 -1
index c14ab89..ce6e587 100644
@@ -62,12 +62,14 @@ dlm_controld_pcmk_CPPFLAGS= $(shared_CPPFLAGS) \
 dlm_controld_pcmk_CFLAGS  = $(shared_CFLAGS) \
 			    $(glib_CFLAGS) \
 			    $(xml_CFLAGS) \
-			    $(totempg_CFLAGS)
+			    $(totempg_CFLAGS) \
+			    $(cfg_CFLAGS)
 
 dlm_controld_pcmk_LDFLAGS = $(shared_LIBS) \
 			    $(glib_LIBS) \
 			    $(xml_LIBS) \
 			    $(totempg_LIBS) \
+			    $(cfg_LIBS) \
 			    -lcib -lcrmcommon -lcrmcluster
 
 dlm_controld_pcmk_LDADD	  = $(shared_LDADD)
group/dlm_controld/main.c +8 -1
index f90cd21..8949d11 100644
@@ -1058,11 +1058,13 @@ static void print_usage(void)
 	printf("		Default is %u\n", DEFAULT_DROP_RESOURCES_COUNT);
 	printf("  -a <ms>	plock ownership drop resources age (milliseconds)\n");
 	printf("		Default is %u\n", DEFAULT_DROP_RESOURCES_AGE);
+	printf("  -r <num>	DLM in-kernel communication protocols: TCP(0), SCTP(1), DETECT(2)\n");
+	printf("		Default is auto-detect (2)");
 	printf("  -h		Print this help, then exit\n");
 	printf("  -V		Print program version information, then exit\n");
 }
 
-#define OPTION_STRING "LDKf:q:d:p:Pl:o:t:c:a:hV"
+#define OPTION_STRING "LDKf:q:d:p:Pl:o:t:c:a:r:hV"
 
 static void read_arguments(int argc, char **argv)
 {
@@ -1142,6 +1144,11 @@ static void read_arguments(int argc, char **argv)
 			cfgd_drop_resources_age = atoi(optarg);
 			break;
 
+		case 'r':
+			optk_protocol = 1;
+			cfgk_protocol = atoi(optarg);
+			break;
+
 		case 'h':
 			print_usage();
 			exit(EXIT_SUCCESS);
group/dlm_controld/pacemaker.c +48 -0

61 lines not on this page · raw message

#1 lore raw
Quoted 23 lines · jjzhang

<[email protected]>, Lars Marowsky-Bree <[email protected]>
Cc: cluster-devel at redhat.com
Bcc:
Subject: Re: [Cluster-devel] Re: [RFC PATCH] dlm: enhancing dlm_controld ? ? ? ?(pcmk) to be able to handle redundant rings
Reply-To:
In-Reply-To: <[email protected]>

Quoted 14 lines · Lars Marowsky-Bree
Quoted 9 lines · David Teigland
Quoted 4 lines · Andrew Beekhof

Looks good to me :-)
Although it might be nice to have the automated detection in place too.

Less things for the admin to get wrong. ?What do you think Dave?

I don't mind, now that I've taken a moment to think how it should work... There should be three protocol options, "tcp", "sctp", "detect". ?Detect should work by reading the totem/rrp_mode value in setup_ccs().

Can we then also agree on "detect" being the default?

Quoted 7 lines
Quoted 2 lines

(Experience shows that admins will misconfigure just about anything if they have to deviate from the defaults.)

Hello,

Below is the improved patch. I have set the "default" as the same logic as "detect", but I'm not sure if this is OK.

I consider that to be the ideal default.

Quoted 2 lines

Thanks a lot for your kindly review and comments :)

Looks good to me.
Unless anyone objects I'd like to apply this.

(Can you resend as an attachment, inline patches have a habit of
getting mangled)

Quoted 140 lines

---

?configure.ac ? ? ? ? ? ? ? ? ? | ? ?1 +
?group/dlm_controld/Makefile.am | ? ?4 ++-
?group/dlm_controld/main.c ? ? ?| ? ?9 ++++++-
?group/dlm_controld/pacemaker.c | ? 48 ++++++++++++++++++++++++++++++++++++++++

?4 files changed, 60 insertions(+), 2 deletions(-)

configure.ac +1 -0
index d50de87..e0a1a0d 100644
@@ -131,6 +131,7 @@ if test "x${enable_pacemaker}" = xyes; then
 ? ? ? ?PKG_CHECK_MODULES([totempg],[libtotem_pg])
 ? ? ? ?PKG_CHECK_MODULES([xml],[libxml-2.0])
 ? ? ? ?PKG_CHECK_MODULES([glib],[glib-2.0])
+ ? ? ? PKG_CHECK_MODULES([cfg],[libcfg])

? ? ? ?check_lib_no_libs cib cib_new
? ? ? ?check_lib_no_libs crmcluster crm_set_status_callback ? ? ? ?check_lib_no_libs crmcommon init_server_ipc_comms

group/dlm_controld/Makefile.am +3 -1
index c14ab89..ce6e587 100644
@@ -62,12 +62,14 @@ dlm_controld_pcmk_CPPFLAGS= $(shared_CPPFLAGS) \
 ?dlm_controld_pcmk_CFLAGS ?= $(shared_CFLAGS) \
 ? ? ? ? ? ? ? ? ? ? ? ? ? ?$(glib_CFLAGS) \
 ? ? ? ? ? ? ? ? ? ? ? ? ? ?$(xml_CFLAGS) \
- ? ? ? ? ? ? ? ? ? ? ? ? ? $(totempg_CFLAGS)
+ ? ? ? ? ? ? ? ? ? ? ? ? ? $(totempg_CFLAGS) \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? $(cfg_CFLAGS)
 
 ?dlm_controld_pcmk_LDFLAGS = $(shared_LIBS) \
 ? ? ? ? ? ? ? ? ? ? ? ? ? ?$(glib_LIBS) \
 ? ? ? ? ? ? ? ? ? ? ? ? ? ?$(xml_LIBS) \
 ? ? ? ? ? ? ? ? ? ? ? ? ? ?$(totempg_LIBS) \
+ ? ? ? ? ? ? ? ? ? ? ? ? ? $(cfg_LIBS) \

? ? ? ? ? ? ? ? ? ? ? ? ? ?-lcib -lcrmcommon -lcrmcluster

?dlm_controld_pcmk_LDADD ? ? ? ? ?= $(shared_LDADD)

group/dlm_controld/main.c +8 -1
index f90cd21..8949d11 100644
@@ -1058,11 +1058,13 @@ static void print_usage(void)
 ? ? ? ?printf(" ? ? ? ? ? ? ? ?Default is %u\n", DEFAULT_DROP_RESOURCES_COUNT);
 ? ? ? ?printf(" ?-a <ms> ? ? ? plock ownership drop resources age (milliseconds)\n");
 ? ? ? ?printf(" ? ? ? ? ? ? ? ?Default is %u\n", DEFAULT_DROP_RESOURCES_AGE);
+ ? ? ? printf(" ?-r <num> ? ? ?DLM in-kernel communication protocols: TCP(0), SCTP(1), DETECT(2)\n");
+ ? ? ? printf(" ? ? ? ? ? ? ? ?Default is auto-detect (2)");
 ? ? ? ?printf(" ?-h ? ? ? ? ? ?Print this help, then exit\n");
 ? ? ? ?printf(" ?-V ? ? ? ? ? ?Print program version information, then exit\n");
 ?}
 
-#define OPTION_STRING "LDKf:q:d:p:Pl:o:t:c:a:hV"
+#define OPTION_STRING "LDKf:q:d:p:Pl:o:t:c:a:r:hV"
 
 ?static void read_arguments(int argc, char **argv)
 ?{
@@ -1142,6 +1144,11 @@ static void read_arguments(int argc, char **argv)
 ? ? ? ? ? ? ? ? ? ? ? ?cfgd_drop_resources_age = atoi(optarg);
 ? ? ? ? ? ? ? ? ? ? ? ?break;
 
+ ? ? ? ? ? ? ? case 'r':
+ ? ? ? ? ? ? ? ? ? ? ? optk_protocol = 1;
+ ? ? ? ? ? ? ? ? ? ? ? cfgk_protocol = atoi(optarg);
+ ? ? ? ? ? ? ? ? ? ? ? break;
+

? ? ? ? ? ? ? ?case 'h':
? ? ? ? ? ? ? ? ? ? ? ?print_usage();
? ? ? ? ? ? ? ? ? ? ? ?exit(EXIT_SUCCESS);

group/dlm_controld/pacemaker.c +0 -0
index 810c644..b3b147a 100644
@@ -22,7 +22,42 @@

?#include <pacemaker/crm/msg_xml.h>
?#include <pacemaker/crm/cib.h>

group/dlm_controld/pacemaker.c +3 -0
+#include <corosync/corotypes.h>
+#include <corosync/cfg.h>
+

?#define COMMS_DIR ? ? "/sys/kernel/config/dlm/cluster/comms"

group/dlm_controld/pacemaker.c +32 -0
+#define PROTO_TCP ? ? 0
+#define PROTO_SCTP ? ?1
+#define PROTO_DETECT ?2
+
+static int get_ring_count(void)
+{
+ ? ?cs_error_t result;
+ ? ?corosync_cfg_handle_t handle;
+ ? ?unsigned int interface_count;
+ ? ?char **interface_names;
+ ? ?char **interface_status;
+
+ ? ?result = corosync_cfg_initialize(&handle, NULL);
+ ? ?if (result != CS_OK) {
+ ? ? ? log_error("Failed to initialize corosync configuration API (error=%d)", result);
+ ? ? ? (void)corosync_cfg_finalize(handle);
+ ? ? ? return -1;
+ ? ?}
+
+ ? ?result = corosync_cfg_ring_status_get(handle,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_names,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_status,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_count);
+ ? ?if (result != CS_OK) {
+ ? ? ? log_error("Failed to get the ring status (error=%d)", result);
+ ? ? ? (void)corosync_cfg_finalize(handle);
+ ? ? ? return -1;
+ ? ?}
+
+ ? ?(void)corosync_cfg_finalize(handle);
+ ? ?return interface_count;
+}

?int setup_ccs(void)
?{

group/dlm_controld/pacemaker.c +0 -0
@@ -30,6 +65,19 @@ int setup_ccs(void)

? ? ?* only allow configuration from the command-line until CoroSync is stable ? ? ?* enough to be used with Pacemaker
? ? ?*/
+ ? ?if (cfgk_protocol != -1 && cfgk_protocol != PROTO_TCP &&
+ ? ? ? cfgk_protocol != PROTO_SCTP && cfgk_protocol != PROTO_DETECT) {
+ ? ? ? log_error("ignore invalid value %d for dlm protocol", cfgk_protocol);
+ ? ? ? cfgk_protocol = -1;
+ ? ?}

group/dlm_controld/pacemaker.c +8 -0
+
+ ? ?if (cfgk_protocol == PROTO_DETECT || cfgk_protocol == -1) {
+ ? ? ? if (get_ring_count() > 1)
+ ? ? ? ? ? cfgk_protocol = PROTO_SCTP;
+ ? ? ? else
+ ? ? ? ? ? cfgk_protocol = PROTO_TCP;
+ ? ?}
+

? ? return 0;
?}

#2 lore raw
Quoted 28 lines · Andrew Beekhof
Quoted 15 lines · jjzhang
Quoted 14 lines · Lars Marowsky-Bree
Quoted 9 lines · David Teigland
Quoted 4 lines · Andrew Beekhof

Looks good to me :-)
Although it might be nice to have the automated detection in place too.

Less things for the admin to get wrong. ?What do you think Dave?

I don't mind, now that I've taken a moment to think how it should work... There should be three protocol options, "tcp", "sctp", "detect". ?Detect should work by reading the totem/rrp_mode value in setup_ccs().

Can we then also agree on "detect" being the default?

Quoted 7 lines
Quoted 2 lines

(Experience shows that admins will misconfigure just about anything if they have to deviate from the defaults.)

Hello,

Below is the improved patch. I have set the "default" as the same logic as "detect", but I'm not sure if this is OK.

I consider that to be the ideal default.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

Thanks a lot for your kindly review and comments :)

Looks good to me.
Unless anyone objects I'd like to apply this.

?(Can you resend as an attachment, inline patches have a habit of getting mangled)

OK, Thanks :)
Please see the attachment.

Thanks,
Jiaju
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlm-pcmk-config-protocol.diff
Type: text/x-diff
Size: 4397 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20091023/3af24914/attachment.bin>

#3 lore raw
Quoted 2 lines · Jiaju Zhang

OK, Thanks :)
Please see the attachment.

Thanks for the work, this looks good.

Regards,
Lars

Signature · 3 lines
Architect Storage/HA, OPS Engineering, Novell, Inc.
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N?rnberg)
"Experience is the name everyone gives to their mistakes." -- Oscar Wilde
#4 lore raw
In reply to Jiaju Zhang

On Fri, Oct 23, 2009 at 09:23:20PM +0800, Jiaju Zhang wrote:
+ result = corosync_cfg_ring_status_get(handle,

+                                       &interface_names,
+                                       &interface_status,
+                                       &interface_count);
+    if (result != CS_OK) {
+       log_error("Failed to get the ring status (error=%d)", result);
+       (void)corosync_cfg_finalize(handle);
+       return -1;

+ }
+
+ (void)corosync_cfg_finalize(handle);
+ return interface_count;

What is interface_count if there's one ring up but rrp is configured? Could we read the totem/rrp config value from the objdb?

Dave

#5 lore raw
Quoted 14 lines · David Teigland

On Fri, Oct 23, 2009 at 09:23:20PM +0800, Jiaju Zhang wrote:

group/dlm_controld/pacemaker.c +12 -0
+    result = corosync_cfg_ring_status_get(handle,
+                                       &interface_names,
+                                       &interface_status,
+                                       &interface_count);
+    if (result != CS_OK) {
+       log_error("Failed to get the ring status (error=%d)", result);
+       (void)corosync_cfg_finalize(handle);
+       return -1;
+    }
+
+    (void)corosync_cfg_finalize(handle);
+    return interface_count;
Quoted 5 lines

What is interface_count if there's one ring up but rrp is configured? Could we read the totem/rrp config value from the objdb?

Dave

Dave,

The rrp mode can be read from the confdb currently. The other values cannot be read from the confdb currently. interface_count is the number of configured interfaces so that interface_status may be iterated.

Long term the plan is to deprecate all of the APIs related to config/diag in favor of using confdb (or some successor to this api if absolutely necessary). This includes things like the above ring status api.

We have alot of work to do to get there. Corosync 2.0 material.

#6 lore raw
Quoted 15 lines · Steven Dake
Quoted 14 lines · David Teigland

On Fri, Oct 23, 2009 at 09:23:20PM +0800, Jiaju Zhang wrote:

group/dlm_controld/pacemaker.c +12 -0
+    result = corosync_cfg_ring_status_get(handle,
+                                       &interface_names,
+                                       &interface_status,
+                                       &interface_count);
+    if (result != CS_OK) {
+       log_error("Failed to get the ring status (error=%d)", result);
+       (void)corosync_cfg_finalize(handle);
+       return -1;
+    }
+
+    (void)corosync_cfg_finalize(handle);
+    return interface_count;
Quoted 7 lines
Quoted 2 lines

What is interface_count if there's one ring up but rrp is configured? Could we read the totem/rrp config value from the objdb?

Dave,

The rrp mode can be read from the confdb currently.

Ah, yeah, that's what I meant.

#7 lore raw
Quoted 20 lines · David Teigland
Quoted 17 lines · Steven Dake
Quoted 16 lines · David Teigland

On Fri, Oct 23, 2009 at 09:23:20PM +0800, Jiaju Zhang wrote:
+ ? ?result = corosync_cfg_ring_status_get(handle,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_names,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_status,
+ ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &interface_count);
+ ? ?if (result != CS_OK) {
+ ? ? ? log_error("Failed to get the ring status (error=%d)", result);
+ ? ? ? (void)corosync_cfg_finalize(handle);
+ ? ? ? return -1;
+ ? ?}
+
+ ? ?(void)corosync_cfg_finalize(handle);
+ ? ?return interface_count;

What is interface_count if there's one ring up but rrp is configured? Could we read the totem/rrp config value from the objdb?

Quoted 5 lines
Quoted 3 lines

Dave,

The rrp mode can be read from the confdb currently.

Ah, yeah, that's what I meant.

Hello,

Attached is the improved patch, which read the rrp mode from the confdb. Thanks a lot for your comments :)

Thanks,
Jiaju
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dlm-pcmk-config-protocol.diff
Type: text/x-diff
Size: 5130 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20091026/877ad8d8/attachment.bin>