Просмотр исходного кода

votequorum: fix regression introduced by 05b4e99a6e (dispatch notifications only once)

Effectively there are 2 kind of quorum notifications that cannot be merged into 1.

config_change: when the quorum membership changes, triggered by totem/membership changes
               (node join/leave)

quorum_status_changes: same membership node becomes quorate or not.

A quorum status change does not necessarely match a membership change, hence it needs
to be dispatched separately.

An example is a cluster that is not quorate, user changes the amount of votes in a node to
regain quorum. No membership changes happen at this point, but votequorum will
effectively broadcast the votes: XX change and recalculate quorum.
In turn we need to notify quorum users.

Reviewed-by: Steven Dake <sdake@redhat.com>
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Fabio M. Di Nitto 14 лет назад
Родитель
Сommit
0b758b01ff
1 измененных файлов с 11 добавлено и 1 удалено
  1. 11 1
      services/votequorum.c

+ 11 - 1
services/votequorum.c

@@ -666,6 +666,7 @@ static int check_low_node_id_partition(void)
 static void set_quorate(int total_votes)
 {
 	int quorate;
+	int quorum_change = 0;
 
 	ENTER();
 
@@ -699,14 +700,21 @@ static void set_quorate(int total_votes)
 	}
 
 	if (cluster_is_quorate && !quorate) {
+		quorum_change = 1;
 		log_printf(LOGSYS_LEVEL_INFO, "quorum lost, blocking activity\n");
 	}
 	if (!cluster_is_quorate && quorate) {
+		quorum_change = 1;
 		log_printf(LOGSYS_LEVEL_INFO, "quorum regained, resuming activity\n");
 	}
 
 	cluster_is_quorate = quorate;
 
+	if (quorum_change) {
+		set_quorum(quorum_members, quorum_members_entries,
+			   cluster_is_quorate, &quorum_ringid);
+	}
+
 	LEAVE();
 }
 
@@ -1020,7 +1028,9 @@ static void quorum_confchg_fn (
 	}
 
 	memcpy(&quorum_ringid, ring_id, sizeof(*ring_id));
-	set_quorum(quorum_members, quorum_members_entries, cluster_is_quorate, &quorum_ringid);
+
+	set_quorum(quorum_members, quorum_members_entries,
+		   cluster_is_quorate, &quorum_ringid);
 
 	LEAVE();
 }