2015-02-04 12:44:18 -05:00
|
|
|
#!/bin/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.
|
|
|
|
#
|
2014-12-04 19:38:15 -05:00
|
|
|
# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``-a``
|
2012-03-28 11:19:24 -05:00
|
|
|
# on the command line
|
|
|
|
|
2016-02-17 10:52:33 -08:00
|
|
|
UNSTACK_ALL=${UNSTACK_ALL:-""}
|
2014-12-04 19:38:15 -05:00
|
|
|
|
|
|
|
while getopts ":a" opt; do
|
|
|
|
case $opt in
|
|
|
|
a)
|
2016-02-17 10:52:33 -08:00
|
|
|
UNSTACK_ALL="-1"
|
2014-12-04 19:38:15 -05:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-03-28 08:20:50 -05:00
|
|
|
# Keep track of the current DevStack directory.
|
2012-03-28 11:19:24 -05:00
|
|
|
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
2014-12-04 19:38:15 -05:00
|
|
|
FILES=$TOP_DIR/files
|
2012-03-28 11:19:24 -05:00
|
|
|
|
|
|
|
# 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
|
2014-12-04 19:38:15 -05:00
|
|
|
source $TOP_DIR/openrc
|
2012-03-28 11:19:24 -05:00
|
|
|
|
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
|
|
|
|
|
2014-01-16 18:16:48 -06:00
|
|
|
|
|
|
|
# Configure Projects
|
|
|
|
# ==================
|
|
|
|
|
2017-12-20 11:38:23 +09:00
|
|
|
# Determine what system we are running on. This provides ``os_VENDOR``,
|
|
|
|
# ``os_RELEASE``, ``os_PACKAGE``, ``os_CODENAME`` and ``DISTRO``
|
|
|
|
GetDistro
|
|
|
|
|
2015-09-14 18:52:47 +08:00
|
|
|
# Plugin Phase 0: override_defaults - allow plugins to override
|
2015-03-26 05:54:28 -04:00
|
|
|
# defaults before other services are run
|
|
|
|
run_phase override_defaults
|
|
|
|
|
2013-06-21 18:18:02 +08:00
|
|
|
# Import apache functions
|
|
|
|
source $TOP_DIR/lib/apache
|
|
|
|
|
2014-01-16 18:16:48 -06:00
|
|
|
# Import TLS functions
|
|
|
|
source $TOP_DIR/lib/tls
|
|
|
|
|
|
|
|
# Source project function libraries
|
|
|
|
source $TOP_DIR/lib/infra
|
|
|
|
source $TOP_DIR/lib/oslo
|
2014-10-31 15:01:29 -04:00
|
|
|
source $TOP_DIR/lib/lvm
|
2014-01-16 18:16:48 -06:00
|
|
|
source $TOP_DIR/lib/horizon
|
2013-05-22 17:19:06 -05:00
|
|
|
source $TOP_DIR/lib/keystone
|
|
|
|
source $TOP_DIR/lib/glance
|
|
|
|
source $TOP_DIR/lib/nova
|
2016-07-12 19:34:09 +00:00
|
|
|
source $TOP_DIR/lib/placement
|
2014-01-16 18:16:48 -06:00
|
|
|
source $TOP_DIR/lib/cinder
|
2012-11-29 14:19:41 +01:00
|
|
|
source $TOP_DIR/lib/swift
|
2016-05-03 09:03:09 -04:00
|
|
|
source $TOP_DIR/lib/neutron
|
2014-01-16 18:16:48 -06:00
|
|
|
source $TOP_DIR/lib/ldap
|
2014-09-08 08:58:58 +00:00
|
|
|
source $TOP_DIR/lib/dstat
|
2017-03-14 07:05:19 -04:00
|
|
|
source $TOP_DIR/lib/etcd3
|
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
|
|
|
|
|
2014-12-18 09:44:56 -05:00
|
|
|
load_plugin_settings
|
|
|
|
|
2016-02-03 06:58:39 -05:00
|
|
|
set -o xtrace
|
|
|
|
|
2013-01-09 13:42:03 -06:00
|
|
|
# Run extras
|
|
|
|
# ==========
|
|
|
|
|
2013-10-15 09:42:43 -05:00
|
|
|
# Phase: unstack
|
2014-12-18 09:44:56 -05:00
|
|
|
run_phase unstack
|
2013-01-09 13:42:03 -06:00
|
|
|
|
2013-05-22 17:19:06 -05:00
|
|
|
# Call service stop
|
|
|
|
|
|
|
|
if is_service_enabled nova; then
|
|
|
|
stop_nova
|
2020-01-15 10:58:29 +09:00
|
|
|
cleanup_nova
|
2013-05-22 17:19:06 -05:00
|
|
|
fi
|
|
|
|
|
2016-07-12 19:34:09 +00:00
|
|
|
if is_service_enabled placement; then
|
|
|
|
stop_placement
|
|
|
|
fi
|
|
|
|
|
2014-01-15 15:04:49 -06:00
|
|
|
if is_service_enabled glance; then
|
2013-05-22 17:19:06 -05:00
|
|
|
stop_glance
|
|
|
|
fi
|
|
|
|
|
2015-02-12 22:18:33 -06:00
|
|
|
if is_service_enabled keystone; then
|
2013-05-22 17:19:06 -05:00
|
|
|
stop_keystone
|
2013-08-04 19:53:19 -05:00
|
|
|
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
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2014-06-25 15:29:43 +01:00
|
|
|
# Kill TLS proxies and cleanup certificates
|
2012-11-29 11:47:58 -06:00
|
|
|
if is_service_enabled tls-proxy; then
|
2014-06-25 15:29:43 +01:00
|
|
|
stop_tls_proxy
|
|
|
|
cleanup_CA
|
2012-11-29 11:47:58 -06:00
|
|
|
fi
|
|
|
|
|
2012-09-11 14:15:54 -06:00
|
|
|
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
|
|
|
|
|
2015-02-04 12:44:18 -05:00
|
|
|
# BUG: tgt likes to exit 1 on service stop if everything isn't
|
|
|
|
# perfect, we should clean up cinder stop paths.
|
|
|
|
|
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
|
2015-02-04 12:44:18 -05:00
|
|
|
stop_cinder || /bin/true
|
|
|
|
cleanup_cinder || /bin/true
|
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
|
|
|
|
2019-10-17 19:34:05 +00: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
|
|
|
|
cleanup_neutron
|
2012-07-18 07:43:01 -04:00
|
|
|
fi
|
2013-07-16 13:36:34 +10:00
|
|
|
|
2017-03-14 07:05:19 -04:00
|
|
|
if is_service_enabled etcd3; then
|
|
|
|
stop_etcd3
|
|
|
|
cleanup_etcd3
|
|
|
|
fi
|
|
|
|
|
2015-03-23 15:19:57 +09:00
|
|
|
if is_service_enabled dstat; then
|
|
|
|
stop_dstat
|
|
|
|
fi
|
2014-08-20 00:34:55 -07:00
|
|
|
|
2015-05-29 11:38:22 +02:00
|
|
|
# NOTE: Cinder automatically installs the lvm2 package, independently of the
|
2016-09-01 02:07:12 -07:00
|
|
|
# enabled backends. So if Cinder is enabled, and installed successfully we are
|
|
|
|
# sure lvm2 (lvremove, /etc/lvm/lvm.conf, etc.) is here.
|
|
|
|
if is_service_enabled cinder && is_package_installed lvm2; then
|
2015-05-29 11:38:22 +02:00
|
|
|
clean_lvm_filter
|
|
|
|
fi
|
2020-09-01 14:11:45 +00:00
|
|
|
|
|
|
|
clean_pyc_files
|
2021-01-19 12:10:52 -08:00
|
|
|
rm -Rf $DEST/async
|