
In preparation for Liberty, which removes some networks and adds a new type of network interface configuration (manual), this patch refactors the osbash networking code. - fewer hardcoded settings (e.g., removed hardcoded list of networks from osbash.sh) - eliminated code duplication for client-side network configuration and split remaining code into separate libraries (functions.ubuntu.sh, functions.fedora.sh) - simplify code, e.g. by removing some magic that deduced network names for KVM from variable names like MGMT_NET - universal functions for reading network and network interface configuration into arrays (get_host_network_config, get_node_netif_config) - the number of networks is no longer hardcoded in the template for Windows hostnet creation - renamed some variables, functions and files to (hopefully) be easier to understand Change-Id: Ib0ed26e24d07e093f7a2bf29723b53b558cd769b
57 lines
2.0 KiB
Bash
Executable File
57 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -o errexit -o nounset
|
|
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
|
|
source "$TOP_DIR/config/paths"
|
|
source "$CONFIG_DIR/credentials"
|
|
source "$LIB_DIR/functions.guest.sh"
|
|
|
|
exec_logfile
|
|
|
|
indicate_current_auto
|
|
|
|
#-------------------------------------------------------------------------------
|
|
# Controller setup
|
|
|
|
DB_IP=$(get_node_ip_in_network "$(hostname)" "mgmt")
|
|
echo "Will bind MySQL server to $DB_IP."
|
|
|
|
#------------------------------------------------------------------------------
|
|
# Install and configure the database server
|
|
# http://docs.openstack.org/kilo/install-guide/install/apt/content/ch_basic_environment.html
|
|
#------------------------------------------------------------------------------
|
|
|
|
echo "Sourced MySQL password from credentials: $DATABASE_PASSWORD"
|
|
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password '$DATABASE_PASSWORD''
|
|
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password '$DATABASE_PASSWORD''
|
|
|
|
echo "Installing MySQL."
|
|
sudo apt-get install -y mariadb-server python-mysqldb
|
|
|
|
echo "Creating /etc/mysql/conf.d/mysqld_openstack.cnf."
|
|
|
|
echo '[mysqld]' | sudo tee -a /etc/mysql/conf.d/mysqld_openstack.cnf
|
|
|
|
|
|
echo "Configuring MySQL to accept requests by other nodes."
|
|
|
|
conf=/etc/mysql/conf.d/mysqld_openstack.cnf
|
|
# Enable access by other nodes via the management network
|
|
iniset_sudo $conf mysqld bind-address "$DB_IP"
|
|
|
|
# Enable InnoDB
|
|
iniset_sudo $conf mysqld default-storage-engine innodb
|
|
iniset_sudo $conf mysqld innodb_file_per_table 1
|
|
|
|
# Enable UTF-8 character set and UTF-8 collation by default
|
|
iniset_sudo $conf mysqld collation-server utf8_general_ci
|
|
iniset_sudo $conf mysqld init-connect "'SET NAMES utf8'"
|
|
iniset_sudo $conf mysqld character-set-server utf8
|
|
|
|
echo "Restarting MySQL service."
|
|
# Close the file descriptor or the script will hang due to open ssh connection
|
|
sudo service mysql restart 2>/dev/null
|
|
|
|
# TODO(rluethi) do we need mysql_secure_installation?
|
|
# XXX --use-default only in MySQL 5.7.4+ (Ubuntu 12.04 LTS: MySQL 5.5)
|
|
# mysql_secure_installation --use-default
|