| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 1 | #!/usr/bin/env bash | 
|  | 2 |  | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 3 | # **volumes.sh** | 
|  | 4 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 5 | # Test cinder volumes with the ``cinder`` command from ``python-cinderclient`` | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 6 |  | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 7 | echo "*********************************************************************" | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 8 | echo "Begin DevStack Exercise: $0" | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 9 | echo "*********************************************************************" | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 10 |  | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 11 | # This script exits on an error so that errors don't compound and you see | 
| Joe Gordon | 6fd2811 | 2012-11-13 16:55:41 -0800 | [diff] [blame] | 12 | # only the first error that occurred. | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 13 | set -o errexit | 
|  | 14 |  | 
|  | 15 | # Print the commands being run so that we can see the command that triggers | 
|  | 16 | # an error.  It is also useful for following allowing as the install occurs. | 
|  | 17 | set -o xtrace | 
|  | 18 |  | 
|  | 19 |  | 
|  | 20 | # Settings | 
|  | 21 | # ======== | 
|  | 22 |  | 
| Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 23 | # Keep track of the current directory | 
|  | 24 | EXERCISE_DIR=$(cd $(dirname "$0") && pwd) | 
|  | 25 | TOP_DIR=$(cd $EXERCISE_DIR/..; pwd) | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 26 |  | 
|  | 27 | # Import common functions | 
| Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 28 | source $TOP_DIR/functions | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 29 |  | 
| Dean Troyer | e4fa721 | 2014-01-15 15:04:49 -0600 | [diff] [blame] | 30 | # Import project functions | 
|  | 31 | source $TOP_DIR/lib/cinder | 
|  | 32 |  | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 33 | # Import configuration | 
| Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 34 | source $TOP_DIR/openrc | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 35 |  | 
| Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 36 | # Import exercise configuration | 
|  | 37 | source $TOP_DIR/exerciserc | 
| Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 38 |  | 
| Joe Gordon | 6fd2811 | 2012-11-13 16:55:41 -0800 | [diff] [blame] | 39 | # If cinder is not enabled we exit with exitcode 55 which mean | 
| Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 40 | # exercise is skipped. | 
| Joe Gordon | 6fd2811 | 2012-11-13 16:55:41 -0800 | [diff] [blame] | 41 | is_service_enabled cinder || exit 55 | 
| Dean Troyer | 67787e6 | 2012-05-02 11:48:15 -0500 | [diff] [blame] | 42 |  | 
| Dean Troyer | 2aa2a89 | 2013-08-04 19:53:19 -0500 | [diff] [blame] | 43 | # Also skip if the hypervisor is Docker | 
|  | 44 | [[ "$VIRT_DRIVER" == "docker" ]] && exit 55 | 
|  | 45 |  | 
| Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 46 | # Instance type to create | 
|  | 47 | DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} | 
|  | 48 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 49 | # Boot this image, use first AMI image if unset | 
| Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 50 | DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami} | 
|  | 51 |  | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 52 | # Security group name | 
|  | 53 | SECGROUP=${SECGROUP:-vol_secgroup} | 
|  | 54 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 55 | # Instance and volume names | 
|  | 56 | VM_NAME=${VM_NAME:-ex-vol-inst} | 
|  | 57 | VOL_NAME="ex-vol-$(openssl rand -hex 4)" | 
|  | 58 |  | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 59 |  | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 60 | # Launching a server | 
|  | 61 | # ================== | 
|  | 62 |  | 
|  | 63 | # List servers for tenant: | 
|  | 64 | nova list | 
|  | 65 |  | 
|  | 66 | # Images | 
|  | 67 | # ------ | 
|  | 68 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 69 | # List the images available | 
| Dean Troyer | 4549525 | 2012-04-13 13:16:38 -0500 | [diff] [blame] | 70 | glance image-list | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 71 |  | 
| Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 72 | # Grab the id of the image to launch | 
| Dean Troyer | 4549525 | 2012-04-13 13:16:38 -0500 | [diff] [blame] | 73 | IMAGE=$(glance image-list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 74 | die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 75 |  | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 76 | # Security Groups | 
|  | 77 | # --------------- | 
|  | 78 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 79 | # List security groups | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 80 | nova secgroup-list | 
|  | 81 |  | 
| Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 82 | if is_service_enabled n-cell; then | 
|  | 83 | # Cells does not support security groups, so force the use of "default" | 
|  | 84 | SECGROUP="default" | 
|  | 85 | echo "Using the default security group because of Cells." | 
|  | 86 | else | 
|  | 87 | # Create a secgroup | 
|  | 88 | if ! nova secgroup-list | grep -q $SECGROUP; then | 
|  | 89 | nova secgroup-create $SECGROUP "$SECGROUP description" | 
|  | 90 | if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova secgroup-list | grep -q $SECGROUP; do sleep 1; done"; then | 
|  | 91 | echo "Security group not created" | 
|  | 92 | exit 1 | 
|  | 93 | fi | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 94 | fi | 
|  | 95 | fi | 
|  | 96 |  | 
|  | 97 | # Configure Security Group Rules | 
| Dean Troyer | 15bda3e | 2013-01-11 15:07:53 -0600 | [diff] [blame] | 98 | if ! nova secgroup-list-rules $SECGROUP | grep -q icmp; then | 
|  | 99 | nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0 | 
|  | 100 | fi | 
|  | 101 | if ! nova secgroup-list-rules $SECGROUP | grep -q " tcp .* 22 "; then | 
|  | 102 | nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0 | 
|  | 103 | fi | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 104 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 105 | # List secgroup rules | 
|  | 106 | nova secgroup-list-rules $SECGROUP | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 107 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 108 | # Set up instance | 
|  | 109 | # --------------- | 
|  | 110 |  | 
|  | 111 | # List flavors | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 112 | nova flavor-list | 
|  | 113 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 114 | # Select a flavor | 
|  | 115 | INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) | 
| Dean Troyer | 1d6e0e1 | 2011-12-23 12:45:13 -0600 | [diff] [blame] | 116 | if [[ -z "$INSTANCE_TYPE" ]]; then | 
|  | 117 | # grab the first flavor in the list to launch if default doesn't exist | 
| Sean Dague | 922c8ae | 2013-10-22 10:06:06 -0400 | [diff] [blame] | 118 | INSTANCE_TYPE=$(nova flavor-list | head -n 4 | tail -n 1 | get_field 1) | 
| DennyZhang | 23178a9 | 2013-10-22 17:07:32 -0500 | [diff] [blame] | 119 | die_if_not_set $LINENO INSTANCE_TYPE "Failure retrieving INSTANCE_TYPE" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 120 | fi | 
|  | 121 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 122 | # Clean-up from previous runs | 
|  | 123 | nova delete $VM_NAME || true | 
|  | 124 | if ! timeout $ACTIVE_TIMEOUT sh -c "while nova show $VM_NAME; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 125 | die $LINENO "server didn't terminate!" | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 126 | fi | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 127 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 128 | # Boot instance | 
|  | 129 | # ------------- | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 130 |  | 
| Dean Troyer | 526b79f | 2013-11-22 11:30:44 -0600 | [diff] [blame] | 131 | VM_UUID=$(nova boot --flavor $INSTANCE_TYPE --image $IMAGE --security-groups=$SECGROUP $VM_NAME | grep ' id ' | get_field 2) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 132 | die_if_not_set $LINENO VM_UUID "Failure launching $VM_NAME" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 133 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 134 | # Check that the status is active within ACTIVE_TIMEOUT seconds | 
| Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 135 | if ! timeout $ACTIVE_TIMEOUT sh -c "while ! nova show $VM_UUID | grep status | grep -q ACTIVE; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 136 | die $LINENO "server didn't become active!" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 137 | fi | 
|  | 138 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 139 | # Get the instance IP | 
| Nachi Ueno | 6769b16 | 2013-08-12 18:18:56 -0700 | [diff] [blame] | 140 | IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME) | 
|  | 141 |  | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 142 | die_if_not_set $LINENO IP "Failure retrieving IP address" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 143 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 144 | # Private IPs can be pinged in single node deployments | 
| Nachi Ueno | fda946e | 2012-10-24 17:26:02 -0700 | [diff] [blame] | 145 | ping_check "$PRIVATE_NETWORK_NAME" $IP $BOOT_TIMEOUT | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 146 |  | 
|  | 147 | # Volumes | 
|  | 148 | # ------- | 
|  | 149 |  | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 150 | # Verify it doesn't exist | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 151 | if [[ -n $(cinder list | grep $VOL_NAME | head -1 | get_field 2) ]]; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 152 | die $LINENO "Volume $VOL_NAME already exists" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 153 | fi | 
|  | 154 |  | 
|  | 155 | # Create a new volume | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 156 | start_time=$(date +%s) | 
| Dean Troyer | 526b79f | 2013-11-22 11:30:44 -0600 | [diff] [blame] | 157 | cinder create --display-name $VOL_NAME --display-description "test volume: $VOL_NAME" $DEFAULT_VOLUME_SIZE || \ | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 158 | die $LINENO "Failure creating volume $VOL_NAME" | 
| John Griffith | 161e280 | 2012-11-05 13:59:49 -0700 | [diff] [blame] | 159 | if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 160 | die $LINENO "Volume $VOL_NAME not created" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 161 | fi | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 162 | end_time=$(date +%s) | 
| John Griffith | 161e280 | 2012-11-05 13:59:49 -0700 | [diff] [blame] | 163 | echo "Completed cinder create in $((end_time - start_time)) seconds" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 164 |  | 
|  | 165 | # Get volume ID | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 166 | VOL_ID=$(cinder list | grep $VOL_NAME | head -1 | get_field 1) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 167 | die_if_not_set $LINENO VOL_ID "Failure retrieving volume ID for $VOL_NAME" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 168 |  | 
|  | 169 | # Attach to server | 
|  | 170 | DEVICE=/dev/vdb | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 171 | start_time=$(date +%s) | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 172 | nova volume-attach $VM_UUID $VOL_ID $DEVICE || \ | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 173 | die $LINENO "Failure attaching volume $VOL_NAME to $VM_NAME" | 
| John Griffith | 161e280 | 2012-11-05 13:59:49 -0700 | [diff] [blame] | 174 | if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep in-use; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 175 | die $LINENO "Volume $VOL_NAME not attached to $VM_NAME" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 176 | fi | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 177 | end_time=$(date +%s) | 
| John Griffith | 496ffc7 | 2012-09-26 15:09:52 -0600 | [diff] [blame] | 178 | echo "Completed volume-attach in $((end_time - start_time)) seconds" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 179 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 180 | VOL_ATTACH=$(cinder list | grep $VOL_NAME | head -1 | get_field -1) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 181 | die_if_not_set $LINENO VOL_ATTACH "Failure retrieving $VOL_NAME status" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 182 | if [[ "$VOL_ATTACH" != $VM_UUID ]]; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 183 | die $LINENO "Volume not attached to correct instance" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 184 | fi | 
|  | 185 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 186 | # Clean up | 
|  | 187 | # -------- | 
|  | 188 |  | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 189 | # Detach volume | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 190 | start_time=$(date +%s) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 191 | nova volume-detach $VM_UUID $VOL_ID || die $LINENO "Failure detaching volume $VOL_NAME from $VM_NAME" | 
| John Griffith | 161e280 | 2012-11-05 13:59:49 -0700 | [diff] [blame] | 192 | if ! timeout $ACTIVE_TIMEOUT sh -c "while ! cinder list | grep $VOL_NAME | grep available; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 193 | die $LINENO "Volume $VOL_NAME not detached from $VM_NAME" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 194 | fi | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 195 | end_time=$(date +%s) | 
| John Griffith | 496ffc7 | 2012-09-26 15:09:52 -0600 | [diff] [blame] | 196 | echo "Completed volume-detach in $((end_time - start_time)) seconds" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 197 |  | 
|  | 198 | # Delete volume | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 199 | start_time=$(date +%s) | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 200 | cinder delete $VOL_ID || die $LINENO "Failure deleting volume $VOL_NAME" | 
| Adam Gandelman | 756c842 | 2013-01-04 13:37:22 -0800 | [diff] [blame] | 201 | if ! timeout $ACTIVE_TIMEOUT sh -c "while cinder list | grep $VOL_NAME; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 202 | die $LINENO "Volume $VOL_NAME not deleted" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 203 | fi | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 204 | end_time=$(date +%s) | 
| John Griffith | 161e280 | 2012-11-05 13:59:49 -0700 | [diff] [blame] | 205 | echo "Completed cinder delete in $((end_time - start_time)) seconds" | 
| Dean Troyer | a8dda17 | 2011-12-16 12:22:02 -0600 | [diff] [blame] | 206 |  | 
| Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 207 | # Delete instance | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 208 | nova delete $VM_UUID || die $LINENO "Failure deleting instance $VM_NAME" | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 209 | if ! timeout $TERMINATE_TIMEOUT sh -c "while nova list | grep -q $VM_UUID; do sleep 1; done"; then | 
| Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 210 | die $LINENO "Server $VM_NAME not deleted" | 
| Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 211 | fi | 
|  | 212 |  | 
| Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 213 | if [[ $SECGROUP = "default" ]] ; then | 
|  | 214 | echo "Skipping deleting default security group" | 
|  | 215 | else | 
|  | 216 | # Delete secgroup | 
|  | 217 | nova secgroup-delete $SECGROUP || die $LINENO "Failure deleting security group $SECGROUP" | 
|  | 218 | fi | 
| Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 219 |  | 
|  | 220 | set +o xtrace | 
| Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 221 | echo "*********************************************************************" | 
|  | 222 | echo "SUCCESS: End DevStack Exercise: $0" | 
|  | 223 | echo "*********************************************************************" |