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 {
|
function init_tuskar {
|
||||||
|
|
||||||
# (re)create tuskar database
|
# (re)create tuskar database
|
||||||
recreate_database tuskar utf8
|
recreate_database tuskar
|
||||||
|
|
||||||
tuskar-dbsync --config-file $TUSKAR_CONF
|
tuskar-dbsync --config-file $TUSKAR_CONF
|
||||||
create_tuskar_cache_dir
|
create_tuskar_cache_dir
|
||||||
|
@ -262,7 +262,7 @@ function init_ceilometer {
|
|||||||
|
|
||||||
if is_service_enabled mysql postgresql; then
|
if is_service_enabled mysql postgresql; then
|
||||||
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
|
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] ; then
|
||||||
recreate_database ceilometer utf8
|
recreate_database ceilometer
|
||||||
$CEILOMETER_BIN_DIR/ceilometer-dbsync
|
$CEILOMETER_BIN_DIR/ceilometer-dbsync
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -376,7 +376,7 @@ function init_cinder {
|
|||||||
|
|
||||||
if is_service_enabled $DATABASE_BACKENDS; then
|
if is_service_enabled $DATABASE_BACKENDS; then
|
||||||
# (Re)create cinder database
|
# (Re)create cinder database
|
||||||
recreate_database cinder utf8
|
recreate_database cinder
|
||||||
|
|
||||||
# Migrate cinder database
|
# Migrate cinder database
|
||||||
$CINDER_BIN_DIR/cinder-manage db sync
|
$CINDER_BIN_DIR/cinder-manage db sync
|
||||||
|
@ -98,11 +98,9 @@ function initialize_database_backends {
|
|||||||
|
|
||||||
# Recreate a given database
|
# Recreate a given database
|
||||||
# $1 The name of the database
|
# $1 The name of the database
|
||||||
# $2 The character set/encoding of the database
|
|
||||||
function recreate_database {
|
function recreate_database {
|
||||||
local db=$1
|
local db=$1
|
||||||
local charset=$2
|
recreate_database_$DATABASE_TYPE $db
|
||||||
recreate_database_$DATABASE_TYPE $db $charset
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install the database
|
# Install the database
|
||||||
|
@ -43,9 +43,8 @@ function cleanup_database_mysql {
|
|||||||
|
|
||||||
function recreate_database_mysql {
|
function recreate_database_mysql {
|
||||||
local db=$1
|
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 "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 {
|
function configure_database_mysql {
|
||||||
|
@ -37,10 +37,9 @@ function cleanup_database_postgresql {
|
|||||||
|
|
||||||
function recreate_database_postgresql {
|
function recreate_database_postgresql {
|
||||||
local db=$1
|
local db=$1
|
||||||
local charset=$2
|
|
||||||
# Avoid unsightly error when calling dropdb when the database doesn't exist
|
# 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"
|
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 {
|
function configure_database_postgresql {
|
||||||
|
@ -279,7 +279,7 @@ function init_glance {
|
|||||||
mkdir -p $GLANCE_CACHE_DIR
|
mkdir -p $GLANCE_CACHE_DIR
|
||||||
|
|
||||||
# (Re)create glance database
|
# (Re)create glance database
|
||||||
recreate_database glance utf8
|
recreate_database glance
|
||||||
|
|
||||||
# Migrate glance database
|
# Migrate glance database
|
||||||
$GLANCE_BIN_DIR/glance-manage db_sync
|
$GLANCE_BIN_DIR/glance-manage db_sync
|
||||||
|
2
lib/heat
2
lib/heat
@ -170,7 +170,7 @@ function configure_heat {
|
|||||||
function init_heat {
|
function init_heat {
|
||||||
|
|
||||||
# (re)create heat database
|
# (re)create heat database
|
||||||
recreate_database heat utf8
|
recreate_database heat
|
||||||
|
|
||||||
$HEAT_DIR/bin/heat-manage db_sync
|
$HEAT_DIR/bin/heat-manage db_sync
|
||||||
create_heat_cache_dir
|
create_heat_cache_dir
|
||||||
|
@ -380,7 +380,7 @@ function create_ironic_accounts {
|
|||||||
# init_ironic() - Initialize databases, etc.
|
# init_ironic() - Initialize databases, etc.
|
||||||
function init_ironic {
|
function init_ironic {
|
||||||
# (Re)create ironic database
|
# (Re)create ironic database
|
||||||
recreate_database ironic utf8
|
recreate_database ironic
|
||||||
|
|
||||||
# Migrate ironic database
|
# Migrate ironic database
|
||||||
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
|
$IRONIC_BIN_DIR/ironic-dbsync --config-file=$IRONIC_CONF_FILE
|
||||||
|
@ -448,7 +448,7 @@ function init_keystone {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# (Re)create keystone database
|
# (Re)create keystone database
|
||||||
recreate_database keystone utf8
|
recreate_database keystone
|
||||||
|
|
||||||
# Initialize keystone database
|
# Initialize keystone database
|
||||||
$KEYSTONE_DIR/bin/keystone-manage db_sync
|
$KEYSTONE_DIR/bin/keystone-manage db_sync
|
||||||
|
@ -592,7 +592,7 @@ function create_neutron_initial_network {
|
|||||||
|
|
||||||
# init_neutron() - Initialize databases, etc.
|
# init_neutron() - Initialize databases, etc.
|
||||||
function init_neutron {
|
function init_neutron {
|
||||||
recreate_database $Q_DB_NAME utf8
|
recreate_database $Q_DB_NAME
|
||||||
# Run Neutron db migrations
|
# Run Neutron db migrations
|
||||||
$NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
|
$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.
|
# 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
|
if is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-api; then
|
||||||
# (Re)create nova database
|
# (Re)create nova database
|
||||||
# Explicitly use latin1: to avoid lp#829209, nova expects the database to
|
recreate_database nova
|
||||||
# use latin1 by default, and then upgrades the database to utf8 (see the
|
|
||||||
# 082_essex.py in nova)
|
|
||||||
recreate_database nova latin1
|
|
||||||
|
|
||||||
# Migrate nova database
|
# Migrate nova database
|
||||||
$NOVA_BIN_DIR/nova-manage db sync
|
$NOVA_BIN_DIR/nova-manage db sync
|
||||||
|
|
||||||
if is_service_enabled n-cell; then
|
if is_service_enabled n-cell; then
|
||||||
recreate_database $NOVA_CELLS_DB latin1
|
recreate_database $NOVA_CELLS_DB
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ function configure_sahara {
|
|||||||
setup_colorized_logging $SAHARA_CONF_FILE DEFAULT
|
setup_colorized_logging $SAHARA_CONF_FILE DEFAULT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
recreate_database sahara utf8
|
recreate_database sahara
|
||||||
$SAHARA_BIN_DIR/sahara-db-manage --config-file $SAHARA_CONF_FILE upgrade head
|
$SAHARA_BIN_DIR/sahara-db-manage --config-file $SAHARA_CONF_FILE upgrade head
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ function install_trove {
|
|||||||
# init_trove() - Initializes Trove Database as a Service
|
# init_trove() - Initializes Trove Database as a Service
|
||||||
function init_trove {
|
function init_trove {
|
||||||
# (Re)Create trove db
|
# (Re)Create trove db
|
||||||
recreate_database trove utf8
|
recreate_database trove
|
||||||
|
|
||||||
# Initialize the trove database
|
# Initialize the trove database
|
||||||
$TROVE_BIN_DIR/trove-manage db_sync
|
$TROVE_BIN_DIR/trove-manage db_sync
|
||||||
|
Loading…
Reference in New Issue
Block a user