summaryrefslogtreecommitdiffstats
path: root/meta-openstack-controller-test-config/recipes-devtools/python
diff options
context:
space:
mode:
authorVu Tran <vu.tran@windriver.com>2014-05-23 22:10:37 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-05-26 11:32:11 -0400
commit290b06671599e31b232257b7bb30a42d8eff8f68 (patch)
tree2ec2a112b8284f268558d30f0c371a722650de0e /meta-openstack-controller-test-config/recipes-devtools/python
parentd25baff94a2f480f0adc689cf903dcab304e5c2e (diff)
downloadmeta-cloud-services-290b06671599e31b232257b7bb30a42d8eff8f68.tar.gz
glance controller test config
Tempest requires an Glance image exists prior to run the test. So add start up script to make sure an Glance image exists and change tempest.conf to reflect this image uuid. Signed-off-by: Vu Tran <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack-controller-test-config/recipes-devtools/python')
-rw-r--r--meta-openstack-controller-test-config/recipes-devtools/python/python-glance/glance-test-config.init66
-rw-r--r--meta-openstack-controller-test-config/recipes-devtools/python/python-glance_git.bbappend16
2 files changed, 82 insertions, 0 deletions
diff --git a/meta-openstack-controller-test-config/recipes-devtools/python/python-glance/glance-test-config.init b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance/glance-test-config.init
new file mode 100644
index 0000000..2186421
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance/glance-test-config.init
@@ -0,0 +1,66 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides:
5# Required-Start: $remote_fs $network $syslog
6# Required-Stop: $remote_fs $syslog
7# Default-Start: 2 3 4 5
8# Default-Stop: 0 1 6
9# Short-Description: Glance Test Config
10# Description: OpenStack Image Test Config
11### END INIT INFO
12
13
14TEMPEST_CONF_FILE=/etc/tempest/tempest.conf
15temp_file="/tmp/do_note_delete_me.temp"
16
17
18function get_field() {
19 while read data; do
20 if [ "$1" -lt 0 ]; then
21 field="(\$(NF$1))"
22 else
23 field="\$$(($1 + 1))"
24 fi
25 echo "$data" | awk -F'[ \t]*\\|[ \t]*' "{print $field}"
26 done
27}
28
29start()
30{
31 if [ -e $TEMPEST_CONF_FILE ]; then
32 sleep 5
33 source /etc/nova/openrc
34 glance image-list > $temp_file 2>&1
35 if [ "$?" != "0" ]; then
36 echo "Glance service is not running"
37 exit 1
38 fi
39 id=`sed -n '4p' < $temp_file | get_field 1`
40 glance image-show $id > /dev/null 2>&1
41 if [ "$?" != "0" ]; then
42 id=`glance image-create --name myfirstimage --is-public true --container-format bare --disk-format qcow2 --file /root/images/cirros-0.3.0-x86_64-disk.img | grep " id " | get_field 2`
43 fi
44 sed -i "s/^image_ref = .*/image_ref = ${id}/" $TEMPEST_CONF_FILE
45 sed -i "s/^image_ref_alt = .*/image_ref_alt = ${id}/" $TEMPEST_CONF_FILE
46 rm -f $temp_file > /dev/null 2>&1
47
48 nslookup google.com
49 [ "$?" != "0" ] && echo "WARNING: Make sure DNS server is setup correctly or else some tempest testcases will fail"
50 fi
51}
52
53case "$1" in
54 start)
55 start
56 ;;
57 stop|force-reload|restart|reload|status)
58 echo "WARNING: command $1 is not supported"
59 ;;
60 *)
61 echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
62 exit 1
63 ;;
64esac
65
66exit 0
diff --git a/meta-openstack-controller-test-config/recipes-devtools/python/python-glance_git.bbappend b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance_git.bbappend
new file mode 100644
index 0000000..1c89d51
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance_git.bbappend
@@ -0,0 +1,16 @@
1FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
2
3SRC_URI += " file://glance-test-config.init"
4
5do_install_append() {
6 install -m 0755 ${WORKDIR}/glance-test-config.init ${D}${sysconfdir}/init.d/glance-test-config
7}
8
9PACKAGES += " ${SRCNAME}-test-config"
10FILES_${SRCNAME}-test-config = "${sysconfdir}/init.d/glance-test-config"
11
12RDEPENDS_${SRCNAME}-tests += " ${SRCNAME}-test-config"
13
14INITSCRIPT_PACKAGES += " ${SRCNAME}-test-config"
15INITSCRIPT_NAME_${SRCNAME}-test-config = "glance-test-config"
16INITSCRIPT_PARAMS_${SRCNAME}-test-config = "defaults 95 10"