Enforce UTF-8 encoding when creating databases
We use InnoDB everywhere, so there should be no issues with long unicode keys. Dropped charset parameter for recreate_database since it's not needed anymore. Change-Id: Ib768402a9337c918309030a92ab81da17269f4f6
This commit is contained in:
parent
5c0a3cfb71
commit
157c84b876
@ -131,7 +131,7 @@ function configure_tuskar {
|
||||
function init_tuskar {
|
||||
|
||||
# (re)create tuskar database
|
||||
recreate_database tuskar utf8
|
||||
recreate_database tuskar
|
||||
|
||||
tuskar-dbsync --config-file $TUSKAR_CONF
|
||||
create_tuskar_cache_dir
|
||||
|
@ -262,7 +262,7 @@ function init_ceilometer {
|
||||
|
||||
if is_service_enabled mysql postgresql; then
|
||||
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
|
||||
recreate_database ceilometer utf8
|
||||
recreate_database ceilometer
|
||||
$CEILOMETER_BIN_DIR/ceilometer-dbsync
|
||||
fi
|
||||
fi
|
||||
|
@ -376,7 +376,7 @@ function init_cinder {
|
||||
|
||||
if is_service_enabled $DATABASE_BACKENDS; then
|
||||
# (Re)create cinder database
|
||||
recreate_database cinder utf8
|
||||
recreate_database cinder
|
||||
|
||||
# Migrate cinder database
|
||||
$CINDER_BIN_DIR/cinder-manage db sync
|
||||
|
@ -98,11 +98,9 @@ function initialize_database_backends {
|
||||
|
||||
# Recreate a given database
|
||||
# $1 The name of the database
|
||||
# $2 The character set/encoding of the database
|
||||
function recreate_database {
|
||||
local db=$1
|
||||
local charset=$2
|
||||
recreate_database_$DATABASE_TYPE $db $charset
|
||||
recreate_database_$DATABASE_TYPE $db
|
||||
}
|
||||
|
||||
# Install the database
|
||||
|
@ -43,9 +43,8 @@ function cleanup_database_mysql {
|
||||
|
||||
function recreate_database_mysql {
|
||||
local db=$1
|
||||
local charset=$2
|
||||
mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "DROP DATABASE IF EXISTS $db;"
|
||||
mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "CREATE DATABASE $db CHARACTER SET $charset;"
|
||||
mysql -u$DATABASE_USER -p$DATABASE_PASSWORD -h$MYSQL_HOST -e "CREATE DATABASE $db CHARACTER SET utf8;"
|
||||
}
|
||||
|
||||
function configure_database_mysql {
|
||||
|
@ -37,10 +37,9 @@ function cleanup_database_postgresql {
|
||||
|
||||
function recreate_database_postgresql {
|
||||
local db=$1
|
||||
local charset=$2
|
||||
# Avoid unsightly error when calling dropdb when the database doesn't exist
|
||||
psql -h$DATABASE_HOST -U$DATABASE_USER -dtemplate1 -c "DROP DATABASE IF EXISTS $db"
|
||||
createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E $charset $db
|
||||
createdb -h $DATABASE_HOST -U$DATABASE_USER -l C -T template0 -E utf8 $db
|
||||
}
|
||||
|
||||
function configure_database_postgresql {
|
||||
|
@ -279,7 +279,7 @@ function init_glance {
|
||||
mkdir -p $GLANCE_CACHE_DIR
|
||||
|
||||
# (Re)create glance database
|
||||
recreate_database glance utf8
|
||||
recreate_database glance
|
||||
|
||||
# Migrate glance database
|
||||
$GLANCE_BIN_DIR/glance-manage db_sync
|
||||
|
2
lib/heat
2
lib/heat
@ -170,7 +170,7 @@ function configure_heat {
|
||||
function init_heat {
|
||||
|
||||
# (re)create heat database
|
||||
recreate_database heat utf8
|
||||
recreate_database heat
|
||||
|
||||
$HEAT_DIR/bin/heat-manage db_sync
|
||||
create_heat_cache_dir
|
||||
|
@ -380,7 +380,7 @@ function create_ironic_accounts {
|
||||
# init_ironic() - Initialize databases, etc.
|
||||
function init_ironic {
|
||||
# (Re)create ironic database
|
||||
recreate_database ironic utf8
|
||||
recreate_database ironic
|
||||
|
||||
# Migrate ironic database
|
||||
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
|
||||
|
@ -448,7 +448,7 @@ function init_keystone {
|
||||
fi
|
||||
|
||||
# (Re)create keystone database
|
||||
recreate_database keystone utf8
|
||||
recreate_database keystone
|
||||
|
||||
# Initialize keystone database
|
||||
$KEYSTONE_DIR/bin/keystone-manage db_sync
|
||||
|
@ -592,7 +592,7 @@ function create_neutron_initial_network {
|
||||
|
||||
# init_neutron() - Initialize databases, etc.
|
||||
function init_neutron {
|
||||
recreate_database $Q_DB_NAME utf8
|
||||
recreate_database $Q_DB_NAME
|
||||
# Run Neutron db migrations
|
||||
$NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
|
||||
}
|
||||
|
7
lib/nova
7
lib/nova
@ -623,16 +623,13 @@ function init_nova {
|
||||
# Only do this step once on the API node for an entire cluster.
|
||||
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then
|
||||
# (Re)create nova database
|
||||
# Explicitly use latin1: to avoid lp#829209, nova expects the database to
|
||||
# use latin1 by default, and then upgrades the database to utf8 (see the
|
||||
# 082_essex.py in nova)
|
||||
recreate_database nova latin1
|
||||
recreate_database nova
|
||||
|
||||
# Migrate nova database
|
||||
$NOVA_BIN_DIR/nova-manage db sync
|
||||
|
||||
if is_service_enabled n-cell; then
|
||||
recreate_database $NOVA_CELLS_DB latin1
|
||||
recreate_database $NOVA_CELLS_DB
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -143,7 +143,7 @@ function configure_sahara {
|
||||
setup_colorized_logging $SAHARA_CONF_FILE DEFAULT
|
||||
fi
|
||||
|
||||
recreate_database sahara utf8
|
||||
recreate_database sahara
|
||||
$SAHARA_BIN_DIR/sahara-db-manage --config-file $SAHARA_CONF_FILE upgrade head
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user