From 43eb0b3159d8ad1eb14e0430124cc72cb50ae3c2 Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Sat, 12 Jan 2013 20:10:34 +0000 Subject: [PATCH] Make sure to cleanup swift on unstack/relaunch. - Fixes bug 1049553. Change-Id: I9fef93d25512c014dfb882adf0e169487bf877d8 --- lib/swift | 15 ++++++++------- unstack.sh | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/swift b/lib/swift index b418eda863..aff4596783 100644 --- a/lib/swift +++ b/lib/swift @@ -107,16 +107,17 @@ function configure_swift() { if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then sudo umount ${SWIFT_DATA_DIR}/drives/sdb1 + sudo rm -f ${SWIFT_DATA_DIR}/drives/images/swift.img fi - else - mkdir -p ${SWIFT_DATA_DIR}/drives/images - sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img - sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img - - dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \ - bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE} fi + mkdir -p ${SWIFT_DATA_DIR}/drives/images + sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img + sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img + + dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \ + bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE} + # Make a fresh XFS filesystem mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img diff --git a/unstack.sh b/unstack.sh index 1d4bfd56f1..a086d5c620 100755 --- a/unstack.sh +++ b/unstack.sh @@ -65,6 +65,7 @@ fi # Swift runs daemons if is_service_enabled swift; then stop_swift + cleanup_swift fi # Apache has the WSGI processes