From f4b7ae95ac24f395e8d7ddd36cba362659fd29b4 Mon Sep 17 00:00:00 2001 From: Martin André Date: Mon, 19 Jan 2015 15:06:28 +0900 Subject: Check for nova DB availability in dependent containers When nova-api start and the nova database hasn't yet been created, it would create it itself, preventing the migration in nova-conductor to run and making it unable to start. This commit ensures that nova-api container will not try to steal nova-conductor's job of creating the nova database. Nova-scheduler reacts differently to the missing database and simply exits with a backtrace. This commit also prevents nova-scheduler to start when the nova database cannot be found. Change-Id: Ib6f7521151815faa7a26ec1d170df5a1cdb7fd63 Related-Bug: #1335804 --- docker/fedora-rdo-base/kolla-common.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'docker/fedora-rdo-base') diff --git a/docker/fedora-rdo-base/kolla-common.sh b/docker/fedora-rdo-base/kolla-common.sh index c9ba03be5..56c658c43 100644 --- a/docker/fedora-rdo-base/kolla-common.sh +++ b/docker/fedora-rdo-base/kolla-common.sh @@ -56,12 +56,14 @@ check_for_neutron() { } # Exit unless we receive a successful response from the database server. +# Optionally takes a database name to check for. Defaults to 'mysql'. check_for_db() { + local database=${1:-mysql} check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" \ - -e "select 1" mysql > /dev/null 2>&1 || { - echo "ERROR: database is not available @ $MARIADB_SERVICE_HOST" >&2 + -e "select 1" $database > /dev/null 2>&1 || { + echo "ERROR: database $database is not available @ $MARIADB_SERVICE_HOST" >&2 exit 1 } -- cgit v1.2.3