diff --git a/extras.d/70-tuskar.sh b/extras.d/70-tuskar.sh index 38aba34518..6e26db2804 100644 --- a/extras.d/70-tuskar.sh +++ b/extras.d/70-tuskar.sh @@ -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 diff --git a/lib/ceilometer b/lib/ceilometer index 98a7e8f0e0..d48751e5a3 100644 --- a/lib/ceilometer +++ b/lib/ceilometer @@ -265,7 +265,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 diff --git a/lib/cinder b/lib/cinder index f1a5de7e05..6eee880fef 100644 --- a/lib/cinder +++ b/lib/cinder @@ -387,7 +387,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 diff --git a/lib/database b/lib/database index 896b8e1430..b114e9e4f6 100644 --- a/lib/database +++ b/lib/database @@ -99,11 +99,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 diff --git a/lib/databases/mysql b/lib/databases/mysql index 7bd74dce27..2f3b6d4123 100644 --- a/lib/databases/mysql +++ b/lib/databases/mysql @@ -58,9 +58,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 { diff --git a/lib/databases/postgresql b/lib/databases/postgresql index 76491c479d..ad8cdc77a2 100644 --- a/lib/databases/postgresql +++ b/lib/databases/postgresql @@ -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 { diff --git a/lib/glance b/lib/glance index 8cda6be00a..87687613cd 100644 --- a/lib/glance +++ b/lib/glance @@ -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 diff --git a/lib/heat b/lib/heat index ee3f502b2c..9a28af568b 100644 --- a/lib/heat +++ b/lib/heat @@ -175,7 +175,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 diff --git a/lib/ironic b/lib/ironic index d5afa30eb7..4e1a1f0352 100644 --- a/lib/ironic +++ b/lib/ironic @@ -386,7 +386,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 diff --git a/lib/keystone b/lib/keystone index 9bde597177..f378547179 100644 --- a/lib/keystone +++ b/lib/keystone @@ -456,7 +456,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 diff --git a/lib/neutron b/lib/neutron index 90991d15e0..f9ea04f26b 100755 --- a/lib/neutron +++ b/lib/neutron @@ -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 for svc in fwaas lbaas vpnaas; do diff --git a/lib/nova b/lib/nova index 61216ff9d6..76212edc96 100644 --- a/lib/nova +++ b/lib/nova @@ -628,16 +628,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 diff --git a/lib/sahara b/lib/sahara index c902d385d1..8573ee83c8 100644 --- a/lib/sahara +++ b/lib/sahara @@ -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 } diff --git a/lib/trove b/lib/trove index abf4e87f9d..3249ce0746 100644 --- a/lib/trove +++ b/lib/trove @@ -199,7 +199,7 @@ function install_trove { # init_trove() - Initializes Trove Database as a Service function init_trove { # (Re)Create trove db - recreate_database trove utf8 + recreate_database trove # Initialize the trove database $TROVE_BIN_DIR/trove-manage db_sync