Merge lp:~1chb1n/openstack-charm-testing/update-tools-profiles into lp:openstack-charm-testing

Proposed by Ryan Beisner
Status: Merged
Merged at revision: 295
Proposed branch: lp:~1chb1n/openstack-charm-testing/update-tools-profiles
Merge into: lp:openstack-charm-testing
Diff against target: 286 lines (+78/-85)
10 files modified
novarc (+5/-1)
profiles/arm64 (+8/-16)
tools/flavor_shrink.sh (+2/-2)
tools/flavor_shrink_less.sh (+5/-5)
tools/float_all.sh (+12/-12)
tools/instance_delete_all.sh (+11/-0)
tools/instance_launch.sh (+25/-29)
tools/instance_ssh_ping_all.sh (+5/-10)
tools/instance_start_all.sh (+2/-5)
tools/instance_stop_all.sh (+3/-5)
To merge this branch: bzr merge lp:~1chb1n/openstack-charm-testing/update-tools-profiles
Reviewer Review Type Date Requested Status
OpenStack Charm Testing Maintainers Pending
Review via email: mp+320806@code.launchpad.net

Description of the change

Update tools to use openstackclient; update arm64 config profile

To post a comment you must log in.
292. By Ryan Beisner

Update instance stop, start, delete scripts

293. By Ryan Beisner

Update instance stop, start scripts

294. By Ryan Beisner

Update instance ssh connect check script

295. By Ryan Beisner

Rebase trunk

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'novarc'
2--- novarc 2016-05-20 10:26:04 +0000
3+++ novarc 2017-03-27 20:54:03 +0000
4@@ -1,4 +1,8 @@
5-#!/bin/bash
6+_OS_PARAMS=$(env | awk 'BEGIN {FS="="} /^OS_/ {print $1;}' | paste -sd ' ')
7+for param in $_OS_PARAMS; do
8+ unset $param
9+done
10+unset _OS_PARAMS
11 export OS_USERNAME=admin
12 export OS_PASSWORD=openstack
13 export OS_TENANT_NAME=admin
14
15=== modified file 'profiles/arm64'
16--- profiles/arm64 2017-02-07 20:32:21 +0000
17+++ profiles/arm64 2017-03-27 20:54:03 +0000
18@@ -2,12 +2,7 @@
19 # An experimental configuration script for configuring a ppc64el OpenStack test cloud.
20 # Useful in manual deployment testing.
21
22-# Install CLI tools
23-#sudo apt-get install git testrepository subunit python-nose python-lxml python-boto \
24-# python-junitxml python-subunit python-testresources python-oslotest python-stevedore \
25-# python-cinderclient python-glanceclient python-heatclient python-keystoneclient \
26-# python-neutronclient python-novaclient python-swiftclient python-ceilometerclient \
27-# openvswitch-test openvswitch-common python-openstackclient -y
28+. ./profiles/common
29
30 [[ -z "$GATEWAY" ]] && export GATEWAY="10.245.168.1"
31 [[ -z "$CIDR_EXT" ]] && export CIDR_EXT="10.245.168.0/21"
32@@ -15,21 +10,19 @@
33 [[ -z "$NAMESERVER" ]] && export NAMESERVER="10.245.168.6"
34 [[ -z "$CIDR_PRIV" ]] && export CIDR_PRIV="172.16.0.0/22"
35
36+export BARE_METAL="True"
37+
38 # Accept network type as first parameter, assume gre if unspecified
39 net_type=${1:-"gre"}
40
41 # Configure neutron networking on overcloud
42 source novarc
43-./bin/quantum-ext-net --network-type $net_type -g $GATEWAY -c $CIDR_EXT -f $FIP_RANGE ext_net
44-./bin/quantum-tenant-net --network-type $net_type -t admin -r provider-router -N $NAMESERVER private $CIDR_PRIV
45+./bin/neutron-ext-net --network-type flat -g $GATEWAY -c $CIDR_EXT -f $FIP_RANGE ext_net
46+./bin/neutron-tenant-net --network-type $net_type -t admin -r provider-router -N $NAMESERVER private $CIDR_PRIV
47
48-# Create demo user and tenant
49-keystone tenant-create --name demo || :
50-keystone user-create --name demo --tenant demo --pass pass --enabled true --email demo@dev.null || :
51-keystone user-role-add --user demo --role Member --tenant demo || :
52-keystone tenant-create --name alt_demo || :
53-keystone user-create --name alt_demo --tenant alt_demo --pass secret --enabled true --email alt_demo@dev.null || :
54-keystone user-role-add --user alt_demo --role Member --tenant alt_demo || :
55+create_tempest_users
56+create_tempest_flavors
57+create_default_flavors
58
59 # Install monitoring, probing and troubleshooting tools on all units
60 juju run --all "sudo apt-get install htop atop nload iptraf nmap multitail iperf pastebinit stress sysstat -y"
61@@ -43,4 +36,3 @@
62 # Tune for higher-density testing
63 tools/flavor_shrink.sh
64 tools/quota_million.sh
65-
66
67=== modified file 'tools/flavor_shrink.sh'
68--- tools/flavor_shrink.sh 2015-02-20 18:31:41 +0000
69+++ tools/flavor_shrink.sh 2017-03-27 20:54:03 +0000
70@@ -2,7 +2,7 @@
71 # Shrink flavors for density testing
72
73 echo " + Shrinking flavors."
74-nova flavor-delete m1.small
75-nova flavor-delete m1.medium
76+nova flavor-delete m1.small ||:
77+nova flavor-delete m1.medium ||:
78 nova flavor-create --ephemeral 0 --is-public True m1.small 2 512 20 1
79 nova flavor-create --ephemeral 0 --is-public True m1.medium 3 1024 40 2
80
81=== modified file 'tools/flavor_shrink_less.sh'
82--- tools/flavor_shrink_less.sh 2015-04-10 15:06:12 +0000
83+++ tools/flavor_shrink_less.sh 2017-03-27 20:54:03 +0000
84@@ -2,11 +2,11 @@
85 # Shrink flavors for density testing
86
87 echo " + Shrinking flavors."
88-nova flavor-delete m1.tiny
89-nova flavor-delete m1.small
90-nova flavor-delete m1.medium
91-nova flavor-delete m1.large
92-nova flavor-delete m1.xlarge
93+nova flavor-delete m1.tiny ||:
94+nova flavor-delete m1.small ||:
95+nova flavor-delete m1.medium ||:
96+nova flavor-delete m1.large ||:
97+nova flavor-delete m1.xlarge ||:
98 nova flavor-create --ephemeral 20 --is-public True m1.tiny 1 512 20 1
99 nova flavor-create --ephemeral 20 --is-public True m1.small 2 3072 20 2
100 nova flavor-create --ephemeral 40 --is-public True m1.medium 3 4096 40 2
101
102=== modified file 'tools/float_all.sh'
103--- tools/float_all.sh 2016-02-11 12:32:37 +0000
104+++ tools/float_all.sh 2017-03-27 20:54:03 +0000
105@@ -1,22 +1,21 @@
106-#!/bin/bash
107+#!/bin/bash -ex
108 # Give all instances a floating IP address.
109+# Requires >= Newton openstack client
110
111 echo " + Floating all instances."
112
113 function get_ip_f() {
114 # Get first unallocated floating IP
115- local var=$(nova floating-ip-list | grep '\- ' | awk '{ print $4 }' | head -n 1)
116- echo $var
117+ openstack floating ip list | awk '/None/ { print $4 }' | head -n 1
118 }
119
120-fips=$(nova floating-ip-list | grep '\- ' | awk '{ print $2 }')
121-fip_count=$(echo $fips | wc -w)
122-
123-instances=$(nova list | grep ACTIVE | grep -v '\,' | awk '{ print $2 }')
124+fip_count=$(openstack floating ip list | awk '/None/ { print $4 }' | wc -l)
125+instances=$(openstack server list | grep ACTIVE | grep -v '\,' | awk '{ print $2 }')
126 inst_count=$(echo $instances | wc -w)
127
128 if [[ -z "$instances" ]]; then
129- echo " . It appears that no instances need a floating IP."
130+ set +x
131+ echo " . It appears that no instance needs a floating IP."
132 exit 0
133 fi
134
135@@ -27,13 +26,14 @@
136 fip_diff=$(( $inst_count - $fip_count ))
137 echo " + Creating $fip_diff more floating IPs."
138 for m in $(seq 1 $fip_diff); do
139- nova floating-ip-create
140+ openstack floating ip create ext_net
141 done
142 fi
143
144 # Allocate floating IPs to instances.
145-for i in $instances; do
146+for instance in $instances; do
147 ip_f=$(get_ip_f)
148- echo " + Associating floating IP $ip_f to instance $i."
149- nova floating-ip-associate $i $ip_f
150+ echo " + Associating floating IP $ip_f to instance $instance."
151+ openstack server add floating ip $instance $ip_f
152 done
153+
154
155=== added file 'tools/instance_delete_all.sh'
156--- tools/instance_delete_all.sh 1970-01-01 00:00:00 +0000
157+++ tools/instance_delete_all.sh 2017-03-27 20:54:03 +0000
158@@ -0,0 +1,11 @@
159+#!/bin/bash -ex
160+if [[ -z "$WORKSPACE" ]]; then
161+ set +x
162+ echo -e "\n/!\ This script will delete all nova instances it can find, which is dangerous. It is intended
163+ to be used from Jenkins test automation. If you really wish to use it, set a WORKSPACE env var
164+ to allow it to run."
165+ exit 1
166+fi
167+
168+for i in $(openstack server list | awk '/=/{ print $2 }');do openstack server delete $i --wait; done
169+
170
171=== modified file 'tools/instance_launch.sh'
172--- tools/instance_launch.sh 2016-09-30 09:29:50 +0000
173+++ tools/instance_launch.sh 2017-03-27 20:54:03 +0000
174@@ -1,41 +1,37 @@
175-#!/bin/bash
176+#!/bin/bash -ex
177 # Launch N quantity of XYZ instances
178 # Presumes glance images exist and have been imported using the
179 # accompanying configure script.
180
181-p_qty=$1
182-p_name=$2
183-if [ -z "$p_qty" ] || [ -z "$p_name" ]; then
184- echo "Launches N quantity of XYZ instances."
185- echo "Usage: <this script> <qty of instances> <glance image name>"
186- echo " ex: ./instance_launch.sh 2 precise"
187- echo " ex: ./instance_launch.sh 10 cirros"
188- echo " ex: ./instance_launch.sh 25 trusty"
189- echo " ex: ./instance_launch.sh 10 vivid-ppc64el"
190- echo " Cirros will assume m1.cirros flavor."
191- echo " All others will use m1.small flabor."
192+instance_qty=$1
193+image_name=$2
194+if [ -z "$instance_qty" ] || [ -z "$image_name" ]; then
195+ set +x
196+ echo "Launches N quantity of XYZ instances.
197+Usage: <this script> <qty of instances> <glance image name>
198+ ex: ./instance_launch.sh 10 xenial-ppc64el
199+ Cirros images will use m1.cirros flavor.
200+ All others will use m1.small flavor."
201 exit 1
202 fi
203
204-echo " + Keying nova and ~/testkey.pem..."
205-nova keypair-list | grep testkey &> /dev/null || { nova keypair-add testkey > ~/testkey.pem; chmod 600 ~/testkey.pem; }
206-nova keypair-list | grep testkey
207-
208-echo " + Grabbing 'private' network ID..."
209-net_id=$(neutron net-list | awk '/private/ {print $2}')
210-
211-echo " + Determining flavor to use..."
212-if [[ "${p_name}" == *cirros* ]]; then
213+# Key nova and ~/testkey.pem
214+openstack keypair show testkey ||\
215+ { openstack keypair create testkey > ~/testkey.pem; chmod 600 ~/testkey.pem; }
216+
217+# Grab private network ID
218+net_id=$(openstack network list | awk '/private/ {print $2}')
219+
220+# Determining flavor to use
221+if [[ "${image_name}" == *cirros* ]]; then
222 flavor="m1.cirros"
223 else
224 flavor="m1.small"
225 fi
226
227-echo " + Nova booting ${p_qty} ${p_name} instances as flavor ${flavor}..."
228-for m in $(seq 1 $p_qty); do
229- server_name="${p_name}$(date +'%H%M%S')"
230- echo ${server_name} ${p_name} ${net_id}
231- nova boot --image ${p_name} --flavor ${flavor} --key-name testkey --nic net-id=${net_id} $server_name
232-done
233-
234-echo " + Hint: use ssh -i ~/testkey.pem ubuntu@<ip> to access new instances (may also need a floating IP)."
235+# Create instances
236+server_name="${image_name}-$(date +'%H%M%S')"
237+openstack server create --wait --image $image_name --flavor $flavor --key-name testkey --nic net-id=${net_id} --min $instance_qty --max $instance_qty $server_name
238+
239+# Hint: use ssh -i ~/testkey.pem ubuntu@<ip> to access new instances (may also need a floating IP).
240+
241
242=== modified file 'tools/instance_ssh_ping_all.sh'
243--- tools/instance_ssh_ping_all.sh 2015-04-02 03:52:38 +0000
244+++ tools/instance_ssh_ping_all.sh 2017-03-27 20:54:03 +0000
245@@ -1,11 +1,6 @@
246-#!/bin/bash
247-
248-echo " + Attempting to ping and check ssh socket for all ACTIVE instances (must have floating IPs)."
249-
250-[[ -z "$1" ]] && count=2 || count="$1"
251-
252-for i in $(nova list | grep ACTIVE | awk '{ print $13 }'); do
253- echo ==== $i ====
254- nc -w $count $i 22 && echo "OK: ssh socket check" || echo "FAIL: ssh"
255- ping -c $count $i &> /dev/null && echo "OK: ping" || echo "FAIL: ping"
256+#!/bin/bash -ex
257+# Known good with client: openstack 3.7.0
258+for i in $(openstack server list | awk '/ACTIVE/{ print $9 }'); do
259+ nc -vzw 2 $i 22
260+ ping -c 2 $i
261 done
262
263=== modified file 'tools/instance_start_all.sh'
264--- tools/instance_start_all.sh 2015-04-02 03:52:38 +0000
265+++ tools/instance_start_all.sh 2017-03-27 20:54:03 +0000
266@@ -1,5 +1,2 @@
267-#!/bin/bash
268-
269-echo " + Attempting to start all instances."
270-
271-for i in $(nova list | grep SHUT | awk '{ print $2 }');do echo $i; nova start $i; done
272+#!/bin/bash -ex
273+for i in $(openstack server list | awk '/SHUTOFF/{ print $2 }');do openstack server start $i; done
274
275=== modified file 'tools/instance_stop_all.sh'
276--- tools/instance_stop_all.sh 2015-04-02 03:52:38 +0000
277+++ tools/instance_stop_all.sh 2017-03-27 20:54:03 +0000
278@@ -1,5 +1,3 @@
279-#!/bin/bash
280-
281-echo " + Attempting to stop all instances."
282-
283-for i in $(nova list | grep = | awk '{ print $2 }');do echo $i; nova stop $i; done
284+#!/bin/bash -ex
285+for i in $(openstack server list | awk '/ACTIVE/{ print $2 }');do openstack server stop $i; done
286+

Subscribers

People subscribed via source and target branches

to status/vote changes: