John Griffith | 4debfe2 | 2013-11-01 00:00:40 +0000 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # **cinder_cert.sh** |
| 4 | |
john-griffith | fe4c4f7 | 2014-01-15 11:24:03 -0700 | [diff] [blame] | 5 | # 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 Troyer | d8864fe | 2014-02-17 11:00:42 -0600 | [diff] [blame] | 19 | # |
john-griffith | fe4c4f7 | 2014-01-15 11:24:03 -0700 | [diff] [blame] | 20 | # SCREEN_LOGDIR=/opt/stack/screen-logs |
| 21 | |
Ryan McNair | 0ebf2df | 2014-03-07 05:31:56 +0000 | [diff] [blame] | 22 | set -o pipefail |
| 23 | |
John Griffith | 4debfe2 | 2013-11-01 00:00:40 +0000 | [diff] [blame] | 24 | CERT_DIR=$(cd $(dirname "$0") && pwd) |
| 25 | TOP_DIR=$(cd $CERT_DIR/..; pwd) |
| 26 | |
| 27 | source $TOP_DIR/functions |
| 28 | source $TOP_DIR/stackrc |
| 29 | source $TOP_DIR/openrc |
Walter A. Boring IV | 75dbd9b | 2014-02-04 14:56:15 -0800 | [diff] [blame] | 30 | source $TOP_DIR/lib/infra |
John Griffith | 4debfe2 | 2013-11-01 00:00:40 +0000 | [diff] [blame] | 31 | source $TOP_DIR/lib/tempest |
| 32 | source $TOP_DIR/lib/cinder |
| 33 | |
| 34 | TEMPFILE=`mktemp` |
| 35 | RECLONE=True |
| 36 | |
Ian Wienand | aee18c7 | 2014-02-21 15:35:08 +1100 | [diff] [blame] | 37 | function log_message { |
John Griffith | 4debfe2 | 2013-11-01 00:00:40 +0000 | [diff] [blame] | 38 | 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 | |
| 49 | if [[ "$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 |
| 53 | fi |
| 54 | |
| 55 | log_message "RUNNING CINDER DRIVER CERTIFICATION CHECK", True |
| 56 | log_message "Output is being logged to: $TEMPFILE" |
| 57 | |
| 58 | cd $CINDER_DIR |
| 59 | log_message "Cloning to ${CINDER_REPO}...", True |
| 60 | install_cinder |
| 61 | |
| 62 | log_message "Pull a fresh Clone of cinder repo...", True |
| 63 | git status | tee -a $TEMPFILE |
| 64 | git log --pretty=oneline -n 1 | tee -a $TEMPFILE |
| 65 | |
| 66 | log_message "Gathering copy of cinder.conf file (passwords will be scrubbed)...", True |
| 67 | cat /etc/cinder/cinder.conf | egrep -v "(^#.*|^$)" | tee -a $TEMPFILE |
| 68 | sed -i "s/\(.*password.*=\).*$/\1 xxx/i" $TEMPFILE |
| 69 | log_message "End of cinder.conf.", True |
| 70 | |
| 71 | cd $TOP_DIR |
| 72 | # Verify tempest is installed/enabled |
| 73 | if ! 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 |
| 77 | fi |
| 78 | |
| 79 | cd $TEMPEST_DIR |
| 80 | install_tempest |
| 81 | |
| 82 | log_message "Verify tempest is current....", True |
| 83 | git status | tee -a $TEMPFILE |
| 84 | log_message "Check status and get latest commit..." |
| 85 | git log --pretty=oneline -n 1 | tee -a $TEMPFILE |
| 86 | |
| 87 | |
| 88 | #stop and restart cinder services |
| 89 | log_message "Restart Cinder services...", True |
| 90 | stop_cinder |
| 91 | sleep 1 |
| 92 | start_cinder |
| 93 | sleep 5 |
| 94 | |
| 95 | # run tempest api/volume/test_* |
John Griffith | d6997d3 | 2014-02-13 22:56:29 +0000 | [diff] [blame] | 96 | log_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 Griffith | 4debfe2 | 2013-11-01 00:00:40 +0000 | [diff] [blame] | 98 | if [[ $? = 0 ]]; then |
| 99 | log_message "CONGRATULATIONS!!! Device driver PASSED!", True |
| 100 | log_message "Submit output: ($TEMPFILE)" |
| 101 | exit 0 |
| 102 | else |
| 103 | log_message "SORRY!!! Device driver FAILED!", True |
| 104 | log_message "Check output in $TEMPFILE" |
| 105 | exit 1 |
| 106 | fi |