Fix up the rabbitmq-ready check

So the current rabbitmq-ready exec has a few unexpected problems:

1) The notify mechanism is not being called, but after discussion
we're comfortable in calling this all the time, just like we do this
for galera.
2) Calling rabbitmqctl inside a container is problematic because
the mere invocation of the cluster_status command will actually
spawn an epmd process which will take the epmd port and which will
subsequently make the rabbitmq-bundle started by pacemaker fail to
form a cluster.

For this reason (working around the rabbitmqctl issue is potentially
doable once we upgrade to erlang 19.x but not with older versions)
it is vital that this container gets spawned with /bin/epmd nooped
to /bin/true.

We now only proceed after rabbit tells us that it is part of a cluster.
Just checking for rabbit being up is not enough because if the user gets
created before the node joins a cluster, it might not be replicated
(depending on the timing).

Partial-Bug: #1739026

Co-Authored-By: Damien Ciabrini <dciabrin@redhat.com>
Co-Authored-By: John Eckersberg <jeckersb@redhat.com>
Change-Id: I54c541d86782665ae0f689428a16edc155f87993
Depends-On: Ie74a13a6c8181948900ea0de8ee9717f76f3ce79
This commit is contained in:
Michele Baldessari 2017-12-12 14:30:09 +01:00
parent 2f603381e0
commit 2f33d74173
1 changed files with 8 additions and 8 deletions

View File

@ -217,20 +217,20 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
bundle => 'rabbitmq-bundle',
require => [Class['::rabbitmq'],
Pacemaker::Resource::Bundle['rabbitmq-bundle']],
notify => Exec['rabbitmq-ready'],
before => Exec['rabbitmq-ready'],
}
# This grep makes sure the rabbit app in erlang is up and running
# which is enough to guarantee that the user will eventually get
# replicated around the cluster
exec { 'rabbitmq-ready':
path => '/usr/sbin:/usr/bin:/sbin:/bin',
command => 'rabbitmqctl status | grep -F "{rabbit,"',
timeout => 30,
tries => 180,
try_sleep => 10,
refreshonly => true,
tag => 'rabbitmq_ready',
path => '/usr/sbin:/usr/bin:/sbin:/bin',
command => 'rabbitmqctl eval "rabbit_mnesia:is_clustered()." | grep -q true',
unless => 'rabbitmqctl eval "rabbit_mnesia:is_clustered()." | grep -q true',
timeout => 30,
tries => 180,
try_sleep => 10,
tag => 'rabbitmq_ready',
}
# Make sure that if we create rabbitmq users at the same step it happens
# after the cluster is up