diff options
| author | Vu Tran <vu.tran@windriver.com> | 2014-05-23 22:10:37 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-05-26 11:30:08 -0400 |
| commit | f91b219df2c17363058ebac5aa3907eb3c03a118 (patch) | |
| tree | cf0dc3dbcd048e03869a99230f5e596f30f83ad2 /meta-openstack-controller-test-config | |
| parent | 7ac076bc61edce7788442e4750d3b5b5545a29c1 (diff) | |
| download | meta-cloud-services-f91b219df2c17363058ebac5aa3907eb3c03a118.tar.gz | |
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')
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 0000000..676380d --- /dev/null +++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova/nova-test-config.init | |||
| @@ -0,0 +1,64 @@ | |||
| 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: Nova Test Config | ||
| 10 | # Description: OpenStack Nova Test Config | ||
| 11 | ### END INIT INFO | ||
| 12 | |||
| 13 | |||
| 14 | NOVA_CONF_FILE="/etc/nova/nova.conf" | ||
| 15 | temp_file="/tmp/do_note_delete_me.temp" | ||
| 16 | |||
| 17 | |||
| 18 | function 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 | |||
| 29 | start() | ||
| 30 | { | ||
| 31 | if [ -e $NOVA_CONF_FILE ]; then | ||
| 32 | sleep 5 | ||
| 33 | source /etc/nova/openrc | ||
| 34 | nova floating-ip-pool-list > $temp_file 2>&1 | ||
| 35 | if [ "$?" != "0" ]; then | ||
| 36 | echo "Nova service is not running" | ||
| 37 | exit 1 | ||
| 38 | fi | ||
| 39 | line=`sed -n '4p' < $temp_file` | ||
| 40 | if [ "$line" != "+------+" ]; then | ||
| 41 | pool_name=`echo $line | get_field 1` | ||
| 42 | sed -i "s/^default_floating_pool = .*/default_floating_pool = ${pool_name}/" $NOVA_CONF_FILE | ||
| 43 | /etc/init.d/nova-api restart | ||
| 44 | else | ||
| 45 | echo "ERROR: There is no floating IP pool" | ||
| 46 | fi | ||
| 47 | rm -f $temp_file > /dev/null 2>&1 | ||
| 48 | fi | ||
| 49 | } | ||
| 50 | |||
| 51 | case "$1" in | ||
| 52 | start) | ||
| 53 | start | ||
| 54 | ;; | ||
| 55 | stop|force-reload|restart|reload|status) | ||
| 56 | echo "WARNING: command $1 is not supported" | ||
| 57 | ;; | ||
| 58 | *) | ||
| 59 | echo "Usage: $0 {start|stop|force-reload|restart|reload|status}" | ||
| 60 | exit 1 | ||
| 61 | ;; | ||
| 62 | esac | ||
| 63 | |||
| 64 | 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 0000000..c01d649 --- /dev/null +++ b/meta-openstack-controller-test-config/recipes-devtools/python/python-nova_git.bbappend | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
| 2 | |||
| 3 | SRC_URI += " file://nova-test-config.init" | ||
| 4 | |||
| 5 | do_install_append() { | ||
| 6 | install -m 0755 ${WORKDIR}/nova-test-config.init ${D}${sysconfdir}/init.d/nova-test-config | ||
| 7 | } | ||
| 8 | |||
| 9 | PACKAGES += " ${SRCNAME}-test-config" | ||
| 10 | FILES_${SRCNAME}-test-config = "${sysconfdir}/init.d/nova-test-config" | ||
| 11 | |||
| 12 | RDEPENDS_${SRCNAME}-tests += " ${SRCNAME}-test-config" | ||
| 13 | |||
| 14 | INITSCRIPT_PACKAGES += " ${SRCNAME}-test-config" | ||
| 15 | INITSCRIPT_NAME_${SRCNAME}-test-config = "nova-test-config" | ||
| 16 | INITSCRIPT_PARAMS_${SRCNAME}-test-config = "defaults 95 10" | ||
