Blob Blame History Raw
From b18b74ecde9a96761df2a8e8f8d76b8c1642d161 Mon Sep 17 00:00:00 2001
From: Chris Feist <cfeist@redhat.com>
Date: Wed, 19 Mar 2014 16:30:29 -0500
Subject: [PATCH] Add support for setting certain corosync totem options

---
 pcs/cluster.py                    | 13 +++++++++++++
 pcs/corosync.conf.fedora.template |  1 +
 pcs/pcs.8                         | 15 ++++++++++++++-
 pcs/pcs.py                        |  2 +-
 pcs/test/test_cluster.py          |  8 ++++++++
 pcs/usage.py                      | 17 ++++++++++++++++-
 6 files changed, 53 insertions(+), 3 deletions(-)

diff --git a/pcs/cluster.py b/pcs/cluster.py
index ec0e6a1..bf7acda 100644
--- a/pcs/cluster.py
+++ b/pcs/cluster.py
@@ -371,6 +371,18 @@ def corosync_setup(argv,returnConfig=False):
             ip_version = ""
 
 
+        totem_options = ""
+        if "--token" in utils.pcs_options:
+            totem_options += "token: " + utils.pcs_options["--token"] + "\n"
+        if "--join" in utils.pcs_options:
+            totem_options += "join: " + utils.pcs_options["--join"] + "\n"
+        if "--consensus" in utils.pcs_options:
+            totem_options += "consensus: " + utils.pcs_options["--consensus"] + "\n"
+        if "--miss_count_const" in utils.pcs_options:
+            totem_options += "miss_count_const: " + utils.pcs_options["--miss_count_const"] + "\n"
+        if "--fail_recv_const" in utils.pcs_options:
+            totem_options += "fail_recv_const: " + utils.pcs_options["--fail_recv_const"] + "\n"
+
         corosync_config = corosync_config.replace("@@nodes", new_nodes_section)
         corosync_config = corosync_config.replace("@@cluster_name",cluster_name)
         corosync_config = corosync_config.replace("@@quorum_options\n",quorum_options)
@@ -378,6 +390,7 @@ def corosync_setup(argv,returnConfig=False):
         corosync_config = corosync_config.replace("@@transport",transport)
         corosync_config = corosync_config.replace("@@interfaceandrrpmode\n",ir)
         corosync_config = corosync_config.replace("@@ip_version\n",ip_version)
+        corosync_config = corosync_config.replace("@@totem_options\n",totem_options)
         if returnConfig:
             return corosync_config
 
diff --git a/pcs/corosync.conf.fedora.template b/pcs/corosync.conf.fedora.template
index 82413c1..4d1227c 100644
--- a/pcs/corosync.conf.fedora.template
+++ b/pcs/corosync.conf.fedora.template
@@ -3,6 +3,7 @@ version: 2
 secauth: off
 cluster_name: @@cluster_name
 transport: @@transport
+@@totem_options
 @@interfaceandrrpmode
 @@ip_version
 }
diff --git a/pcs/pcs.8 b/pcs/pcs.8
index 7f51f61..0eeadb8 100644
--- a/pcs/pcs.8
+++ b/pcs/pcs.8
@@ -144,9 +144,22 @@ Reset failcount for specified resource on all nodes or only on specified node. T
 auth [node] [...] [\-u username] [\-p password] [\-\-local] [\-\-force]
 Authenticate pcs to pcsd on nodes specified, or on all nodes configured in corosync.conf if no nodes are specified (authorization tokens are stored in ~/.pcs/tokens or /var/lib/pcsd/tokens for root).  By default all nodes are also authenticated to each other, using --local only authenticates the local node (and does not authenticate the remote nodes with each other).  Using --force forces re-authentication to occur.
 .TP
-setup [\-\-start] [\-\-local] [\-\-enable] \-\-name\fR <cluster name> <node1[,node1-altaddr]> [node2[,node2-altaddr]] [..] [--transport <udpu|udp>] [--rrpmode active|passive] [--addr0 <addr/net> [[[--mcast0 <address>] [--mcastport0 <port>] [--ttl0 <ttl>]] | [--broadcast0]] [--addr1 <addr/net> [[[--mcast1 <address>] [--mcastport1 <port>] [--ttl1 <ttl>]] | [--broadcast1]]]] [--wait_for_all=<0|1>] [--auto_tie_breaker=<0|1>] [--last_man_standing=<0|1> [--last_man_standing_window=<time in ms>]]
+setup [\-\-start] [\-\-local] [\-\-enable] \-\-name\fR <cluster name> <node1[,node1-altaddr]> [node2[,node2-altaddr]] [..] [--transport <udpu|udp>] [--rrpmode active|passive] [--addr0 <addr/net> [[[--mcast0 <address>] [--mcastport0 <port>] [--ttl0 <ttl>]] | [--broadcast0]] [--addr1 <addr/net> [[[--mcast1 <address>] [--mcastport1 <port>] [--ttl1 <ttl>]] | [--broadcast1]]]] [--wait_for_all=<0|1>] [--auto_tie_breaker=<0|1>] [--last_man_standing=<0|1> [--last_man_standing_window=<time in ms>]] [--token <timeout>] [--join <timeout>] [--consensus <timeout>] [--miss_count_const <count>] [--fail_recv_const <failures>]
 Configure corosync and sync configuration out to listed nodes. \-\-local\fR will only perform changes on the local node, \-\-start\fR will also start the cluster on the specified nodes, \-\-enable\fR will enable corosync and pacemaker on node startup, --transport allows specification of corosync transport (default: udpu). The --wait_for_all, --auto_tie_breaker, --last_man_standing, --last_man_standing_window options are all documented in corosync's votequorum(5) man page. --ipv6 will configure corosync to use ipv6 (instead of ipv4)
 
+--ipv6 will configure corosync to use ipv6 (instead of ipv4)
+
+--token <timeout> sets time in milliseconds until a token loss is declared after not receiving a token (default 1000 ms)
+
+--join <timeout> sets time in milliseconds to wait for join mesages (default 50 ms)
+
+--consensus <timeout> sets time in milliseconds to wait for consensus to be achieved before starting a new round of membership configuration (default 1200 ms)
+
+--miss_count_const <count> sets the maximum number of times on receipt of a token a message is checked for retransmission before a retransmission occurs (default 5 messages)
+
+--fail_recv_const <failures> specifies how many rotations of the token without receiving any messages when messages should be received may occur before a new configuration is formed (default 2500 failures)
+
+
 Configuring Redundant Ring Protocol (RRP)
 
 When using udpu (the default) specifying nodes, specify the ring 0
diff --git a/pcs/pcs.py b/pcs/pcs.py
index 0d3eecc..22504c3 100755
--- a/pcs/pcs.py
+++ b/pcs/pcs.py
@@ -52,7 +52,7 @@ def main(argv):
                 pcs_short_options_with_args.append(prev_char)
             prev_char = c
 
-        pcs_long_options = ["local","start","all","clone","master","force","corosync_conf=", "defaults","debug","version","help","fullhelp","off","from=","to=", "name=", "wait", "group=","groups","full","enable","node=","nodesc","transport=", "addr0=","addr1=","bcast0=","bcast1=","mcast0=","mcast1=","mcastport0=","mcastport1=","ttl0=","ttl1=","rrpmode=", "broadcast0", "broadcast1","wait_for_all=","auto_tie_breaker=","last_man_standing=", "last_man_standing_window=","no-default-ops","ipv6"]
+        pcs_long_options = ["local","start","all","clone","master","force","corosync_conf=", "defaults","debug","version","help","fullhelp","off","from=","to=", "name=", "wait", "group=","groups","full","enable","node=","nodesc","transport=", "addr0=","addr1=","bcast0=","bcast1=","mcast0=","mcast1=","mcastport0=","mcastport1=","ttl0=","ttl1=","rrpmode=", "broadcast0", "broadcast1","wait_for_all=","auto_tie_breaker=","last_man_standing=", "last_man_standing_window=","no-default-ops","ipv6","token=", "consensus=", "miss_count_const=", "fail_recv_const=","join="]
         # pull out negative number arguments and add them back after getopt
         prev_arg = ""
         for arg in argv:
diff --git a/pcs/usage.py b/pcs/usage.py
index 0053381..91d15da 100644
--- a/pcs/usage.py
+++ b/pcs/usage.py
@@ -438,7 +438,9 @@ Commands:
                             [--ttl1 <ttl>]] | [--broadcast1]]]]
             [--wait_for_all=<0|1>] [--auto_tie_breaker=<0|1>]
             [--last_man_standing=<0|1> [--last_man_standing_window=<time in ms>]]
-            [--ipv6]
+            [--ipv6] [--token <timeout>] [--join <timeout>]
+            [--consensus <timeout>] [--miss_count_const <count>]
+            [--fail_recv_const <failures>]
         Configure corosync and sync configuration out to listed nodes
         --local will only perform changes on the local node
         --start will also start the cluster on the specified nodes
@@ -448,6 +450,19 @@ Commands:
         --last_man_standing_window options are all documented in corosync's
         votequorum(5) man page.
         --ipv6 will configure corosync to use ipv6 (instead of ipv4)
+        --token <timeout> sets time in milliseconds until a token loss is
+            declared after not receiving a token (default 1000 ms)
+        --join <timeout> sets time in milliseconds to wait for join mesages
+            (default 50 ms)
+        --consensus <timeout> sets time in milliseconds to wait for consensus
+            to be achieved before starting a new round of membership configuration
+            (default 1200 ms)
+        --miss_count_const <count> sets the maximum number of times on
+            receipt of a token a message is checked for retransmission before
+            a retransmission occurs (default 5 messages)
+        --fail_recv_const <failures> specifies how many rotations of the token
+            without receiving any messages when messages should be received
+            may occur before a new configuration is formed (default 2500 failures)
 
         Configuring Redundant Ring Protocol (RRP)
 
-- 
1.8.5.3