Add option to not run db sync

Database syncs should not be required every time a container starts.
We can default database startup to true, but give the option
to set it to false.

Change-Id: Ib76876b2671f6c31f4511412efd3a438ec78f01f
Closes-bug: #1467576
This commit is contained in:
Ryan Hallisey 2015-06-22 15:29:54 -04:00
parent 64f23c1d13
commit 2dbde4ad8e
7 changed files with 43 additions and 19 deletions

View File

@ -5,13 +5,13 @@ set -e
. /opt/kolla/config-designate.sh
check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD DESIGNATE_DB_NAME \
DESIGNATE_DB_USER DESIGNATE_DB_PASSWORD DESIGNATE_INITDB
DESIGNATE_DB_USER DESIGNATE_DB_PASSWORD INIT_DESIGNATE_DB
fail_unless_db
CONF=/etc/designate/designate.conf
if [ "${DESIGNATE_INITDB}" == "true" ]; then
if [ "${INIT_DESIGNATE_DB}" == "true" ]; then
echo "Configuring database"
mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${DESIGNATE_DB_NAME};

View File

@ -5,17 +5,20 @@ set -e
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-glance.sh
check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD
check_required_vars GLANCE_DB_NAME GLANCE_DB_USER GLANCE_DB_PASSWORD \
INIT_GLANCE_DB
# lets wait for the DB to be available
wait_for 25 1 check_for_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
if [ "${INIT_GLANCE_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${GLANCE_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${GLANCE_DB_NAME}.* TO
'${GLANCE_DB_USER}'@'%' IDENTIFIED BY '${GLANCE_DB_PASSWORD}'
EOF
/usr/bin/glance-manage db_sync
/usr/bin/glance-manage db_sync
fi
exec /usr/bin/glance-registry

View File

@ -3,15 +3,18 @@
. /opt/kolla/kolla-common.sh
. /opt/kolla/config-heat.sh
check_required_vars HEAT_DB_NAME HEAT_DB_USER HEAT_DB_PASSWORD
check_required_vars HEAT_DB_NAME HEAT_DB_USER HEAT_DB_PASSWORD \
INIT_HEAT_DB
fail_unless_db
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
if [ "${INIT_HEAT_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${HEAT_DB_NAME} DEFAULT CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${HEAT_DB_NAME}.* TO
'${HEAT_DB_USER}'@'%' IDENTIFIED BY '${HEAT_DB_PASSWORD}'
EOF
/usr/bin/heat-manage db_sync
/usr/bin/heat-manage db_sync
fi
exec /usr/bin/heat-engine

View File

@ -14,7 +14,7 @@ echo "Running the kolla-common script"
: ${KEYSTONE_ADMIN_PASSWORD:=password}
: ${KEYSTONE_ADMIN_TOKEN:=changeme}
# DB Settings
: ${INIT_DB:=true}
: ${INIT_KEYSTONE_DB:=true}
: ${KEYSTONE_DB_NAME:=keystone}
: ${KEYSTONE_DB_USER:=keystone}
: ${DB_ROOT_PASSWORD:=password}
@ -42,7 +42,7 @@ echo "Checking for required variables"
check_required_vars KEYSTONE_ADMIN_TOKEN KEYSTONE_DB_PASSWORD \
KEYSTONE_ADMIN_PASSWORD ADMIN_TENANT_NAME \
KEYSTONE_PUBLIC_SERVICE_HOST KEYSTONE_ADMIN_SERVICE_HOST \
PUBLIC_IP
PUBLIC_IP INIT_KEYSTONE_DB
dump_vars
# Setup the Keystone DB
@ -126,7 +126,7 @@ chmod -R o-rwx /etc/keystone/ssl
# Initialize the Keystone DB
echo "Initializing Keystone DB"
if [ "${INIT_DB}" == "true" ] ; then
if [ "${INIT_KEYSTONE_DB}" == "true" ] ; then
su -s /bin/bash -c "keystone-manage db_sync" keystone
fi

View File

@ -4,7 +4,8 @@ set -e
. /opt/kolla/config-nova.sh
check_required_vars NOVA_DB_NAME NOVA_DB_USER NOVA_DB_PASSWORD
check_required_vars NOVA_DB_NAME NOVA_DB_USER NOVA_DB_PASSWORD \
INIT_NOVA_DB
fail_unless_db
cfg=/etc/nova/nova.conf
@ -12,12 +13,14 @@ cfg=/etc/nova/nova.conf
# configure logging
crudini --set $cfg DEFAULT log_file "${NOVA_CONDUCTOR_LOG_FILE}"
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
if [ "${INIT_NOVA_DB}" == "true" ]; then
mysql -h ${MARIADB_SERVICE_HOST} -u root -p${DB_ROOT_PASSWORD} mysql <<EOF
CREATE DATABASE IF NOT EXISTS ${NOVA_DB_NAME};
GRANT ALL PRIVILEGES ON ${NOVA_DB_NAME}.* TO
'${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}'
'${NOVA_DB_USER}'@'%' IDENTIFIED BY '${NOVA_DB_PASSWORD}'
EOF
nova-manage db sync
nova-manage db sync
fi
exec /usr/bin/nova-conductor --config-file /etc/nova/nova.conf

View File

@ -112,6 +112,12 @@ all containers. This allows a simple method of ensuring every type of node
HEAT_API_SERVICE_HOST=<IP> - The IP Address where the Heat API service is hosted
HEAT_API_CFN_SERVICE_HOST=<IP> - The IP Address where Heat users will contact the heat-engine in search for meta data
HEAT_API_CFN_URL_HOST=<IP> - The IP Address where Heat virtual machines will contact the heat-engine to signal wait conditions
INIT_CINDER_DB=<true|false> - Initialize or update the Cinder db
INIT_DESIGNATE_DB=<true|false> - Initialize or update the Designate db
INIT_GLANCE_DB=<true|false> - Initialize or update the Glance db
INIT_HEAT_DB=<true|false> - Initialize or update the Heat db
INIT_KEYSTONE_DB=<true|false> - Initialize or update the Keystone db
INIT_NOVA_DB=<true|false> - Initialize or update the Nova db
PUBLIC_INTERFACE=<eth1> - The nova public interface
PUBLIC_IP=<Host IP Address> - The IP Address of this host
RABBITMQ_PASS=<rabbit> - The rabbitmq password used to join AMQP
@ -135,7 +141,6 @@ all containers. This allows a simple method of ensuring every type of node
DESIGNATE_API_SERVICE_PORT=<9001> - The port of the Designate API
DESIGNATE_MDNS_PORT=<5354> - The port of the Designate MiniDNS server acting as master server
DESIGNATE_DNS_PORT=<53> - The port of the Designate-backed DNS slaves that are used by the world
DESIGNATE_INITDB=<true|false> - Configures if the database should be created and initialised
DESIGNATE_ALLOW_RECURSION=<true|false> - Configure a recursive nameserver
DESIGNATE_DEFAULT_POOL_NS_RECORD=<ns1.example.org.> - Name of server used to generate NS records
DESIGNATE_SINK_NOVA_DOMAIN_NAME=<nova.example.org.> - Name of domain used to create records from Nova notifications
@ -162,7 +167,6 @@ all containers. This allows a simple method of ensuring every type of node
CINDER_VOLUME_BACKEND_NAME=<LVM_iSCSI57> - The backend name for a given driver implementation
CINDER_VOLUME_DRIVER=<cinder.volume.drivers.lvm.LVMISCSIDriver> - The driver used for volume creation
CINDER_ENABLED_BACKEND=<lvm57> - A list of backend names to use
INIT_CINDER_DB=<true|false> - Initialize or update the cinder db
[Minimum environment variable setup guide.](https://github.com/stackforge/kolla/blob/master/docs/minimal-environment-vars.md)

View File

@ -24,9 +24,15 @@ ADMIN_USER_PASSWORD=steakfordinner
# Database
HOST_IP=$MY_IP
INIT_CINDER_DB=true
INIT_DESIGNATE_DB=true
INIT_GLANCE_DB=true
INIT_HEAT_DB=true
INIT_KEYSTONE_DB=true
INIT_NOVA_DB=true
MARIADB_ROOT_PASSWORD=kolla
PASSWORD=12345
INIT_CINDER_DB=true
# Galera
DB_CLUSTER_BIND_ADDRESS=0.0.0.0
@ -155,7 +161,6 @@ DESIGNATE_DNS_PORT=53
DESIGNATE_POOLMAN_POOLID=$(uuidgen)
DESIGNATE_POOLMAN_TARGETS=$(uuidgen)
DESIGNATE_POOLMAN_NSS=$(uuidgen)
DESIGNATE_INITDB=true
DESIGNATE_ALLOW_RECURSION=true
DESIGNATE_DEFAULT_POOL_NS_RECORD=ns1.example.org.
DESIGNATE_SINK_NOVA_DOMAIN_NAME=nova.example.org.
@ -334,6 +339,12 @@ CINDER_API_LOG_FILE=$CINDER_API_LOG_FILE
CINDER_VOLUME_LOG_FILE=$CINDER_VOLUME_LOG_FILE
CINDER_BACKUP_LOG_FILE=$CINDER_BACKUP_LOG_FILE
CINDER_SCHEDULER_LOG_FILE=$CINDER_SCHEDULER_LOG_FILE
INIT_CINDER_DB=$INIT_CINDER_DB
INIT_DESIGNATE_DB=$INIT_DESIGNATE_DB
INIT_GLANCE_DB=$INIT_GLANCE_DB
INIT_HEAT_DB=$INIT_HEAT_DB
INIT_KEYSTONE_DB=$INIT_KEYSTONE_DB
INIT_NOVA_DB=$INIT_NOVA_DB
EOF
echo Please customize your FLAT_INTERFACE to a different network then your
echo main network. The FLAT_INTERFACE is used for inter-VM communication.