Due to the bug referenced below, on Fedora it is possible for
the rabbitmq password change to fail the first time rabbitmq is
started. This change adds a retry loop to avoid the problem in
devstack. One retry should be enough in most (all?) cases, but
this will retry up to ten times just to be safe.
Note that just retrying the password change is not enough. The
rabbitmq-server service must be restarted as well.
Change-Id: I403dcd503aa8e74e2ba6312a0decf0d4fd0d8795
bz: https://bugzilla.redhat.com/show_bug.cgi?id=1059028
... | ... |
@@ -139,12 +139,18 @@ function restart_rpc_backend() { |
139 | 139 |
if is_service_enabled rabbit; then |
140 | 140 |
# Start rabbitmq-server |
141 | 141 |
echo_summary "Starting RabbitMQ" |
142 |
- if is_fedora || is_suse; then |
|
143 |
- # service is not started by default |
|
144 |
- restart_service rabbitmq-server |
|
145 |
- fi |
|
146 |
- # change the rabbit password since the default is "guest" |
|
147 |
- sudo rabbitmqctl change_password guest $RABBIT_PASSWORD |
|
142 |
+ # NOTE(bnemec): Retry initial rabbitmq configuration to deal with |
|
143 |
+ # the fact that sometimes it fails to start properly. |
|
144 |
+ # Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1059028 |
|
145 |
+ for i in `seq 10`; do |
|
146 |
+ if is_fedora || is_suse; then |
|
147 |
+ # service is not started by default |
|
148 |
+ restart_service rabbitmq-server |
|
149 |
+ fi |
|
150 |
+ # change the rabbit password since the default is "guest" |
|
151 |
+ sudo rabbitmqctl change_password guest $RABBIT_PASSWORD && break |
|
152 |
+ [[ $i -eq "10" ]] && die $LINENO "Failed to set rabbitmq password" |
|
153 |
+ done |
|
148 | 154 |
if is_service_enabled n-cell; then |
149 | 155 |
# Add partitioned access for the child cell |
150 | 156 |
if [ -z `sudo rabbitmqctl list_vhosts | grep child_cell` ]; then |