From 6bc905c3488a93fa87776bcd0af7e362a90b082f Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Fri, 15 May 2015 12:51:43 +1000 Subject: [PATCH] Change the restart_rpc_backend loop to accomodate async rabbitmq Some distros have converted to systemd for starting RabbitMQ. This has resulted in: --- [Call Trace] ./stack.sh:904:restart_rpc_backend /home/stack/projects/openstack/openstack-dev/devstack/lib/rpc_backend:201:die [ERROR] /home/stack/projects/openstack/openstack-dev/devstack/lib/rpc_backend:201 Failed to set rabbitmq password Error on exit World dumping... see /opt/stack/logs/worlddump-2015-05-29-031618.txt for details --- Because 'restart_service rabbitmq-server' returns before the server is ready to accept connections. Alter the retry loop to only restart the rabbitmq-server every second time through the loop. Allowing time for the slow rabbit to start. Closes-Bug: 1449056 Change-Id: Ibb291c1ecfd109f9ed10b5f194933364985cc1ce --- lib/rpc_backend | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/rpc_backend b/lib/rpc_backend index 297ebacc08..33ab03d664 100644 --- a/lib/rpc_backend +++ b/lib/rpc_backend @@ -194,13 +194,22 @@ function restart_rpc_backend { # NOTE(bnemec): Retry initial rabbitmq configuration to deal with # the fact that sometimes it fails to start properly. # Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1144100 + # NOTE(tonyb): Extend the orginal retry logic to only restart rabbitmq + # every second time around the loop. + # See: https://bugs.launchpad.net/devstack/+bug/1449056 for details on + # why this is needed. This can bee seen on vivid and Debian unstable + # (May 2015) + # TODO(tonyb): Remove this when Debian and Ubuntu have a fixed systemd + # service file. local i - for i in `seq 10`; do + for i in `seq 20`; do local rc=0 - [[ $i -eq "10" ]] && die $LINENO "Failed to set rabbitmq password" + [[ $i -eq "20" ]] && die $LINENO "Failed to set rabbitmq password" - restart_service rabbitmq-server + if [[ $(( i % 2 )) == "0" ]] ; then + restart_service rabbitmq-server + fi rabbit_setuser "$RABBIT_USERID" "$RABBIT_PASSWORD" || rc=$? if [ $rc -ne 0 ]; then