blob: 7726e7eb012bd2b26109aee81ab5ef6992fd3aef [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
Ryan McNair0ebf2df2014-03-07 05:31:56 +000022set -o pipefail
23
John Griffith4debfe22013-11-01 00:00:40 +000024CERT_DIR=$(cd $(dirname "$0") && pwd)
25TOP_DIR=$(cd $CERT_DIR/..; pwd)
26
27source $TOP_DIR/functions
28source $TOP_DIR/stackrc
29source $TOP_DIR/openrc
Walter A. Boring IV75dbd9b2014-02-04 14:56:15 -080030source $TOP_DIR/lib/infra
John Griffith4debfe22013-11-01 00:00:40 +000031source $TOP_DIR/lib/tempest
32source $TOP_DIR/lib/cinder
33
34TEMPFILE=`mktemp`
35RECLONE=True
36
Ian Wienandaee18c72014-02-21 15:35:08 +110037function log_message {
John Griffith4debfe22013-11-01 00:00:40 +000038 MESSAGE=$1
39 STEP_HEADER=$2
40 if [[ "$STEP_HEADER" = "True" ]]; then
41 echo -e "\n========================================================" | tee -a $TEMPFILE
42 fi
43 echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
44 if [[ "$STEP_HEADER" = "True" ]]; then
45 echo -e "========================================================" | tee -a $TEMPFILE
46 fi
47}
48
49if [[ "$OFFLINE" = "True" ]]; then
50 echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
51 echo " Please set OFFLINE=False and retry."
52 exit 1
53fi
54
55log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
56log_message "Output is being logged to: $TEMPFILE"
57
58cd $CINDER_DIR
59log_message "Cloning to ${CINDER_REPO}...", True
60install_cinder
61
62log_message "Pull a fresh Clone of cinder repo...", True
63git status | tee -a $TEMPFILE
64git log --pretty=oneline -n 1 | tee -a $TEMPFILE
65
66log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
67cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
68sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
69log_message "End of cinder.conf.", True
70
71cd $TOP_DIR
72# Verify tempest is installed/enabled
73if ! is_service_enabled tempest; then
74 log_message "ERROR!!! Cert requires tempest in enabled_services!", True
75 log_message" Please add tempest to enabled_services and retry."
76 exit 1
77fi
78
79cd $TEMPEST_DIR
80install_tempest
81
82log_message "Verify tempest is current....", True
83git status | tee -a $TEMPFILE
84log_message "Check status and get latest commit..."
85git log --pretty=oneline -n 1 | tee -a $TEMPFILE
86
87
88#stop and restart cinder services
89log_message "Restart Cinder services...", True
90stop_cinder
91sleep 1
92start_cinder
93sleep 5
94
95# run tempest api/volume/test_*
John Griffithd6997d32014-02-13 22:56:29 +000096log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh api.volume)...", True
97./tools/pretty_tox.sh api.volume 2>&1 | tee -a $TEMPFILE
John Griffith4debfe22013-11-01 00:00:40 +000098if [[ $? = 0 ]]; then
99 log_message "CONGRATULATIONS!!! Device driver PASSED!", True
100 log_message "Submit output: ($TEMPFILE)"
101 exit 0
102else
103 log_message "SORRY!!! Device driver FAILED!", True
104 log_message "Check output in $TEMPFILE"
105 exit 1
106fi