Author: pjd Date: Mon Aug 30 00:12:10 2010 New Revision: 211983 URL: http://svn.freebsd.org/changeset/base/211983
Log: Execute hook when split-brain is detected. MFC after: 2 weeks Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com Modified: head/sbin/hastd/hast.conf.5 head/sbin/hastd/primary.c head/sbin/hastd/secondary.c Modified: head/sbin/hastd/hast.conf.5 ============================================================================== --- head/sbin/hastd/hast.conf.5 Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/hast.conf.5 Mon Aug 30 00:12:10 2010 (r211983) @@ -232,6 +232,11 @@ between the nodes. .Pp Executed on both primary and secondary nodes when resource role is changed. .Pp +.It Ic "<path> split-brain <resource>" +.Pp +Executed on both primary and secondary nodes when split-brain condition is +detected. +.Pp .El The .Aq path Modified: head/sbin/hastd/primary.c ============================================================================== --- head/sbin/hastd/primary.c Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/primary.c Mon Aug 30 00:12:10 2010 (r211983) @@ -498,6 +498,7 @@ init_remote(struct hast_resource *res, s assert(real_remote(res)); in = out = NULL; + errmsg = NULL; /* Prepare outgoing connection with remote node. */ if (proto_client(res->hr_remoteaddr, &out) < 0) { @@ -673,6 +674,8 @@ init_remote(struct hast_resource *res, s } return (true); close: + if (errmsg != NULL && strcmp(errmsg, "Split-brain condition!") == 0) + hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); proto_close(out); if (in != NULL) proto_close(in); Modified: head/sbin/hastd/secondary.c ============================================================================== --- head/sbin/hastd/secondary.c Mon Aug 30 00:06:05 2010 (r211982) +++ head/sbin/hastd/secondary.c Mon Aug 30 00:12:10 2010 (r211983) @@ -323,6 +323,7 @@ init_remote(struct hast_resource *res, s if (res->hr_secondary_localcnt > res->hr_primary_remotecnt && res->hr_primary_localcnt > res->hr_secondary_remotecnt) { /* Exit on split-brain. */ + hook_exec(res->hr_exec, "split-brain", res->hr_name, NULL); exit(EX_CONFIG); } } @@ -373,6 +374,7 @@ hastd_secondary(struct hast_resource *re if (proto_timeout(res->hr_remoteout, res->hr_timeout) < 0) pjdlog_errno(LOG_WARNING, "Unable to set connection timeout"); + hook_init(); init_local(res); init_remote(res, nvin); init_environment(); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"