Copied missing parts of the functions overrides

Fixes missing varirables inside the overrides.
This commit is contained in:
Rafael Folco 2016-05-18 14:35:21 +00:00
parent d1de0d4207
commit 5986e05c6f
3 changed files with 29 additions and 7 deletions

View File

@ -1,3 +1,10 @@
================
MariaDB Plugin
================
This plugin enables MariaDB opensource flavor of MySQL for Ubuntu users on
Devstack. It overrides functions at lib/databases/mysql.
====================== ======================
Enabling in Devstack Enabling in Devstack
====================== ======================

View File

@ -17,6 +17,18 @@ function configure_mariadb {
mysql=mysql mysql=mysql
sudo mysql -uroot -hlocalhost -e "GRANT ALL PRIVILEGES ON *.* TO '$DATABASE_USER'@'%' identified by '$DATABASE_PASSWORD';" sudo mysql -uroot -hlocalhost -e "GRANT ALL PRIVILEGES ON *.* TO '$DATABASE_USER'@'%' identified by '$DATABASE_PASSWORD';"
# Now update ``my.cnf`` for some local needs and restart the mysql service
# Change bind-address from localhost (127.0.0.1) to any (::) and
# set default db type to InnoDB
iniset -sudo $my_conf mysqld bind-address "$SERVICE_LISTEN_ADDRESS"
iniset -sudo $my_conf mysqld sql_mode STRICT_ALL_TABLES
iniset -sudo $my_conf mysqld default-storage-engine InnoDB
iniset -sudo $my_conf mysqld max_connections 1024
iniset -sudo $my_conf mysqld query_cache_type OFF
iniset -sudo $my_conf mysqld query_cache_size 0
if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then if [[ "$DATABASE_QUERY_LOGGING" == "True" ]]; then
echo_summary "Enabling MySQL query logging" echo_summary "Enabling MySQL query logging"
slow_log=/var/log/mariadb/mariadb-slow.log slow_log=/var/log/mariadb/mariadb-slow.log
@ -31,10 +43,14 @@ function configure_mariadb {
iniset -sudo $my_conf mysqld long-query-time 0 iniset -sudo $my_conf mysqld long-query-time 0
iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1 iniset -sudo $my_conf mysqld log-queries-not-using-indexes 1
fi fi
restart_service $mysql restart_service $mysql
} }
function install_mariadb { function install_mariadb {
# while ``.my.cnf`` is not needed for OpenStack to function, it is useful
# as it allows you to access the mysql databases via ``mysql nova`` instead
# of having to specify the username/password each time.
if [[ ! -e $HOME/.my.cnf ]]; then if [[ ! -e $HOME/.my.cnf ]]; then
cat <<EOF >$HOME/.my.cnf cat <<EOF >$HOME/.my.cnf
[client] [client]
@ -44,9 +60,8 @@ host=$MYSQL_HOST
EOF EOF
chmod 0600 $HOME/.my.cnf chmod 0600 $HOME/.my.cnf
fi fi
if is_ubuntu; then
install_package mariadb-server install_package mariadb-server
fi
} }
function stop_mariadb { function stop_mariadb {

View File

@ -18,12 +18,12 @@ if is_service_enabled mysql && is_ubuntu; then
install_mariadb install_mariadb
} }
if [[ "$1" == "stack" && "$2" == "install" ]]; then if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
echo_summary "Installing MariaDB"
install_mariadb
elif [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
# nothing needed here # nothing needed here
: :
elif [[ "$1" == "stack" && "$2" == "install" ]]; then
echo_summary "Installing MariaDB"
install_mariadb
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
echo_summary "Configuring MariaDB" echo_summary "Configuring MariaDB"
configure_mariadb configure_mariadb