
The existing GetOSVersion has a lot of unused code which is wrong in several ways - the only path tested in upstream CI is with lsb_release, because it's pre-installed on all nodes - the /etc/redhat-release checking probably still works, but is unnecessary - If using lsb_release, os_UPDATE has never actually been set. - the /etc/SuSE-release branch checking is broken if the lsb package is actually installed. lsb checking does not set os_UPDATE but yet the SuSE DISTRO setting relies on this to set a patch level (and so does some of the rpm tags). SuSE 11 is up to update 3, but the rpm matching is stuck hard-coded to update 2. I'm guessing installation is actually broken there. - the debian checking branch is broken. The VERSION tags have been removed and were not supposed to be relied on anyway (see notes in [1]) This simplifies things: - remove OSX checking (moved here after discussions in I31d0fdd30928ecc8d959a95838b1d3affd28ac6f) - only use the output of lsb_release. - A small best-effort check to pre-install lsb packages if not detected (that avoids chicken-egg-problem of package-install wrappers relying on os_* flags). - The unset os_UPDATE is removed. It's only previous use was for setting separate suse versions in the DISTRO element for matching during package installs (since removed) - DISTRO setting is modified to use the parts of os_RELEASE it wants. Per-above, this is the correct place to parse out specifics. - Call out the is_* functions, which are a better way to detect platforms - Export the variables as read-only, since they shouldn't be reset [1] http://sources.debian.net/src/base-files/7.5/debian/changelog/ Change-Id: I46a2c36d95327087085df07cb797eb91249a893c
197 lines
4.1 KiB
Bash
Executable File
197 lines
4.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# **unstack.sh**
|
|
|
|
# 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.
|
|
#
|
|
# Stop all processes by setting ``UNSTACK_ALL`` or specifying ``-a``
|
|
# on the command line
|
|
|
|
UNSTACK_ALL=""
|
|
|
|
while getopts ":a" opt; do
|
|
case $opt in
|
|
a)
|
|
UNSTACK_ALL=""
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# Keep track of the current DevStack directory.
|
|
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
|
FILES=$TOP_DIR/files
|
|
|
|
# Import common functions
|
|
source $TOP_DIR/functions
|
|
|
|
# Import database library
|
|
source $TOP_DIR/lib/database
|
|
|
|
# Load local configuration
|
|
source $TOP_DIR/openrc
|
|
|
|
# Destination path for service data
|
|
DATA_DIR=${DATA_DIR:-${DEST}/data}
|
|
|
|
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
|
|
|
|
|
|
# Configure Projects
|
|
# ==================
|
|
|
|
# Plugin Phase 0: override_defaults - allow plugins to override
|
|
# defaults before other services are run
|
|
run_phase override_defaults
|
|
|
|
# Import apache functions
|
|
source $TOP_DIR/lib/apache
|
|
|
|
# Import TLS functions
|
|
source $TOP_DIR/lib/tls
|
|
|
|
# Source project function libraries
|
|
source $TOP_DIR/lib/infra
|
|
source $TOP_DIR/lib/oslo
|
|
source $TOP_DIR/lib/lvm
|
|
source $TOP_DIR/lib/horizon
|
|
source $TOP_DIR/lib/keystone
|
|
source $TOP_DIR/lib/glance
|
|
source $TOP_DIR/lib/nova
|
|
source $TOP_DIR/lib/cinder
|
|
source $TOP_DIR/lib/swift
|
|
source $TOP_DIR/lib/heat
|
|
source $TOP_DIR/lib/neutron-legacy
|
|
source $TOP_DIR/lib/ldap
|
|
source $TOP_DIR/lib/dstat
|
|
source $TOP_DIR/lib/dlm
|
|
|
|
# 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
|
|
|
|
load_plugin_settings
|
|
|
|
# Determine what system we are running on. This provides ``os_VENDOR``,
|
|
# ``os_RELEASE``, ``os_PACKAGE``, ``os_CODENAME``
|
|
GetOSVersion
|
|
|
|
# Run extras
|
|
# ==========
|
|
|
|
# Phase: unstack
|
|
run_phase unstack
|
|
|
|
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
|
|
source $TOP_DIR/openrc
|
|
teardown_neutron_debug
|
|
fi
|
|
|
|
# Call service stop
|
|
|
|
if is_service_enabled heat; then
|
|
stop_heat
|
|
fi
|
|
|
|
if is_service_enabled nova; then
|
|
stop_nova
|
|
fi
|
|
|
|
if is_service_enabled glance; then
|
|
stop_glance
|
|
fi
|
|
|
|
if is_service_enabled keystone; then
|
|
stop_keystone
|
|
fi
|
|
|
|
# Swift runs daemons
|
|
if is_service_enabled s-proxy; then
|
|
stop_swift
|
|
cleanup_swift
|
|
fi
|
|
|
|
# Apache has the WSGI processes
|
|
if is_service_enabled horizon; then
|
|
stop_horizon
|
|
fi
|
|
|
|
# Kill TLS proxies and cleanup certificates
|
|
if is_service_enabled tls-proxy; then
|
|
stop_tls_proxy
|
|
cleanup_CA
|
|
fi
|
|
if [ "$USE_SSL" == "True" ]; then
|
|
cleanup_CA
|
|
fi
|
|
|
|
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
|
|
|
|
# BUG: tgt likes to exit 1 on service stop if everything isn't
|
|
# perfect, we should clean up cinder stop paths.
|
|
|
|
# Get the iSCSI volumes
|
|
if is_service_enabled cinder; then
|
|
stop_cinder || /bin/true
|
|
cleanup_cinder || /bin/true
|
|
fi
|
|
|
|
if [[ -n "$UNSTACK_ALL" ]]; then
|
|
# Stop MySQL server
|
|
if is_service_enabled mysql; then
|
|
stop_service mysql
|
|
fi
|
|
|
|
if is_service_enabled postgresql; then
|
|
stop_service postgresql
|
|
fi
|
|
|
|
# Stop rabbitmq-server
|
|
if is_service_enabled rabbit; then
|
|
stop_service rabbitmq-server
|
|
fi
|
|
fi
|
|
|
|
if is_service_enabled neutron; then
|
|
stop_neutron
|
|
stop_neutron_third_party
|
|
cleanup_neutron
|
|
fi
|
|
|
|
if is_service_enabled dstat; then
|
|
stop_dstat
|
|
fi
|
|
|
|
if is_service_enabled zookeeper; then
|
|
stop_zookeeper
|
|
fi
|
|
|
|
# Clean up the remainder of the screen processes
|
|
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
|
|
fi
|
|
|
|
# BUG: maybe it doesn't exist? We should isolate this further down.
|
|
# NOTE: Cinder automatically installs the lvm2 package, independently of the
|
|
# enabled backends. So if Cinder is enabled, we are sure lvm (lvremove,
|
|
# /etc/lvm/lvm.conf, etc.) is here.
|
|
if is_service_enabled cinder; then
|
|
clean_lvm_volume_group $DEFAULT_VOLUME_GROUP_NAME || /bin/true
|
|
clean_lvm_filter
|
|
fi
|