Merge ~hopem/ua-reviewkit:openstack-lb-check-cleanup into ua-reviewkit:master

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: ad9a1bcc8bbb807f5d2c9b7808795edcd800bc44
Proposed branch: ~hopem/ua-reviewkit:openstack-lb-check-cleanup
Merge into: ua-reviewkit:master
Diff against target: 70 lines (+17/-6)
1 file modified
openstack/openstack-extra-checks.sh (+17/-6)
Reviewer Review Type Date Requested Status
Hemanth Nakkina (community) Approve
UA Reviewers Pending
Review via email: mp+385266@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Hemanth Nakkina (hemanth-n) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/openstack/openstack-extra-checks.sh b/openstack/openstack-extra-checks.sh
2index 5a5627d..a0f6928 100755
3--- a/openstack/openstack-extra-checks.sh
4+++ b/openstack/openstack-extra-checks.sh
5@@ -16,6 +16,7 @@
6 # Authors:
7 # - edward.hope-morley@canonical.com
8
9+MAX_WAIT_ACTIVE=50
10 OPENRC=${1:-""}
11
12 test_octavia_lb ()
13@@ -65,20 +66,26 @@ test_octavia_lb ()
14 read -p "UUID of guest vm with something listening on port 80 (e.g. apache): " member_vm
15 fi
16
17- openstack loadbalancer create --name $lb_name --vip-subnet-id private_subnet
18+ lb_id=`openstack loadbalancer create --name $lb_name --vip-subnet-id private_subnet -c id -f value`
19+ wait_cycle=0
20 while true; do
21- status="`openstack loadbalancer show $lb_name -c provisioning_status -f value`"
22+ ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
23+ status="`openstack loadbalancer show $lb_id -c provisioning_status -f value`"
24 [ "$status" = "ACTIVE" ] && break
25- echo "Waiting for $lb_name to be ACTIVE (current=$status)"
26+ echo "Waiting for LB $lb_name (uuid=$lb_id) to be ACTIVE (current=$status)"
27 done
28- openstack loadbalancer listener create --name test-listener-${test_tag} --protocol HTTP --protocol-port 80 $lb_name
29+ openstack loadbalancer listener create --name test-listener-${test_tag} --protocol HTTP --protocol-port 80 $lb_id
30+ wait_cycle=0
31 while true; do
32+ ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
33 status="`openstack loadbalancer listener show test-listener-${test_tag} -c provisioning_status -f value`"
34 [ "$status" = "ACTIVE" ] && break
35- echo "Waiting for test-listener-${test_tag} to be ACTIVE (current=$status)"
36+ echo "Waiting for Listener test-listener-${test_tag} to be ACTIVE (current=$status)"
37 done
38 openstack loadbalancer pool create --name test-pool-${test_tag} --lb-algorithm ROUND_ROBIN --listener test-listener-${test_tag} --protocol HTTP
39+ wait_cycle=0
40 while true; do
41+ ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
42 status="`openstack loadbalancer pool show test-pool-${test_tag} -c provisioning_status -f value`"
43 [ "$status" = "ACTIVE" ] && break
44 echo "Waiting for test-pool-${test_tag} to be ACTIVE (current=$status)"
45@@ -90,7 +97,9 @@ test_octavia_lb ()
46 -c "Fixed IP Addresses" -f value | sed -r "s/.*ip_address(=|':\s+)'([[:digit:]\.]+)'.*/\2/g")
47 member_id=$(openstack loadbalancer member create --subnet-id $subnet \
48 --address $netaddr --protocol-port 80 --format value --column id test-pool-${test_tag})
49+ wait_cycle=0
50 while true; do
51+ ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
52 status="`openstack loadbalancer member show -f value -c provisioning_status test-pool-${test_tag} $member_id`"
53 [ "$status" = ACTIVE ] && break
54 echo "Waiting for member $member_vm ($member_id) to be ACTIVE (current=$status)"
55@@ -99,12 +108,14 @@ test_octavia_lb ()
56 openstack loadbalancer member list test-pool-${test_tag}
57
58 fip=`openstack floating ip create -f value -c floating_ip_address $ext_net`
59- lb_vip_port_id=$(openstack loadbalancer show -f value -c vip_port_id $lb_name)
60+ lb_vip_port_id=$(openstack loadbalancer show -f value -c vip_port_id $lb_id)
61 openstack floating ip set --port $lb_vip_port_id $fip
62 nc -w 5 -vz $fip 80
63 rc=$?
64 fi
65
66+ openstack loadbalancer delete --cascade $lb_id
67+
68 # PASS
69 return $rc
70 }

Subscribers

People subscribed via source and target branches