aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack-controller-test-config
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:30:08 -0400
commit0f728e306634535cbef82aad2024d5044d4fc032 (patch)
tree6991ed1128881337d122f1674daa58a3718cf39e /meta-openstack-controller-test-config
parent148c4dbfcbb5f53adafe4b0e1bd3de0b98d3a641 (diff)
downloadmeta-cloud-services-0f728e306634535cbef82aad2024d5044d4fc032.tar.gz
meta-cloud-services-0f728e306634535cbef82aad2024d5044d4fc032.tar.bz2
meta-cloud-services-0f728e306634535cbef82aad2024d5044d4fc032.zip
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')
-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 00000000..2186421e
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance/glance-test-config.init
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:
+# Required-Start: $remote_fs $network $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Glance Test Config
+# Description: OpenStack Image Test Config
+### END INIT INFO
+
+
+TEMPEST_CONF_FILE=/etc/tempest/tempest.conf
+temp_file="/tmp/do_note_delete_me.temp"
+
+
+function get_field() {
+ while read data; do
+ if [ "$1" -lt 0 ]; then
+ field="(\$(NF$1))"
+ else
+ field="\$$(($1 + 1))"
+ fi
+ echo "$data" | awk -F'[ \t]*\\|[ \t]*' "{print $field}"
+ done
+}
+
+start()
+{
+ if [ -e $TEMPEST_CONF_FILE ]; then
+ sleep 5
+ source /etc/nova/openrc
+ glance image-list > $temp_file 2>&1
+ if [ "$?" != "0" ]; then
+ echo "Glance service is not running"
+ exit 1
+ fi
+ id=`sed -n '4p' < $temp_file | get_field 1`
+ glance image-show $id > /dev/null 2>&1
+ if [ "$?" != "0" ]; then
+ 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`
+ fi
+ sed -i "s/^image_ref = .*/image_ref = ${id}/" $TEMPEST_CONF_FILE
+ sed -i "s/^image_ref_alt = .*/image_ref_alt = ${id}/" $TEMPEST_CONF_FILE
+ rm -f $temp_file > /dev/null 2>&1
+
+ nslookup google.com
+ [ "$?" != "0" ] && echo "WARNING: Make sure DNS server is setup correctly or else some tempest testcases will fail"
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop|force-reload|restart|reload|status)
+ echo "WARNING: command $1 is not supported"
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
+ exit 1
+ ;;
+esac
+
+exit 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 00000000..1c89d517
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-glance_git.bbappend
@@ -0,0 +1,16 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += " file://glance-test-config.init"
+
+do_install_append() {
+ install -m 0755 ${WORKDIR}/glance-test-config.init ${D}${sysconfdir}/init.d/glance-test-config
+}
+
+PACKAGES += " ${SRCNAME}-test-config"
+FILES_${SRCNAME}-test-config = "${sysconfdir}/init.d/glance-test-config"
+
+RDEPENDS_${SRCNAME}-tests += " ${SRCNAME}-test-config"
+
+INITSCRIPT_PACKAGES += " ${SRCNAME}-test-config"
+INITSCRIPT_NAME_${SRCNAME}-test-config = "glance-test-config"
+INITSCRIPT_PARAMS_${SRCNAME}-test-config = "defaults 95 10"