mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2026-01-19 20:15:20 +00:00
votequorum: add wait_for_all support (default: off)
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. Reviewed-by: Steven Dake <sdake@redhat.com> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This commit is contained in:
parent
b64d1b8694
commit
e8d0af0bc8
@ -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);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user