Add a flag to rabbitmq so that we can deploy with ha-mode: all again
authorMichele Baldessari <michele@acksyn.org>
Wed, 26 Apr 2017 08:12:50 +0000 (10:12 +0200)
committerMichele Baldessari <michele@acksyn.org>
Wed, 26 Apr 2017 08:24:54 +0000 (10:24 +0200)
In change Ib62001c03e1e08f58cf0c6e0ba07a8879a584084 we switched the
rabbitmq queues HA mode from ha-all to ha-exactly. While this gives us a
nice performance boost with rabbitmq, it makes rabbit less resilient to
network glitches as we painfully found out via
https://bugzilla.redhat.com/show_bug.cgi?id=1441635.

Will propose another THT change to actually change the default to
-1 so we get this ha-mode:all by default.

Change-Id: I9a90e71094b8d8d58b5be0a45a2979701b0ac21c
Partial-Bug: #1686337
Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>
Co-Authored-By: John Eckersberg <jeckersb@redhat.com>
manifests/profile/pacemaker/rabbitmq.pp

index f4b679a..bf6a38d 100644 (file)
@@ -30,7 +30,7 @@
 #   (Optional) The number of HA queues in to be configured in rabbitmq
 #   Defaults to hiera('rabbitmq::nr_ha_queues'), which is usually 0 meaning
 #   that the queues number will be CEIL(N/2) where N is the number of rabbitmq
-#   nodes.
+#   nodes. The special value of -1 represents the mode 'ha-mode: all'
 #
 # [*rabbit_nodes*]
 #   (Optional) The list of rabbitmq nodes names
@@ -90,12 +90,16 @@ class tripleo::profile::pacemaker::rabbitmq (
       if $user_ha_queues == 0 {
         $nr_rabbit_nodes = size($rabbit_nodes)
         $nr_ha_queues = $nr_rabbit_nodes / 2 + ($nr_rabbit_nodes % 2)
+        $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
+      } elsif $user_ha_queues == -1 {
+        $params = 'set_policy=\'ha-all ^(?!amq\.).* {"ha-mode":"all"}\''
       } else {
         $nr_ha_queues = $user_ha_queues
+        $params = "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'"
       }
       pacemaker::resource::ocf { 'rabbitmq':
         ocf_agent_name  => 'heartbeat:rabbitmq-cluster',
-        resource_params => "set_policy='ha-all ^(?!amq\\.).* {\"ha-mode\":\"exactly\",\"ha-params\":${nr_ha_queues}}'",
+        resource_params => $params,
         clone_params    => 'ordered=true interleave=true',
         meta_params     => 'notify=true',
         op_params       => 'start timeout=200s stop timeout=200s',