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