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
22 CONF_FILE='/usr/share/cinder-common/cinder.conf'
24 yum install -y mysql-server mysql-wsrep-client-5.6 MySQL-python nmap-ncat
25 CONF_FILE='/usr/share/cinder/cinder-dist.conf'
26 # workaround for `sqlalchemy.exc.OperationalError: (_mysql_exceptions.OperationalError)
27 # (2002, "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")`
29 local current_password=$(cat /root/.mysql_secret | head -1 | awk -F': ' '{print $2}')
31 mysqladmin -u root -p"$current_password" password "$MYSQL_PASSWORD"
33 mysql -uroot -p"$MYSQL_PASSWORD" << MYSQL_SCRIPT
34 CREATE DATABASE cinder;
35 CREATE USER 'cinder'@'localhost' IDENTIFIED BY '$MYSQL_PASSWORD';
36 GRANT ALL PRIVILEGES ON *.* TO 'cinder'@'localhost';
38 cinder-manage --config-file $CONF_FILE db sync
42 function test_cinder_service(){
47 service "$service" start
50 echo | ncat -w 5 127.0.0.1 "$port"
56 echo "Cinder $1 successfully started"
58 echo "$service failed to start!"
59 tail -n 40 /var/log/messages
64 function test_cinder_configs(){
65 local files=("/etc/cinder/cinder.conf"
66 "/etc/cinder/api-paste.ini"
67 "/etc/cinder/policy.json")
68 for f in "${files[@]}"
70 [ -f "$f" ] ; update_ec "$?"
77 local imports=("cinder"
78 "cinder.volume.drivers.lvm"
79 "cinder.volume.drivers.rbd")
80 for x in "${imports[@]}"
82 python -c "import $x" ; update_ec "$?"
88 ls /usr/bin/cinder* ; update_ec "$?"
89 test_cinder_service openstack-cinder-api 8776 ; update_ec "$?"
90 [ -f "/usr/bin/cinder-volume" ] ; update_ec "$?"
91 [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?"
95 [ -f "/usr/bin/cinder-manage" ] ; update_ec "$?"
98 [ -f "/usr/bin/cinder-scheduler" ] ; update_ec "$?"
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"