summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-support
diff options
context:
space:
mode:
authorMustapha Lansana <Mustapha.Lansana@windriver.com>2014-05-27 22:02:57 -0400
committerBruce Ashfield <bruce.ashfield@windriver.com>2014-09-26 09:09:21 -0400
commit800f64a64014fdbe046a6d0969303057de2e6539 (patch)
treed3564354420428bf294260e11597c0080b60831b /meta-openstack/recipes-support
parenteeda01a7be07c78dac7b6ae5013524d857ceba3b (diff)
downloadmeta-cloud-services-800f64a64014fdbe046a6d0969303057de2e6539.tar.gz
deploychef: helper script and configuration files
Deploychef package reconfigures an openstack installation. These are helper files used by the deploychef package to bring the system down and back up again before, and after chef-solo has generated our desired configuration files from template files. Later on in this commit series, the *-list files will be replaced with dynamically generated *-list files by openstackchef. In addition, the script files will be adapted to support openstackchef. Signed-off-by: Mustapha Lansana <Mustapha.Lansana@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-support')
-rw-r--r--meta-openstack/recipes-support/deploychef/files/run-deploychef37
-rw-r--r--meta-openstack/recipes-support/deploychef/files/run-postinsts64
-rw-r--r--meta-openstack/recipes-support/deploychef/files/service-shutdown54
-rw-r--r--meta-openstack/recipes-support/deploychef/files/shutdown-list42
-rw-r--r--meta-openstack/recipes-support/deploychef/files/startup-list41
5 files changed, 238 insertions, 0 deletions
diff --git a/meta-openstack/recipes-support/deploychef/files/run-deploychef b/meta-openstack/recipes-support/deploychef/files/run-deploychef
new file mode 100644
index 0000000..03e8807
--- /dev/null
+++ b/meta-openstack/recipes-support/deploychef/files/run-deploychef
@@ -0,0 +1,37 @@
1#!/bin/bash
2# run-chefsolo
3#
4# Copyright (c) 2014 Wind River Systems, Inc.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23#
24#
25# This file is the main file that the install will call in order to reconfig
26# and Openstack node
27# bash run-chefsolo
28#
29#
30#Shutdown all openstack modules
31bash service-shutdown
32#Use chefsolo to bake our recipe and generate configuration files/scripts
33chef-solo -f -c config.rb -j attributes.json
34#Workaround to force the files to be copied from postinsts dir
35chef-solo -f -c config.rb -j attributes.json
36#Restart services
37bash run-postinsts /etc/%POSTINSTS_DIR%/
diff --git a/meta-openstack/recipes-support/deploychef/files/run-postinsts b/meta-openstack/recipes-support/deploychef/files/run-postinsts
new file mode 100644
index 0000000..35d46f0
--- /dev/null
+++ b/meta-openstack/recipes-support/deploychef/files/run-postinsts
@@ -0,0 +1,64 @@
1#!/bin/sh
2# run-postinsts
3#
4# Copyright (c) 2014 Wind River Systems, Inc.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23#
24# After chefsolo generates our config and scripts, we call this script
25# to run the posinstall script and start the services
26#
27#
28RPM_POSTINSTS_DIR=$1
29LOG_DIR='/var/log/%PACKAGE_NAME%/'
30mkdir -p $LOG_DIR
31if [ ! -d $RPM_POSTINSTS_DIR ]; then
32 echo "Post Install script dir not set"
33 exit 1
34fi
35cd / #work-around for cinder-volume config file location
36echo "x$RPM_POSTINSTS_DIR" > "$LOD_DIR"log.run-postinsts
37for i in `ls $RPM_POSTINSTS_DIR 2> /dev/null`; do
38 i=$RPM_POSTINSTS_DIR$i
39 echo "Running postinst $i..."
40 if [ -f $i ] && $i; then
41 rm $i
42 else
43 echo "ERROR: postinst $i failed. $? " >> "$LOG_DIR"log.run-postinsts
44 fi
45done
46
47
48#Start all the modules specified in startup-list
49INITD_DIR=/etc/init.d/
50services=$(cat %DEPLOYCHEF_ROOT_DIR%/startup-list)
51for service in $services; do
52 service=$(echo $service | awk -F'S..' '{print $2}')
53 if [ -e $INITD_DIR$service ]; then
54 if [ $service = 'cinder-volume' ]; then
55 $INITD_DIR$service reload
56 else
57 $INITD_DIR$service start
58 fi
59 sleep 1
60 fi
61done
62
63#Restart cloud service cloud-init
64/etc/init.d/cloud-init start
diff --git a/meta-openstack/recipes-support/deploychef/files/service-shutdown b/meta-openstack/recipes-support/deploychef/files/service-shutdown
new file mode 100644
index 0000000..b89f9fa
--- /dev/null
+++ b/meta-openstack/recipes-support/deploychef/files/service-shutdown
@@ -0,0 +1,54 @@
1#!/bin/bash
2# service-shutdown
3#
4# Copyright (c) 2014 Wind River Systems, Inc.
5#
6# Permission is hereby granted, free of charge, to any person obtaining a copy
7# of this software and associated documentation files (the "Software"), to deal
8# in the Software without restriction, including without limitation the rights
9# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10# copies of the Software, and to permit persons to whom the Software is
11# furnished to do so, subject to the following conditions:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15
16# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22# THE SOFTWARE.
23#
24#
25INITD_DIR=/etc/init.d/
26services=$(cat %DEPLOYCHEF_ROOT_DIR%/shutdown-list)
27for service in $services; do
28 service=$(echo $service | awk -F'K..' '{print $2}')
29 if [ -e $INITD_DIR$service ]; then
30 $INITD_DIR$service stop
31 sleep 1
32 fi
33done
34
35#Clean up swift installation and all stale files
36/etc/swift/swift_setup.sh clean
37
38#Delete all the know data base entries
39databases="ceilometer cinder glance heat keystone nova ovs_neutron \
40 postgres"
41for database in $databases; do
42 sudo -u postgres dropdb $database
43 sleep 1
44done
45
46#Now shutdown postgres and database directory
47if [ -e ${INITD_DIR}postgresql ]; then
48 ${INITD_DIR}postgresql stop
49 killall postgres
50 sleep 1
51 rm -rf /etc/postgresql
52 sleep 1
53fi
54
diff --git a/meta-openstack/recipes-support/deploychef/files/shutdown-list b/meta-openstack/recipes-support/deploychef/files/shutdown-list
new file mode 100644
index 0000000..b1cda2e
--- /dev/null
+++ b/meta-openstack/recipes-support/deploychef/files/shutdown-list
@@ -0,0 +1,42 @@
1K10barbican-api
2K10ceilometer-agent-central
3K10ceilometer-agent-compute
4K10ceilometer-alarm-evaluator
5K10ceilometer-alarm-notifier
6K10ceilometer-api
7K10ceilometer-collector
8K10cinder-api
9K10cinder-backup
10K10cinder-scheduler
11K10cinder-volume
12K10glance-api
13K10glance-registry
14K10heat-api
15K10heat-api-cfn
16K10heat-engine
17K10horizon
18K10keystone
19K10neutron-dhcp-agent
20K10neutron-l3-agent
21K10neutron-openvswitch-agent
22K10neutron-server
23K10nova-api
24K10nova-cert
25K10nova-compute
26K10nova-conductor
27K10nova-consoleauth
28K10nova-network
29K10nova-novncproxy
30K10nova-scheduler
31K10nova-spicehtml5proxy
32K20apache2
33K20cloud-init
34K20dnsmasq
35K20rabbitmq-server
36K20swift
37K80glusterd
38K20postgresql
39K50deploy
40K71openvswitch-switch
41K72libvirtd
42
diff --git a/meta-openstack/recipes-support/deploychef/files/startup-list b/meta-openstack/recipes-support/deploychef/files/startup-list
new file mode 100644
index 0000000..810d619
--- /dev/null
+++ b/meta-openstack/recipes-support/deploychef/files/startup-list
@@ -0,0 +1,41 @@
1S20cloud-init
2S20dnsmasq
3S20glusterd
4S20postgresql
5S20rabbitmq-server
6S20swift
7S30barbican-api
8S30ceilometer-agent-central
9S30ceilometer-agent-compute
10S30ceilometer-alarm-evaluator
11S30ceilometer-alarm-notifier
12S30ceilometer-api
13S30ceilometer-collector
14S30cinder-volume
15S30cinder-backup
16S30cinder-scheduler
17S30cinder-api
18S30glance-api
19S30glance-registry
20S30heat-api
21S30heat-api-cfn
22S30heat-engine
23S30horizon
24S30keystone
25S30neutron-dhcp-agent
26S30neutron-l3-agent
27S30neutron-openvswitch-agent
28S30neutron-server
29S30nova-api
30S30nova-cert
31S30nova-compute
32S30nova-conductor
33S30nova-consoleauth
34S30nova-network
35S30nova-novncproxy
36S30nova-scheduler
37S30nova-spicehtml5proxy
38S70lighttpd
39S71openvswitch-switch
40S72libvirtd
41S72openvswitch-controller