By default, corosync calculates several timeouts based on the cluster
size, in particular the token timeout, which is a fixed base value
plus the number of nodes (minus 2) multipled by a factor called the
"token coefficient" (with a default of 650ms) [1].

New clusters should be created with a lower token coefficient. Thus,
allow to pass a custom token coefficient when creating the
configuration for a new corosync cluster.

[1] 
https://manpages.debian.org/trixie/corosync/corosync.conf.5.en.html#token_coefficient

Signed-off-by: Friedrich Weber <[email protected]>
---
 src/PVE/Corosync.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/PVE/Corosync.pm b/src/PVE/Corosync.pm
index f5b10fa..aef0d31 100644
--- a/src/PVE/Corosync.pm
+++ b/src/PVE/Corosync.pm
@@ -274,6 +274,7 @@ sub create_conf {
     my $clustername = $param->{clustername};
     my $nodeid = $param->{nodeid} || 1;
     my $votes = $param->{votes} || 1;
+    my $token_coefficient = $param->{'token-coefficient'};
 
     my $local_ip_address = PVE::Cluster::remote_node_ip($nodename);
 
@@ -324,6 +325,8 @@ sub create_conf {
         $node->{"ring${lnum}_addr"} = $link->{address};
     }
 
+    $totem->{token_coefficient} = $token_coefficient if 
defined($token_coefficient);
+
     return { main => $conf };
 }
 
-- 
2.47.3




Reply via email to