grenade/stop-base
Dean Troyer bc014ab131 Leave the VG alone
The configured volume group does not change during an upgrade.

This allows the generalized Cinder backend support to simply
utilize the existing LVM back-end in place rather than re-create
it after an upgrade.

Change-Id: I92d2b0c2dc6ea05dda3c8cf27e686a8eb98f326c
2014-07-07 09:33:41 -05:00

112 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# ``stop-base`` handles bringing down the base DevStack more gently
# than unstack.sh. We want to save the data so that it can be
# restarted under the target DevStack. This leaves /opt/stack/<base>/data
# in a state where it can be copied to the target directory.
# Keep track of the devstack directory
GRENADE_DIR=$(cd $(dirname "$0") && pwd)
# Import common functions
source $GRENADE_DIR/functions
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
# and ``DISTRO``
GetDistro
# Source params
source $GRENADE_DIR/grenaderc
# Set for DevStack compatibility
TOP_DIR=$TARGET_DEVSTACK_DIR
# Duplicate some setup bits from base DevStack
source $BASE_DEVSTACK_DIR/stackrc
DATA_DIR=${STACK_ROOT}/data
# We need base DevStack functions for this
source $BASE_DEVSTACK_DIR/functions
source $BASE_DEVSTACK_DIR/lib/tls
source $BASE_DEVSTACK_DIR/lib/apache
source $BASE_DEVSTACK_DIR/lib/keystone
source $BASE_DEVSTACK_DIR/lib/glance
source $BASE_DEVSTACK_DIR/lib/nova
source $BASE_DEVSTACK_DIR/lib/cinder
source $BASE_DEVSTACK_DIR/lib/swift
source $BASE_DEVSTACK_DIR/lib/neutron
source $BASE_DEVSTACK_DIR/lib/ceilometer
# For debugging
set -o xtrace
echo "Shutting down devstack in screen"
if is_service_enabled nova; then
stop_nova_rest
if ! [[ "$DO_NOT_UPGRADE_SERVICES" =~ "n-cpu" ]]; then
# IF n-cpu is on do not upgrade list, then do no stop it
stop_nova_compute
fi
fi
if is_service_enabled neutron; then
stop_neutron
stop_neutron_third_party
fi
if is_service_enabled glance; then
stop_glance
fi
if is_service_enabled key; then
stop_keystone
fi
if is_service_enabled ceilometer; then
stop_ceilometer
fi
# Swift runs daemons
if is_service_enabled s-proxy; then
stop_swift
fi
SCSI_PERSIST_DIR=$CINDER_STATE_PATH/volumes/*
# Get the iSCSI volumes
if is_service_enabled cinder; then
stop_cinder
fi
# Kill running processes
SCREEN=$(which screen)
if [[ -n "$SCREEN" ]]; then
for serv in ${ENABLED_SERVICES//,/ }; do
if [[ ! "$DO_NOT_UPGRADE_SERVICES" =~ "$serv" ]]; then
screen_stop $serv
fi
done
fi
# Unplumb the Swift data
sudo umount ${DATA_DIR}/swift/drives/images/swift.img || /bin/true
# ensure everything is shut down
STILL_RUNNING=""
for name in ${BASE_SERVICES}; do
if is_running ${name}; then
STILL_RUNNING="$STILL_RUNNING $name"
fi
done
if [[ -n "$STILL_RUNNING" ]]; then
echo "The following services are still running: $STILL_RUNNING"
# do a process dump at the end, just to see how bad things really are
ps auxw
exit 1
fi