Create new swift data store filesystem every time

The Swift data store was not cleaned out between stack.sh runs; although
the contents were not visible they were still taking up space.  Create a
new XFS filesystem on every stack.sh run.

Fixes bug 1000827

Change-Id: Ieab6b5f65b7964906f244975cbcdf2cf50344ca5
This commit is contained in:
Dean Troyer 2012-05-17 11:10:36 -05:00
parent 461203b2c8
commit 00edc95c6b

View File

@ -1347,16 +1347,20 @@ if is_service_enabled swift; then
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
# We then create a loopback disk and format it to XFS.
# TODO: Reset disks on new pass.
if [[ ! -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
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
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}
mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
fi
# Make a fresh XFS filesystem
mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
# After the drive being created we mount the disk with a few mount
# options to make it most efficient as possible for swift.