8 if [[ `cat /etc/*-release | head -n 1 | awk '{print $1}'` =~ Ubuntu ]]
10 echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" | sudo debconf-set-selections
11 echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" | sudo debconf-set-selections
12 apt-get install -y mysql-server python-mysqldb rabbitmq-server curl screen
14 yum install net-tools mysql-server mysql-wsrep-client-5.6 MySQL-python -y
16 # workaround for `sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)
17 # (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")`
19 MYSQL_PASSWORD=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}')
21 /usr/bin/mysqladmin -u root -p$MYSQL_PASSWORD password $SERVICE
23 mysql -uroot -p$SERVICE <<MYSQL_SCRIPT
24 CREATE DATABASE cinder;
25 CREATE USER 'cinder'@'localhost' IDENTIFIED BY 'cinder';
26 GRANT ALL PRIVILEGES ON * . * TO 'cinder'@'localhost';
31 function test_cinder_service(){
32 echo "Starting Cinder $1..."
37 service_running=`netstat -nat | grep $2 | wc -l`
38 if [ $service_running -eq 0 ]; then
39 echo "Can not start Cinder $1 service"
40 tail -n 40 /var/log/messages
43 echo "Cinder $1 successfully started"
49 function check_file_exists(){
50 if [ ! -f "$1" ]; then
56 function test_cinder_configs(){
57 declare -a files=("/etc/cinder/cinder.conf" "/etc/cinder/api-paste.ini" "/etc/cinder/policy.json")
58 for f in "${files[@]}"
60 check_file_exists "$f"
67 declare -a imports=("cinder" "cinder.volume.drivers.lvm" "cinder.volume.drivers.rbd")
68 for i in "${imports[@]}"
81 count=`ls -1 /usr/bin/cinder* 2>/dev/null | wc -l`
82 if [ $count -eq 0 ]; then
86 test_cinder_service openstack-cinder-api 8776
87 check_file_exists "/usr/bin/cinder-volume"
88 check_file_exists "/usr/bin/cinder-scheduler"
92 check_file_exists "/usr/bin/cinder-manage"
95 check_file_exists "/usr/bin/cinder-scheduler"
98 check_file_exists "/usr/bin/cinder-api"
99 test_cinder_service cinder-api 8776
102 check_file_exists "/usr/bin/cinder-volume"
104 openstack-cinder-doc)
105 echo "No test for docs defined"
108 echo "Test is not defined, skipping..."