Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 3 | # **floating_ips.sh** - using the cloud can be fun |
Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [diff] [blame] | 4 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 5 | # Test instance connectivity with the ``nova`` command from ``python-novaclient`` |
Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [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 | |
Vishvananda Ishaya | 9b35367 | 2011-10-20 10:07:10 -0700 | [diff] [blame] | 11 | # This script exits on an error so that errors don't compound and you see |
Joe Gordon | 4640026 | 2013-06-30 04:32:27 -0700 | [diff] [blame] | 12 | # only the first error that occurred. |
Jesse Andrews | b19424f | 2011-09-14 22:03:04 -0700 | [diff] [blame] | 13 | set -o errexit |
| 14 | |
Vishvananda Ishaya | 9b35367 | 2011-10-20 10:07:10 -0700 | [diff] [blame] | 15 | # Print the commands being run so that we can see the command that triggers |
igor | 01acdab | 2016-07-29 13:11:53 +0200 | [diff] [blame] | 16 | # an error. It is also useful for following as the install occurs. |
Jesse Andrews | b19424f | 2011-09-14 22:03:04 -0700 | [diff] [blame] | 17 | set -o xtrace |
| 18 | |
| 19 | |
| 20 | # Settings |
| 21 | # ======== |
Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [diff] [blame] | 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 | |
| 30 | # Import configuration |
Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 31 | source $TOP_DIR/openrc |
Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [diff] [blame] | 32 | |
Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 33 | # Import project functions |
Sean M. Collins | 2a24251 | 2016-05-03 09:03:09 -0400 | [diff] [blame] | 34 | source $TOP_DIR/lib/neutron |
Dean Troyer | 5a9739a | 2015-03-25 11:33:51 -0500 | [diff] [blame] | 35 | source $TOP_DIR/lib/neutron-legacy |
Dean Troyer | e2907b4 | 2014-02-26 17:35:37 -0600 | [diff] [blame] | 36 | |
Dean Troyer | 51fb454 | 2012-03-09 22:21:59 -0600 | [diff] [blame] | 37 | # Import exercise configuration |
| 38 | source $TOP_DIR/exerciserc |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 39 | |
Kiall Mac Innes | a16c821 | 2014-01-12 19:35:43 +0000 | [diff] [blame] | 40 | # If nova api is not enabled we exit with exitcode 55 so that |
| 41 | # the exercise is skipped |
| 42 | is_service_enabled n-api || exit 55 |
| 43 | |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 44 | # Instance type to create |
| 45 | DEFAULT_INSTANCE_TYPE=${DEFAULT_INSTANCE_TYPE:-m1.tiny} |
| 46 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 47 | # Boot this image, use first AMI image if unset |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 48 | DEFAULT_IMAGE_NAME=${DEFAULT_IMAGE_NAME:-ami} |
| 49 | |
| 50 | # Security group name |
| 51 | SECGROUP=${SECGROUP:-test_secgroup} |
| 52 | |
| 53 | # Default floating IP pool name |
Aaron Rosen | 640f1e4 | 2013-03-26 16:52:53 -0700 | [diff] [blame] | 54 | DEFAULT_FLOATING_POOL=${DEFAULT_FLOATING_POOL:-public} |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 55 | |
| 56 | # Additional floating IP pool and range |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 57 | TEST_FLOATING_POOL=${TEST_FLOATING_POOL:-test} |
| 58 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 59 | # Instance name |
| 60 | VM_NAME="ex-float" |
| 61 | |
Chris Behrens | c62c2b9 | 2013-07-24 03:56:13 -0700 | [diff] [blame] | 62 | # Cells does not support floating ips API calls |
| 63 | is_service_enabled n-cell && exit 55 |
Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 64 | |
Jesse Andrews | 593828d | 2011-09-14 22:44:50 -0700 | [diff] [blame] | 65 | # Launching a server |
| 66 | # ================== |
Jesse Andrews | b19424f | 2011-09-14 22:03:04 -0700 | [diff] [blame] | 67 | |
Jesse Andrews | 593828d | 2011-09-14 22:44:50 -0700 | [diff] [blame] | 68 | # List servers for tenant: |
Jesse Andrews | b019151 | 2011-09-14 19:37:10 -0700 | [diff] [blame] | 69 | nova list |
Jesse Andrews | 593828d | 2011-09-14 22:44:50 -0700 | [diff] [blame] | 70 | |
Jesse Andrews | 593828d | 2011-09-14 22:44:50 -0700 | [diff] [blame] | 71 | # Images |
| 72 | # ------ |
| 73 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 74 | # List the images available |
Steve Martinelli | 5c206c2 | 2014-08-02 20:32:31 -0400 | [diff] [blame] | 75 | openstack image list |
Jesse Andrews | 593828d | 2011-09-14 22:44:50 -0700 | [diff] [blame] | 76 | |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 77 | # Grab the id of the image to launch |
Steve Martinelli | 5c206c2 | 2014-08-02 20:32:31 -0400 | [diff] [blame] | 78 | IMAGE=$(openstack image list | egrep " $DEFAULT_IMAGE_NAME " | get_field 1) |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 79 | die_if_not_set $LINENO IMAGE "Failure getting image $DEFAULT_IMAGE_NAME" |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 80 | |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 81 | # Security Groups |
| 82 | # --------------- |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 83 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 84 | # List security groups |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 85 | nova secgroup-list |
| 86 | |
| 87 | # Create a secgroup |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 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 |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 91 | die $LINENO "Security group not created" |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 92 | fi |
| 93 | fi |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 94 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 95 | # Configure Security Group Rules |
| 96 | if ! nova secgroup-list-rules $SECGROUP | grep -q icmp; then |
| 97 | nova secgroup-add-rule $SECGROUP icmp -1 -1 0.0.0.0/0 |
| 98 | fi |
| 99 | if ! nova secgroup-list-rules $SECGROUP | grep -q " tcp .* 22 "; then |
| 100 | nova secgroup-add-rule $SECGROUP tcp 22 22 0.0.0.0/0 |
Dean Troyer | 1d6e0e1 | 2011-12-23 12:45:13 -0600 | [diff] [blame] | 101 | fi |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 102 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 103 | # List secgroup rules |
| 104 | nova secgroup-list-rules $SECGROUP |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 105 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 106 | # Set up instance |
| 107 | # --------------- |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 108 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 109 | # List flavors |
| 110 | nova flavor-list |
Dean Troyer | ad10176 | 2012-06-27 22:04:40 -0500 | [diff] [blame] | 111 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 112 | # Select a flavor |
| 113 | INSTANCE_TYPE=$(nova flavor-list | grep $DEFAULT_INSTANCE_TYPE | get_field 1) |
| 114 | if [[ -z "$INSTANCE_TYPE" ]]; then |
| 115 | # 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] | 116 | 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] | 117 | die_if_not_set $LINENO INSTANCE_TYPE "Failure retrieving INSTANCE_TYPE" |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 118 | fi |
Jesse Andrews | 6fc7101 | 2011-10-24 11:29:08 -0700 | [diff] [blame] | 119 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 120 | # Clean-up from previous runs |
| 121 | nova delete $VM_NAME || true |
| 122 | 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] | 123 | die $LINENO "server didn't terminate!" |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 124 | exit 1 |
| 125 | fi |
Jesse Andrews | 6fc7101 | 2011-10-24 11:29:08 -0700 | [diff] [blame] | 126 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 127 | # Boot instance |
| 128 | # ------------- |
Jesse Andrews | 6fc7101 | 2011-10-24 11:29:08 -0700 | [diff] [blame] | 129 | |
Dean Troyer | 526b79f | 2013-11-22 11:30:44 -0600 | [diff] [blame] | 130 | 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] | 131 | die_if_not_set $LINENO VM_UUID "Failure launching $VM_NAME" |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 132 | |
| 133 | # Check that the status is active within ACTIVE_TIMEOUT seconds |
Dean Troyer | 751c152 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 134 | 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] | 135 | die $LINENO "server didn't become active!" |
Jesse Andrews | 5a77483 | 2011-10-26 21:30:02 -0700 | [diff] [blame] | 136 | fi |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 137 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 138 | # Get the instance IP |
Nachi Ueno | 6769b16 | 2013-08-12 18:18:56 -0700 | [diff] [blame] | 139 | IP=$(get_instance_ip $VM_UUID $PRIVATE_NETWORK_NAME) |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 140 | die_if_not_set $LINENO IP "Failure retrieving IP address" |
Jesse Andrews | d888e1c | 2011-10-15 20:01:12 -0700 | [diff] [blame] | 141 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 142 | # Private IPs can be pinged in single node deployments |
Sean Dague | af9bf86 | 2015-04-16 08:58:32 -0400 | [diff] [blame] | 143 | ping_check $IP $BOOT_TIMEOUT "$PRIVATE_NETWORK_NAME" |
Jesse Andrews | 6fc7101 | 2011-10-24 11:29:08 -0700 | [diff] [blame] | 144 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 145 | # Floating IPs |
| 146 | # ------------ |
Jesse Andrews | 6fc7101 | 2011-10-24 11:29:08 -0700 | [diff] [blame] | 147 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 148 | # Allocate a floating IP from the default pool |
| 149 | FLOATING_IP=$(nova floating-ip-create | grep $DEFAULT_FLOATING_POOL | get_field 1) |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 150 | die_if_not_set $LINENO FLOATING_IP "Failure creating floating IP from pool $DEFAULT_FLOATING_POOL" |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 151 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 152 | # List floating addresses |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 153 | if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep -q $FLOATING_IP; do sleep 1; done"; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 154 | die $LINENO "Floating IP not allocated" |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 155 | fi |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 156 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 157 | # Add floating IP to our server |
Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 158 | nova add-floating-ip $VM_UUID $FLOATING_IP || \ |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 159 | die $LINENO "Failure adding floating IP $FLOATING_IP to $VM_NAME" |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 160 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 161 | # Test we can ping our floating IP within ASSOCIATE_TIMEOUT seconds |
Sean Dague | af9bf86 | 2015-04-16 08:58:32 -0400 | [diff] [blame] | 162 | ping_check $FLOATING_IP $ASSOCIATE_TIMEOUT "$PUBLIC_NETWORK_NAME" |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 163 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 164 | if ! is_service_enabled neutron; then |
Nachi Ueno | 5db5bfa | 2012-10-29 11:25:29 -0700 | [diff] [blame] | 165 | # Allocate an IP from second floating pool |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 166 | TEST_FLOATING_IP=$(nova floating-ip-create $TEST_FLOATING_POOL | grep $TEST_FLOATING_POOL | get_field 1) |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 167 | die_if_not_set $LINENO TEST_FLOATING_IP "Failure creating floating IP in $TEST_FLOATING_POOL" |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 168 | |
Nachi Ueno | 5db5bfa | 2012-10-29 11:25:29 -0700 | [diff] [blame] | 169 | # list floating addresses |
| 170 | if ! timeout $ASSOCIATE_TIMEOUT sh -c "while ! nova floating-ip-list | grep $TEST_FLOATING_POOL | grep -q $TEST_FLOATING_IP; do sleep 1; done"; then |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 171 | die $LINENO "Floating IP not allocated" |
Sean Dague | 922c8ae | 2013-10-22 10:06:06 -0400 | [diff] [blame] | 172 | fi |
Dean Troyer | 696ad33 | 2012-01-10 15:34:34 -0600 | [diff] [blame] | 173 | fi |
| 174 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 175 | # Dis-allow icmp traffic (ping) |
| 176 | nova secgroup-delete-rule $SECGROUP icmp -1 -1 0.0.0.0/0 || \ |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 177 | die $LINENO "Failure deleting security group rule from $SECGROUP" |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 178 | |
Brian Haley | 9b3602c | 2014-02-28 13:52:29 -0500 | [diff] [blame] | 179 | if ! timeout $ASSOCIATE_TIMEOUT sh -c "while nova secgroup-list-rules $SECGROUP | grep -q icmp; do sleep 1; done"; then |
| 180 | die $LINENO "Security group rule not deleted from $SECGROUP" |
| 181 | fi |
| 182 | |
Anthony Young | 1de18c6 | 2011-11-01 14:19:18 -0500 | [diff] [blame] | 183 | # FIXME (anthony): make xs support security groups |
Adam Gandelman | b875d01 | 2014-03-17 19:47:14 -0700 | [diff] [blame] | 184 | if [ "$VIRT_DRIVER" != "ironic" -a "$VIRT_DRIVER" != "xenserver" -a "$VIRT_DRIVER" != "openvz" ]; then |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 185 | # Test we can aren't able to ping our floating ip within ASSOCIATE_TIMEOUT seconds |
Sean Dague | af9bf86 | 2015-04-16 08:58:32 -0400 | [diff] [blame] | 186 | ping_check $FLOATING_IP $ASSOCIATE_TIMEOUT "$PUBLIC_NETWORK_NAME" Fail |
Anthony Young | 20a2cae | 2011-10-17 16:02:24 -0700 | [diff] [blame] | 187 | fi |
| 188 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 189 | # Clean up |
| 190 | # -------- |
| 191 | |
Mark McClain | b05c876 | 2013-07-06 23:29:39 -0400 | [diff] [blame] | 192 | if ! is_service_enabled neutron; then |
Nachi Ueno | 5db5bfa | 2012-10-29 11:25:29 -0700 | [diff] [blame] | 193 | # Delete second floating IP |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 194 | nova floating-ip-delete $TEST_FLOATING_IP || \ |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 195 | die $LINENO "Failure deleting floating IP $TEST_FLOATING_IP" |
Nachi Ueno | 5db5bfa | 2012-10-29 11:25:29 -0700 | [diff] [blame] | 196 | fi |
Nachi Ueno | fda946e | 2012-10-24 17:26:02 -0700 | [diff] [blame] | 197 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 198 | # Delete the floating ip |
| 199 | nova floating-ip-delete $FLOATING_IP || \ |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 200 | die $LINENO "Failure deleting floating IP $FLOATING_IP" |
Nachi Ueno | fda946e | 2012-10-24 17:26:02 -0700 | [diff] [blame] | 201 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 202 | # Delete instance |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 203 | nova delete $VM_UUID || die $LINENO "Failure deleting instance $VM_NAME" |
Dean Troyer | 96288ba | 2012-08-17 14:11:55 -0500 | [diff] [blame] | 204 | # Wait for termination |
| 205 | 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] | 206 | die $LINENO "Server $VM_NAME not deleted" |
Russell Bryant | 5836b15 | 2012-02-24 10:23:33 -0500 | [diff] [blame] | 207 | fi |
| 208 | |
Dean Troyer | da85cda | 2013-02-15 11:07:14 -0600 | [diff] [blame] | 209 | # Delete secgroup |
| 210 | nova secgroup-delete $SECGROUP || \ |
Nachi Ueno | 07115eb | 2013-02-26 12:38:18 -0800 | [diff] [blame] | 211 | die $LINENO "Failure deleting security group $SECGROUP" |
Dean Troyer | 489bd2a | 2012-03-02 10:44:29 -0600 | [diff] [blame] | 212 | |
| 213 | set +o xtrace |
Dean Troyer | 27e3269 | 2012-03-16 16:16:56 -0500 | [diff] [blame] | 214 | echo "*********************************************************************" |
| 215 | echo "SUCCESS: End DevStack Exercise: $0" |
| 216 | echo "*********************************************************************" |