From 5986e05c6fe36c605811a5398dbd3328a6e7a144 Mon Sep 17 00:00:00 2001 From: Rafael Folco Date: Wed, 18 May 2016 14:35:21 +0000 Subject: [PATCH] Copied missing parts of the functions overrides Fixes missing varirables inside the overrides. --- README.rst | 7 +++++++ devstack/lib/mariadb | 21 ++++++++++++++++++--- devstack/plugin.sh | 8 ++++---- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index e5f9626..cbcbdd4 100644 --- a/README.rst +++ b/README.rst @@ -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 ====================== diff --git a/devstack/lib/mariadb b/devstack/lib/mariadb index 66d6427..192e1b8 100755 --- a/devstack/lib/mariadb +++ b/devstack/lib/mariadb @@ -17,6 +17,18 @@ function configure_mariadb { mysql=mysql 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 echo_summary "Enabling MySQL query logging" 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 log-queries-not-using-indexes 1 fi + restart_service $mysql } 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 cat <$HOME/.my.cnf [client] @@ -44,9 +60,8 @@ host=$MYSQL_HOST EOF chmod 0600 $HOME/.my.cnf fi - if is_ubuntu; then - install_package mariadb-server - fi + + install_package mariadb-server } function stop_mariadb { diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 0e26ed9..ab0bdf9 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -18,12 +18,12 @@ if is_service_enabled mysql && is_ubuntu; then install_mariadb } - if [[ "$1" == "stack" && "$2" == "install" ]]; then - echo_summary "Installing MariaDB" - install_mariadb - elif [[ "$1" == "stack" && "$2" == "pre-install" ]]; then + if [[ "$1" == "stack" && "$2" == "pre-install" ]]; then # nothing needed here : + elif [[ "$1" == "stack" && "$2" == "install" ]]; then + echo_summary "Installing MariaDB" + install_mariadb elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then echo_summary "Configuring MariaDB" configure_mariadb