blob: d2c636f89dc632238298be0e8d78f04524595809 [file] [log] [blame]
John Griffith4debfe22013-11-01 00:00:40 +00001#!/usr/bin/env bash
2
3# **cinder_cert.sh**
4
john-griffithfe4c4f72014-01-15 11:24:03 -07005# This script is a simple wrapper around the tempest volume api tests
6# It requires that you have a working and functional devstack install
7# and that you've enabled your device driver by making the necessary
8# modifications to /etc/cinder/cinder.conf
9
10# This script will refresh your openstack repo's and restart the cinder
11# services to pick up your driver changes.
12# please NOTE; this script assumes your devstack install is functional
13# and includes tempest. A good first step is to make sure you can
14# create volumes on your device before you even try and run this script.
15
16# It also assumes default install location (/opt/stack/xxx)
17# to aid in debug, you should also verify that you've added
18# an output directory for screen logs:
Dean Troyerd8864fe2014-02-17 11:00:42 -060019#
john-griffithfe4c4f72014-01-15 11:24:03 -070020# SCREEN_LOGDIR=/opt/stack/screen-logs
21
John Griffith4debfe22013-11-01 00:00:40 +000022CERT_DIR=$(cd $(dirname "$0") && pwd)
23TOP_DIR=$(cd $CERT_DIR/..; pwd)
24
25source $TOP_DIR/functions
26source $TOP_DIR/stackrc
27source $TOP_DIR/openrc
Walter A. Boring IV75dbd9b2014-02-04 14:56:15 -080028source $TOP_DIR/lib/infra
John Griffith4debfe22013-11-01 00:00:40 +000029source $TOP_DIR/lib/tempest
30source $TOP_DIR/lib/cinder
31
32TEMPFILE=`mktemp`
33RECLONE=True
34
Ian Wienandaee18c72014-02-21 15:35:08 +110035function log_message {
John Griffith4debfe22013-11-01 00:00:40 +000036 MESSAGE=$1
37 STEP_HEADER=$2
38 if [[ "$STEP_HEADER" = "True" ]]; then
39 echo -e "\n========================================================" | tee -a $TEMPFILE
40 fi
41 echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
42 if [[ "$STEP_HEADER" = "True" ]]; then
43 echo -e "========================================================" | tee -a $TEMPFILE
44 fi
45}
46
47if [[ "$OFFLINE" = "True" ]]; then
48 echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
49 echo " Please set OFFLINE=False and retry."
50 exit 1
51fi
52
53log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
54log_message "Output is being logged to: $TEMPFILE"
55
56cd $CINDER_DIR
57log_message "Cloning to ${CINDER_REPO}...", True
58install_cinder
59
60log_message "Pull a fresh Clone of cinder repo...", True
61git status | tee -a $TEMPFILE
62git log --pretty=oneline -n 1 | tee -a $TEMPFILE
63
64log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
65cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
66sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
67log_message "End of cinder.conf.", True
68
69cd $TOP_DIR
70# Verify tempest is installed/enabled
71if ! is_service_enabled tempest; then
72 log_message "ERROR!!! Cert requires tempest in enabled_services!", True
73 log_message" Please add tempest to enabled_services and retry."
74 exit 1
75fi
76
77cd $TEMPEST_DIR
78install_tempest
79
80log_message "Verify tempest is current....", True
81git status | tee -a $TEMPFILE
82log_message "Check status and get latest commit..."
83git log --pretty=oneline -n 1 | tee -a $TEMPFILE
84
85
86#stop and restart cinder services
87log_message "Restart Cinder services...", True
88stop_cinder
89sleep 1
90start_cinder
91sleep 5
92
93# run tempest api/volume/test_*
John Griffithd6997d32014-02-13 22:56:29 +000094log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh api.volume)...", True
95./tools/pretty_tox.sh api.volume 2>&1 | tee -a $TEMPFILE
John Griffith4debfe22013-11-01 00:00:40 +000096if [[ $? = 0 ]]; then
97 log_message "CONGRATULATIONS!!! Device driver PASSED!", True
98 log_message "Submit output: ($TEMPFILE)"
99 exit 0
100else
101 log_message "SORRY!!! Device driver FAILED!", True
102 log_message "Check output in $TEMPFILE"
103 exit 1
104fi