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
commitf91b219df2c17363058ebac5aa3907eb3c03a118 (patch)
treecf0dc3dbcd048e03869a99230f5e596f30f83ad2 /meta-openstack-controller-test-config
parent7ac076bc61edce7788442e4750d3b5b5545a29c1 (diff)
downloadmeta-cloud-services-f91b219df2c17363058ebac5aa3907eb3c03a118.tar.gz
meta-cloud-services-f91b219df2c17363058ebac5aa3907eb3c03a118.tar.bz2
meta-cloud-services-f91b219df2c17363058ebac5aa3907eb3c03a118.zip
nova controller test config
Tempest requires nova to be able to allocate floating ip from an default pool. So search for an existing floating ip pool and change default_floating_pool in nova.conf to this pool. 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-nova/nova-test-config.init64
-rw-r--r--meta-openstack-controller-test-config/recipes-devtools/python/python-nova_git.bbappend16
2 files changed, 80 insertions, 0 deletions
diff --git a/meta-openstack-controller-test-config/recipes-devtools/python/python-nova/nova-test-config.init b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova/nova-test-config.init
new file mode 100644
index 00000000..676380d0
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova/nova-test-config.init
@@ -0,0 +1,64 @@
+#!/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: Nova Test Config
+# Description: OpenStack Nova Test Config
+### END INIT INFO
+
+
+NOVA_CONF_FILE="/etc/nova/nova.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 $NOVA_CONF_FILE ]; then
+ sleep 5
+ source /etc/nova/openrc
+ nova floating-ip-pool-list > $temp_file 2>&1
+ if [ "$?" != "0" ]; then
+ echo "Nova service is not running"
+ exit 1
+ fi
+ line=`sed -n '4p' < $temp_file`
+ if [ "$line" != "+------+" ]; then
+ pool_name=`echo $line | get_field 1`
+ sed -i "s/^default_floating_pool = .*/default_floating_pool = ${pool_name}/" $NOVA_CONF_FILE
+ /etc/init.d/nova-api restart
+ else
+ echo "ERROR: There is no floating IP pool"
+ fi
+ rm -f $temp_file > /dev/null 2>&1
+ 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-nova_git.bbappend b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova_git.bbappend
new file mode 100644
index 00000000..c01d6497
--- /dev/null
+++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova_git.bbappend
@@ -0,0 +1,16 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
+SRC_URI += " file://nova-test-config.init"
+
+do_install_append() {
+ install -m 0755 ${WORKDIR}/nova-test-config.init ${D}${sysconfdir}/init.d/nova-test-config
+}
+
+PACKAGES += " ${SRCNAME}-test-config"
+FILES_${SRCNAME}-test-config = "${sysconfdir}/init.d/nova-test-config"
+
+RDEPENDS_${SRCNAME}-tests += " ${SRCNAME}-test-config"
+
+INITSCRIPT_PACKAGES += " ${SRCNAME}-test-config"
+INITSCRIPT_NAME_${SRCNAME}-test-config = "nova-test-config"
+INITSCRIPT_PARAMS_${SRCNAME}-test-config = "defaults 95 10"