[PATCH 03/21] votequorum: add wait_for_all support (default: off)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Fabio M. Di Nitto" <fdinitto@xxxxxxxxxx>

this flag (0|1) can be configured via quorum.wait_for_all and changes
behavior when granting quorum for the first time.

Normal behavior (default / 0) grants quorum as soon as enough nodes
are available in a cluster.

Setting this value to 1 will grant quorum only after all cluster
memembers are part of the cluster at the same time.

Signed-off-by: Fabio M. Di Nitto <fdinitto@xxxxxxxxxx>
---
:100644 100644 98e5189... abbd512... M	exec/coroparse.c
:100644 100644 6d8a603... 3ba5978... M	services/votequorum.c
 exec/coroparse.c      |    1 +
 services/votequorum.c |   20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/exec/coroparse.c b/exec/coroparse.c
index 98e5189..abbd512 100644
--- a/exec/coroparse.c
+++ b/exec/coroparse.c
@@ -368,6 +368,7 @@ static int main_config_parser_cb(const char *path,
 
 			if ((strcmp(path, "quorum.disallowed") == 0) ||
 			    (strcmp(path, "quorum.two_node") == 0) ||
+			    (strcmp(path, "quorum.wait_for_all") == 0) ||
 			    (strcmp(path, "quorum.quorate") == 0)) {
 				i = atoi(value);
 				icmap_set_uint8(path, i);
diff --git a/services/votequorum.c b/services/votequorum.c
index 6d8a603..3ba5978 100644
--- a/services/votequorum.c
+++ b/services/votequorum.c
@@ -124,6 +124,7 @@ static int cluster_is_quorate;
 static int first_trans = 1;
 static unsigned int quorumdev_poll = DEFAULT_QDEV_POLL;
 static unsigned int leaving_timeout = DEFAULT_LEAVE_TMO;
+static uint8_t wait_for_all = 0;
 
 static struct cluster_node *us;
 static struct cluster_node *quorum_device = NULL;
@@ -385,6 +386,8 @@ static void votequorum_init(struct corosync_api_v1 *api,
 	ENTER();
 	set_quorum = report;
 
+	icmap_get_uint8("quorum.wait_for_all", &wait_for_all);
+
 	/* Load the library-servicing part of this module */
 	api->service_link_and_init(api, "corosync_votequorum_iface", 0);
 
@@ -608,6 +611,23 @@ static void set_quorate(int total_votes)
 	int quorate;
 
 	ENTER();
+
+	/*
+	 * wait for all nodes to show up before granting quorum
+	 */
+
+	if (wait_for_all) {
+		if (total_votes != us->expected_votes) {
+			log_printf(LOGSYS_LEVEL_NOTICE,
+				   "Waiting for all cluster members. "
+				   "Current votes: %d expected_votes: %d\n",
+				   total_votes, us->expected_votes);
+			cluster_is_quorate = 0;
+			return;
+		}
+		wait_for_all = 0;
+	}
+
 	if (quorum > total_votes) {
 		quorate = 0;
 	}
-- 
1.7.7.5

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss


[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux