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
diff --git a/openstack/openstack-extra-checks.sh b/openstack/openstack-extra-checks.sh
index 5a5627d..a0f6928 100755
--- a/openstack/openstack-extra-checks.sh
+++ b/openstack/openstack-extra-checks.sh
@@ -16,6 +16,7 @@
16# Authors:16# Authors:
17# - edward.hope-morley@canonical.com17# - edward.hope-morley@canonical.com
1818
19MAX_WAIT_ACTIVE=50
19OPENRC=${1:-""}20OPENRC=${1:-""}
2021
21test_octavia_lb ()22test_octavia_lb ()
@@ -65,20 +66,26 @@ test_octavia_lb ()
65 read -p "UUID of guest vm with something listening on port 80 (e.g. apache): " member_vm66 read -p "UUID of guest vm with something listening on port 80 (e.g. apache): " member_vm
66 fi67 fi
6768
68 openstack loadbalancer create --name $lb_name --vip-subnet-id private_subnet69 lb_id=`openstack loadbalancer create --name $lb_name --vip-subnet-id private_subnet -c id -f value`
70 wait_cycle=0
69 while true; do71 while true; do
70 status="`openstack loadbalancer show $lb_name -c provisioning_status -f value`"72 ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
73 status="`openstack loadbalancer show $lb_id -c provisioning_status -f value`"
71 [ "$status" = "ACTIVE" ] && break74 [ "$status" = "ACTIVE" ] && break
72 echo "Waiting for $lb_name to be ACTIVE (current=$status)"75 echo "Waiting for LB $lb_name (uuid=$lb_id) to be ACTIVE (current=$status)"
73 done76 done
74 openstack loadbalancer listener create --name test-listener-${test_tag} --protocol HTTP --protocol-port 80 $lb_name77 openstack loadbalancer listener create --name test-listener-${test_tag} --protocol HTTP --protocol-port 80 $lb_id
78 wait_cycle=0
75 while true; do79 while true; do
80 ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
76 status="`openstack loadbalancer listener show test-listener-${test_tag} -c provisioning_status -f value`"81 status="`openstack loadbalancer listener show test-listener-${test_tag} -c provisioning_status -f value`"
77 [ "$status" = "ACTIVE" ] && break82 [ "$status" = "ACTIVE" ] && break
78 echo "Waiting for test-listener-${test_tag} to be ACTIVE (current=$status)"83 echo "Waiting for Listener test-listener-${test_tag} to be ACTIVE (current=$status)"
79 done84 done
80 openstack loadbalancer pool create --name test-pool-${test_tag} --lb-algorithm ROUND_ROBIN --listener test-listener-${test_tag} --protocol HTTP85 openstack loadbalancer pool create --name test-pool-${test_tag} --lb-algorithm ROUND_ROBIN --listener test-listener-${test_tag} --protocol HTTP
86 wait_cycle=0
81 while true; do87 while true; do
88 ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
82 status="`openstack loadbalancer pool show test-pool-${test_tag} -c provisioning_status -f value`"89 status="`openstack loadbalancer pool show test-pool-${test_tag} -c provisioning_status -f value`"
83 [ "$status" = "ACTIVE" ] && break90 [ "$status" = "ACTIVE" ] && break
84 echo "Waiting for test-pool-${test_tag} to be ACTIVE (current=$status)"91 echo "Waiting for test-pool-${test_tag} to be ACTIVE (current=$status)"
@@ -90,7 +97,9 @@ test_octavia_lb ()
90 -c "Fixed IP Addresses" -f value | sed -r "s/.*ip_address(=|':\s+)'([[:digit:]\.]+)'.*/\2/g")97 -c "Fixed IP Addresses" -f value | sed -r "s/.*ip_address(=|':\s+)'([[:digit:]\.]+)'.*/\2/g")
91 member_id=$(openstack loadbalancer member create --subnet-id $subnet \98 member_id=$(openstack loadbalancer member create --subnet-id $subnet \
92 --address $netaddr --protocol-port 80 --format value --column id test-pool-${test_tag})99 --address $netaddr --protocol-port 80 --format value --column id test-pool-${test_tag})
100 wait_cycle=0
93 while true; do101 while true; do
102 ((wait_cycle++ < MAX_WAIT_ACTIVE)) || { openstack loadbalancer delete --cascade $lb_id; return 1; }
94 status="`openstack loadbalancer member show -f value -c provisioning_status test-pool-${test_tag} $member_id`"103 status="`openstack loadbalancer member show -f value -c provisioning_status test-pool-${test_tag} $member_id`"
95 [ "$status" = ACTIVE ] && break104 [ "$status" = ACTIVE ] && break
96 echo "Waiting for member $member_vm ($member_id) to be ACTIVE (current=$status)"105 echo "Waiting for member $member_vm ($member_id) to be ACTIVE (current=$status)"
@@ -99,12 +108,14 @@ test_octavia_lb ()
99 openstack loadbalancer member list test-pool-${test_tag}108 openstack loadbalancer member list test-pool-${test_tag}
100109
101 fip=`openstack floating ip create -f value -c floating_ip_address $ext_net`110 fip=`openstack floating ip create -f value -c floating_ip_address $ext_net`
102 lb_vip_port_id=$(openstack loadbalancer show -f value -c vip_port_id $lb_name)111 lb_vip_port_id=$(openstack loadbalancer show -f value -c vip_port_id $lb_id)
103 openstack floating ip set --port $lb_vip_port_id $fip112 openstack floating ip set --port $lb_vip_port_id $fip
104 nc -w 5 -vz $fip 80113 nc -w 5 -vz $fip 80
105 rc=$?114 rc=$?
106 fi115 fi
107116
117 openstack loadbalancer delete --cascade $lb_id
118
108 # PASS119 # PASS
109 return $rc120 return $rc
110}121}

Subscribers

People subscribed via source and target branches