2012-03-28 11:19:24 -05:00
|
|
|
#!/usr/bin/env bash
|
2012-06-27 17:55:52 -05:00
|
|
|
|
|
|
|
# **unstack.sh**
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Stops that which is started by ``stack.sh`` (mostly)
|
|
|
|
# mysql and rabbit are left running as OpenStack code refreshes
|
|
|
|
# do not require them to be restarted.
|
|
|
|
#
|
2012-08-28 17:43:40 -05:00
|
|
|
# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``--all``
|
2012-03-28 11:19:24 -05:00
|
|
|
# on the command line
|
|
|
|
|
|
|
|
# Keep track of the current devstack directory.
|
|
|
|
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
|
|
|
|
|
|
|
# Import common functions
|
|
|
|
source $TOP_DIR/functions
|
|
|
|
|
2012-11-01 16:12:39 -04:00
|
|
|
# Import database library
|
|
|
|
source $TOP_DIR/lib/database
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Load local configuration
|
|
|
|
source $TOP_DIR/stackrc
|
|
|
|
|
2012-09-11 14:15:54 -06:00
|
|
|
# Destination path for service data
|
|
|
|
DATA_DIR=${DATA_DIR:-${DEST}/data}
|
|
|
|
|
2013-10-04 12:35:24 -05:00
|
|
|
if [[ $EUID -eq 0 ]]; then
|
|
|
|
echo "You are running this script as root."
|
|
|
|
echo "It might work but you will have a better day running it as $STACK_USER"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2013-06-21 18:18:02 +08:00
|
|
|
# Import apache functions
|
|
|
|
source $TOP_DIR/lib/apache
|
|
|
|
|
2012-09-11 14:15:54 -06:00
|
|
|
# Get project function libraries
|
2012-11-23 10:54:54 -08:00
|
|
|
source $TOP_DIR/lib/baremetal
|
2012-09-11 14:15:54 -06:00
|
|
|
source $TOP_DIR/lib/cinder
|
2012-11-19 16:00:01 -05:00
|
|
|
source $TOP_DIR/lib/horizon
|
2012-11-29 14:19:41 +01:00
|
|
|
source $TOP_DIR/lib/swift
|
2013-07-06 23:29:39 -04:00
|
|
|
source $TOP_DIR/lib/neutron
|
2013-08-09 10:40:45 +03:00
|
|
|
source $TOP_DIR/lib/ironic
|
2012-12-03 18:15:09 -07:00
|
|
|
source $TOP_DIR/lib/trove
|
2012-09-11 14:15:54 -06:00
|
|
|
|
2013-10-15 09:42:43 -05:00
|
|
|
# Extras Source
|
|
|
|
# --------------
|
|
|
|
|
|
|
|
# Phase: source
|
|
|
|
if [[ -d $TOP_DIR/extras.d ]]; then
|
|
|
|
for i in $TOP_DIR/extras.d/*.sh; do
|
|
|
|
[[ -r $i ]] && source $i source
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Determine what system we are running on. This provides ``os_VENDOR``,
|
|
|
|
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
|
|
|
|
GetOSVersion
|
|
|
|
|
|
|
|
if [[ "$1" == "--all" ]]; then
|
|
|
|
UNSTACK_ALL=${UNSTACK_ALL:-1}
|
|
|
|
fi
|
|
|
|
|
2013-01-09 13:42:03 -06:00
|
|
|
# Run extras
|
|
|
|
# ==========
|
|
|
|
|
2013-10-15 09:42:43 -05:00
|
|
|
# Phase: unstack
|
2013-01-09 13:42:03 -06:00
|
|
|
if [[ -d $TOP_DIR/extras.d ]]; then
|
|
|
|
for i in $TOP_DIR/extras.d/*.sh; do
|
|
|
|
[[ -r $i ]] && source $i unstack
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2012-11-19 22:04:28 -08:00
|
|
|
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
|
|
|
|
source $TOP_DIR/openrc
|
2013-07-06 23:29:39 -04:00
|
|
|
teardown_neutron_debug
|
2012-11-19 22:04:28 -08:00
|
|
|
fi
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Shut down devstack's screen to get the bulk of OpenStack services in one shot
|
2012-06-14 09:11:38 -05:00
|
|
|
SCREEN=$(which screen)
|
|
|
|
if [[ -n "$SCREEN" ]]; then
|
|
|
|
SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
|
|
|
|
if [[ -n "$SESSION" ]]; then
|
|
|
|
screen -X -S $SESSION quit
|
|
|
|
fi
|
2012-03-28 11:19:24 -05:00
|
|
|
fi
|
|
|
|
|
2013-08-04 19:53:19 -05:00
|
|
|
# Shut down Nova hypervisor plugins after Nova
|
|
|
|
NOVA_PLUGINS=$TOP_DIR/lib/nova_plugins
|
|
|
|
if is_service_enabled nova && [[ -r $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER ]]; then
|
|
|
|
# Load plugin
|
|
|
|
source $NOVA_PLUGINS/hypervisor-$VIRT_DRIVER
|
|
|
|
stop_nova_hypervisor
|
|
|
|
fi
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Swift runs daemons
|
2013-03-06 10:58:33 +01:00
|
|
|
if is_service_enabled s-proxy; then
|
2012-11-29 14:19:41 +01:00
|
|
|
stop_swift
|
2013-01-12 20:10:34 +00:00
|
|
|
cleanup_swift
|
2012-03-28 11:19:24 -05:00
|
|
|
fi
|
|
|
|
|
2013-08-09 10:40:45 +03:00
|
|
|
# Ironic runs daemons
|
|
|
|
if is_service_enabled ir-api ir-cond; then
|
|
|
|
stop_ironic
|
|
|
|
cleanup_ironic
|
|
|
|
fi
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Apache has the WSGI processes
|
|
|
|
if is_service_enabled horizon; then
|
2012-11-19 16:00:01 -05:00
|
|
|
stop_horizon
|
2012-03-28 11:19:24 -05:00
|
|
|
fi
|
|
|
|
|
2012-11-29 11:47:58 -06:00
|
|
|
# Kill TLS proxies
|
|
|
|
if is_service_enabled tls-proxy; then
|
|
|
|
killall stud
|
|
|
|
fi
|
|
|
|
|
2012-11-23 10:54:54 -08:00
|
|
|
# baremetal might have created a fake environment
|
|
|
|
if is_service_enabled baremetal && [[ "$BM_USE_FAKE_ENV" = "True" ]]; then
|
|
|
|
cleanup_fake_baremetal_env
|
|
|
|
fi
|
|
|
|
|
2012-09-11 14:15:54 -06:00
|
|
|
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
|
|
|
|
|
2012-03-28 11:19:24 -05:00
|
|
|
# Get the iSCSI volumes
|
2012-11-13 16:55:41 -08:00
|
|
|
if is_service_enabled cinder; then
|
2012-12-20 16:41:57 -05:00
|
|
|
cleanup_cinder
|
2012-03-28 11:19:24 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -n "$UNSTACK_ALL" ]]; then
|
|
|
|
# Stop MySQL server
|
|
|
|
if is_service_enabled mysql; then
|
|
|
|
stop_service mysql
|
|
|
|
fi
|
2012-09-06 13:47:06 -05:00
|
|
|
|
2012-11-01 16:12:39 -04:00
|
|
|
if is_service_enabled postgresql; then
|
|
|
|
stop_service postgresql
|
|
|
|
fi
|
|
|
|
|
2012-09-06 13:47:06 -05:00
|
|
|
# Stop rabbitmq-server
|
|
|
|
if is_service_enabled rabbit; then
|
|
|
|
stop_service rabbitmq-server
|
|
|
|
fi
|
2012-03-28 11:19:24 -05:00
|
|
|
fi
|
2012-07-18 07:43:01 -04:00
|
|
|
|
2013-07-06 23:29:39 -04:00
|
|
|
if is_service_enabled neutron; then
|
|
|
|
stop_neutron
|
|
|
|
stop_neutron_third_party
|
|
|
|
cleanup_neutron
|
2012-07-18 07:43:01 -04:00
|
|
|
fi
|
2013-07-16 13:36:34 +10:00
|
|
|
|
2012-12-03 18:15:09 -07:00
|
|
|
if is_service_enabled trove; then
|
|
|
|
cleanup_trove
|
|
|
|
fi
|
|
|
|
|
2013-07-16 13:36:34 +10:00
|
|
|
cleanup_tmp
|