6 MYSQL_PASSWORD="cinder"
10 [ "$ec" -gt "$EC" ] && EC=$ec
14 function prepare_vm(){
15 if [[ $(cat /etc/*-release | head -n 1 | awk '{print $1}') =~ Ubuntu ]]
17 echo "mysql-server mysql-server/root_password select $MYSQL_PASSWORD" |
18 debconf-set-selections
19 echo "mysql-server mysql-server/root_password_again select $MYSQL_PASSWORD" |
20 debconf-set-selections
21 apt-get install -y mysql-server python-mysqldb rabbitmq-server curl screen nmap
23 yum install -y mysql-server mysql-wsrep-client-5.6 MySQL-python nmap-ncat
24 # workaround for `sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)
25 # (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")`
27 local current_password=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}')
29 mysqladmin -u root -p"$current_password" password "$MYSQL_PASSWORD"
31 mysql -uroot -p"$MYSQL_PASSWORD" << MYSQL_SCRIPT
32 CREATE DATABASE cinder;
33 CREATE USER 'cinder'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';
34 GRANT ALL PRIVILEGES ON *.* TO 'cinder'@'localhost';
36 cinder-manage --config-file /usr/share/cinder/cinder-dist.conf db sync
40 function test_cinder_service(){
45 service "$service" start
48 echo | ncat -w 5 localhost "$port"
54 echo "Cinder $1 successfully started"
56 echo "$service failed to start!"
57 tail -n 40 /var/log/messages
62 function test_cinder_configs(){
63 local files=("/etc/cinder/cinder.conf"
64 "/etc/cinder/api-paste.ini"
65 "/etc/cinder/policy.json")
66 for f in "${files[@]}"
68 [ -f "$f" ] ; update_ec "$?"
75 local imports=("cinder"
76 "cinder.volume.drivers.lvm"
77 "cinder.volume.drivers.rbd")
78 for x in "${imports[@]}"
80 python -c "import $x" ; update_ec "$?"
86 ls /usr/bin/cinder* ; update_ec "$?"
87 test_cinder_service openstack-cinder-api 8776 ; update_ec "$?"
88 [ -f "/usr/bin/cinder-volume" ] ; update_ec "$?"
89 [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?"
93 [ -f "/usr/bin/cinder-manage" ] ; update_ec "$?"
96 [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?"
100 # Should be fixed with next update of Ubuntu package.
102 # [ -f "/usr/bin/cinder-api" ] ; update_ec "$?"
103 # test_cinder_service cinder-api 8776 ; update_ec "$?"
106 [ -f "/usr/bin/cinder-volume" ] ; update_ec "$?"
109 [ -f "/usr/bin/cinder-backup" ] ; update_ec "$?"
111 cinder-doc|openstack-cinder-doc)
112 echo "Skipping test for $1"
116 echo "Test not defined for $1"