diff options
Diffstat (limited to 'meta-openstack')
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 00000000..03e8807b --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/run-deploychef @@ -0,0 +1,37 @@ +#!/bin/bash +# run-chefsolo +# +# Copyright (c) 2014 Wind River Systems, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# +# This file is the main file that the install will call in order to reconfig +# and Openstack node +# bash run-chefsolo +# +# +#Shutdown all openstack modules +bash service-shutdown +#Use chefsolo to bake our recipe and generate configuration files/scripts +chef-solo -f -c config.rb -j attributes.json +#Workaround to force the files to be copied from postinsts dir +chef-solo -f -c config.rb -j attributes.json +#Restart services +bash 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 00000000..35d46f08 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/run-postinsts @@ -0,0 +1,64 @@ +#!/bin/sh +# run-postinsts +# +# Copyright (c) 2014 Wind River Systems, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# After chefsolo generates our config and scripts, we call this script +# to run the posinstall script and start the services +# +# +RPM_POSTINSTS_DIR=$1 +LOG_DIR='/var/log/%PACKAGE_NAME%/' +mkdir -p $LOG_DIR +if [ ! -d $RPM_POSTINSTS_DIR ]; then + echo "Post Install script dir not set" + exit 1 +fi +cd / #work-around for cinder-volume config file location +echo "x$RPM_POSTINSTS_DIR" > "$LOD_DIR"log.run-postinsts +for i in `ls $RPM_POSTINSTS_DIR 2> /dev/null`; do + i=$RPM_POSTINSTS_DIR$i + echo "Running postinst $i..." + if [ -f $i ] && $i; then + rm $i + else + echo "ERROR: postinst $i failed. $? " >> "$LOG_DIR"log.run-postinsts + fi +done + + +#Start all the modules specified in startup-list +INITD_DIR=/etc/init.d/ +services=$(cat %DEPLOYCHEF_ROOT_DIR%/startup-list) +for service in $services; do + service=$(echo $service | awk -F'S..' '{print $2}') + if [ -e $INITD_DIR$service ]; then + if [ $service = 'cinder-volume' ]; then + $INITD_DIR$service reload + else + $INITD_DIR$service start + fi + sleep 1 + fi +done + +#Restart cloud service cloud-init +/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 00000000..b89f9fa4 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/service-shutdown @@ -0,0 +1,54 @@ +#!/bin/bash +# service-shutdown +# +# Copyright (c) 2014 Wind River Systems, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. + +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# +INITD_DIR=/etc/init.d/ +services=$(cat %DEPLOYCHEF_ROOT_DIR%/shutdown-list) +for service in $services; do + service=$(echo $service | awk -F'K..' '{print $2}') + if [ -e $INITD_DIR$service ]; then + $INITD_DIR$service stop + sleep 1 + fi +done + +#Clean up swift installation and all stale files +/etc/swift/swift_setup.sh clean + +#Delete all the know data base entries +databases="ceilometer cinder glance heat keystone nova ovs_neutron \ + postgres" +for database in $databases; do + sudo -u postgres dropdb $database + sleep 1 +done + +#Now shutdown postgres and database directory +if [ -e ${INITD_DIR}postgresql ]; then + ${INITD_DIR}postgresql stop + killall postgres + sleep 1 + rm -rf /etc/postgresql + sleep 1 +fi + 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 00000000..b1cda2eb --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/shutdown-list @@ -0,0 +1,42 @@ +K10barbican-api +K10ceilometer-agent-central +K10ceilometer-agent-compute +K10ceilometer-alarm-evaluator +K10ceilometer-alarm-notifier +K10ceilometer-api +K10ceilometer-collector +K10cinder-api +K10cinder-backup +K10cinder-scheduler +K10cinder-volume +K10glance-api +K10glance-registry +K10heat-api +K10heat-api-cfn +K10heat-engine +K10horizon +K10keystone +K10neutron-dhcp-agent +K10neutron-l3-agent +K10neutron-openvswitch-agent +K10neutron-server +K10nova-api +K10nova-cert +K10nova-compute +K10nova-conductor +K10nova-consoleauth +K10nova-network +K10nova-novncproxy +K10nova-scheduler +K10nova-spicehtml5proxy +K20apache2 +K20cloud-init +K20dnsmasq +K20rabbitmq-server +K20swift +K80glusterd +K20postgresql +K50deploy +K71openvswitch-switch +K72libvirtd + 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 00000000..810d6190 --- /dev/null +++ b/meta-openstack/recipes-support/deploychef/files/startup-list @@ -0,0 +1,41 @@ +S20cloud-init +S20dnsmasq +S20glusterd +S20postgresql +S20rabbitmq-server +S20swift +S30barbican-api +S30ceilometer-agent-central +S30ceilometer-agent-compute +S30ceilometer-alarm-evaluator +S30ceilometer-alarm-notifier +S30ceilometer-api +S30ceilometer-collector +S30cinder-volume +S30cinder-backup +S30cinder-scheduler +S30cinder-api +S30glance-api +S30glance-registry +S30heat-api +S30heat-api-cfn +S30heat-engine +S30horizon +S30keystone +S30neutron-dhcp-agent +S30neutron-l3-agent +S30neutron-openvswitch-agent +S30neutron-server +S30nova-api +S30nova-cert +S30nova-compute +S30nova-conductor +S30nova-consoleauth +S30nova-network +S30nova-novncproxy +S30nova-scheduler +S30nova-spicehtml5proxy +S70lighttpd +S71openvswitch-switch +S72libvirtd +S72openvswitch-controller |