blob: 0221e3779c06491db30ecba7df403dec86f6c416 [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
Walter A. Boring IV75dbd9b2014-02-04 14:56:15 -080027source $TOP_DIR/lib/infra
John Griffith4debfe22013-11-01 00:00:40 +000028source $TOP_DIR/lib/tempest
29source $TOP_DIR/lib/cinder
30
31TEMPFILE=`mktemp`
32RECLONE=True
33
34function log_message() {
35 MESSAGE=$1
36 STEP_HEADER=$2
37 if [[ "$STEP_HEADER" = "True" ]]; then
38 echo -e "\n========================================================" | tee -a $TEMPFILE
39 fi
40 echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
41 if [[ "$STEP_HEADER" = "True" ]]; then
42 echo -e "========================================================" | tee -a $TEMPFILE
43 fi
44}
45
46if [[ "$OFFLINE" = "True" ]]; then
47 echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
48 echo " Please set OFFLINE=False and retry."
49 exit 1
50fi
51
52log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
53log_message "Output is being logged to: $TEMPFILE"
54
55cd $CINDER_DIR
56log_message "Cloning to ${CINDER_REPO}...", True
57install_cinder
58
59log_message "Pull a fresh Clone of cinder repo...", True
60git status | tee -a $TEMPFILE
61git log --pretty=oneline -n 1 | tee -a $TEMPFILE
62
63log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
64cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
65sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
66log_message "End of cinder.conf.", True
67
68cd $TOP_DIR
69# Verify tempest is installed/enabled
70if ! is_service_enabled tempest; then
71 log_message "ERROR!!! Cert requires tempest in enabled_services!", True
72 log_message" Please add tempest to enabled_services and retry."
73 exit 1
74fi
75
76cd $TEMPEST_DIR
77install_tempest
78
79log_message "Verify tempest is current....", True
80git status | tee -a $TEMPFILE
81log_message "Check status and get latest commit..."
82git log --pretty=oneline -n 1 | tee -a $TEMPFILE
83
84
85#stop and restart cinder services
86log_message "Restart Cinder services...", True
87stop_cinder
88sleep 1
89start_cinder
90sleep 5
91
92# run tempest api/volume/test_*
john-griffithfe4c4f72014-01-15 11:24:03 -070093log_message "Run the actual tempest volume tests (./tools/pretty_tox.sh api.volume_*)...", True
John Griffith4debfe22013-11-01 00:00:40 +000094exec 2> >(tee -a $TEMPFILE)
john-griffithfe4c4f72014-01-15 11:24:03 -070095`./tools/pretty_tox.sh api.volume`
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