
Use stop swift from lib Change-Id: I683da7c78fdd7881708e45a3579a7ee7a9a4a4e9 Fixes: Bug 1183111
84 lines
2.1 KiB
Bash
Executable File
84 lines
2.1 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
|
|
|
|
|
|
# Duplicate some setup bits from base DevStack
|
|
source $BASE_DEVSTACK_DIR/stackrc
|
|
DATA_DIR=${STACK_ROOT}/data
|
|
|
|
source $BASE_DEVSTACK_DIR/lib/cinder
|
|
source $BASE_DEVSTACK_DIR/lib/swift
|
|
|
|
# For debugging
|
|
set -o xtrace
|
|
|
|
echo "Shutting down devstack in screen"
|
|
|
|
# Shut down running processes in screen - most of them
|
|
SCREEN=$(which screen)
|
|
if [[ -n "$SCREEN" ]]; then
|
|
SESSION=$(screen -ls | awk "/[0-9].${SCREEN_NAME}/ { print \$1 }")
|
|
if [[ -n "$SESSION" ]]; then
|
|
screen -X -S $SESSION quit
|
|
sleep 2
|
|
fi
|
|
fi
|
|
|
|
# Swift runs daemons
|
|
if is_service_enabled swift; then
|
|
stop_swift
|
|
fi
|
|
|
|
# Handle iSCSI targets here...don't delete, just stop
|
|
if [[ "$os_PACKAGE" = "deb" ]]; then
|
|
stop_service tgt
|
|
else
|
|
stop_service tgtd
|
|
fi
|
|
|
|
# Unplumb the LVM backing file
|
|
sudo vgchange -a n stack-volumes
|
|
DEV=$(sudo losetup -j $DATA_DIR/${VOLUME_GROUP}-backing-file | awk -F':' '/backing-file/ { print $1 }')
|
|
|
|
if [[ "x" != "x$DEV" ]]; then
|
|
sudo losetup -d $DEV
|
|
else
|
|
echo "No device for backing volume"
|
|
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
|