Browse code

Add driver_cert wrapper for cinder

This adds a simple wrapper to call tempest volume tests.
The idea is to make it easy to execute and capture results
from tempest.api.volume.test_*

Concept is for drivers in Cinder to configure cinder.conf as
needed and then run this script which will restart services and
kick off the tempest tests, and capture the output to a logfile
for submission.

To run,
1. deploy devstack as normal with tempest included in enabled_services
2. modify cinder.conf appropriately for your driver
3. execute the script devstack/driver_certs/cinder_driver_cert.sh

Change-Id: I98ec9e1e418a8416406db5e2e6ffd21992e392cf

John Griffith authored on 2013/11/01 09:00:40
Showing 1 changed files
1 1
new file mode 100755
... ...
@@ -0,0 +1,87 @@
0
+#!/usr/bin/env bash
1
+
2
+# **cinder_cert.sh**
3
+
4
+CERT_DIR=$(cd $(dirname "$0") && pwd)
5
+TOP_DIR=$(cd $CERT_DIR/..; pwd)
6
+
7
+source $TOP_DIR/functions
8
+source $TOP_DIR/stackrc
9
+source $TOP_DIR/openrc
10
+source $TOP_DIR/lib/tempest
11
+source $TOP_DIR/lib/cinder
12
+
13
+TEMPFILE=`mktemp`
14
+RECLONE=True
15
+
16
+function log_message() {
17
+    MESSAGE=$1
18
+    STEP_HEADER=$2
19
+    if [[ "$STEP_HEADER" = "True" ]]; then
20
+        echo -e "\n========================================================" | tee -a $TEMPFILE
21
+    fi
22
+    echo -e `date +%m/%d/%y/%T:`"${MESSAGE}" | tee -a $TEMPFILE
23
+    if [[ "$STEP_HEADER" = "True" ]]; then
24
+        echo -e "========================================================" | tee -a $TEMPFILE
25
+    fi
26
+}
27
+
28
+if [[ "$OFFLINE" = "True" ]]; then
29
+    echo "ERROR: Driver cert requires fresh clone/pull from ${CINDER_BRANCH}"
30
+    echo "       Please set OFFLINE=False and retry."
31
+    exit 1
32
+fi
33
+
34
+log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True
35
+log_message "Output is being logged to: $TEMPFILE"
36
+
37
+cd $CINDER_DIR
38
+log_message "Cloning to ${CINDER_REPO}...", True
39
+install_cinder
40
+
41
+log_message "Pull a fresh Clone of cinder repo...", True
42
+git status | tee -a $TEMPFILE
43
+git log --pretty=oneline -n 1 | tee -a $TEMPFILE
44
+
45
+log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True
46
+cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE
47
+sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE
48
+log_message "End of cinder.conf.", True
49
+
50
+cd $TOP_DIR
51
+# Verify tempest is installed/enabled
52
+if ! is_service_enabled tempest; then
53
+    log_message "ERROR!!! Cert requires tempest in enabled_services!", True
54
+    log_message"       Please add tempest to enabled_services and retry."
55
+    exit 1
56
+fi
57
+
58
+cd $TEMPEST_DIR
59
+install_tempest
60
+
61
+log_message "Verify tempest is current....", True
62
+git status | tee -a $TEMPFILE
63
+log_message "Check status and get latest commit..."
64
+git log --pretty=oneline -n 1 | tee -a $TEMPFILE
65
+
66
+
67
+#stop and restart cinder services
68
+log_message "Restart Cinder services...", True
69
+stop_cinder
70
+sleep 1
71
+start_cinder
72
+sleep 5
73
+
74
+# run tempest api/volume/test_*
75
+log_message "Run the actual tempest volume tests (run_tests.sh -N tempest.api.volume.test_*)...", True
76
+exec 2> >(tee -a $TEMPFILE)
77
+`./run_tests.sh -N tempest.api.volume.test_*`
78
+if [[ $? = 0 ]]; then
79
+    log_message "CONGRATULATIONS!!!  Device driver PASSED!", True
80
+    log_message "Submit output: ($TEMPFILE)"
81
+    exit 0
82
+else
83
+    log_message "SORRY!!!  Device driver FAILED!", True
84
+    log_message "Check output in $TEMPFILE"
85
+    exit 1
86
+fi