dlm_controld: bind to all interfaces for failover
PATCH 1/1 dlm_controld: bind to all interfaces for failover
Support for automatic failover in the face of network interruptions is being added to the DLM kernel component. [1] This patch aids in that effort by adding a mechanism whereby userspace can convey to the kernel its intention to use all network addresses for automatic failover. DLM's current default behavior is to bind to only a single interface.
When --bind_all is set, dlm_controld will write to a configfs node that alerts the kernel of its intention to use all local network addresses for automatic failover. When selecting the next address to bind to, DLM will iterate through its list of local network addresses in a round-robin fashion. Support for other address selection heuritics may be added in the future.
It is important to understand that, per the DLM spec, while DLM can use a set of addresses for automatic failover, only one address is considered the active address between two DLM nodes at a time. This patch does not violate that constraint.
[1] https://www.redhat.com/archives/cluster-devel/2019-January/msg00009.html
--- dlm_controld/action.c | 19 +++++++++++++++++++ dlm_controld/dlm.conf.5 | 2 ++ dlm_controld/dlm_daemon.h | 1 + dlm_controld/main.c | 5 +++++ 4 files changed, 27 insertions(+)
dlm_controld/action.c +19 -0
@@ -662,6 +662,25 @@ int add_configfs_node(int nodeid, char *addr, int addrlen, int local)return -1 ; }close (fd); + +if (opt (bind_all_ind)) { +memset (path,0 ,PATH_MAX ); +snprintf (path,PATH_MAX ,"%s/%d/bind_all" ,COMMS_DIR , nodeid); + + fd =open (path,O_WRONLY ); +if (fd <0 ) { +log_error ("%s: open failed: %d" , path, errno); +return -1 ; + } + + rv =do_write (fd, (void *)"1" ,strlen ("1" )); +if (rv <0 ) { +log_error ("%s: write failed: %d" , path, errno); +close (fd); +return -1 ; + } +close (fd); + } out:return 0 ; }
dlm_controld/dlm.conf.5 +2 -0
@@ -38,6 +38,8 @@ log_debug .br protocol .br +bind_all +.br debug_logfile .br enable_plock
dlm_controld/dlm_daemon.h +1 -0
@@ -95,6 +95,7 @@ enum { timewarn_ind, protocol_ind, debug_logfile_ind, + bind_all_ind, enable_fscontrol_ind, enable_plock_ind, plock_debug_ind,
dlm_controld/main.c +5 -0
@@ -1727,6 +1727,11 @@ static void set_opt_defaults(void)-1 ,"detect" , "dlm kernel lowcomms protocol: tcp, sctp, detect"); +set_opt_default (bind_all_ind, +"bind_all" ,'\0' , req_arg_int, +0 ,NULL , +"" );/* do not advertise */ + set_opt_default(debug_logfile_ind, "debug_logfile", 'L', no_arg, 0, NULL,
Signature · 1 line
2.20.1