Merge "Made Swift backing disk persistent"
This commit is contained in:
commit
8339df0399
32
lib/swift
32
lib/swift
@ -179,12 +179,9 @@ function is_swift_enabled {
|
|||||||
# cleanup_swift() - Remove residual data files
|
# cleanup_swift() - Remove residual data files
|
||||||
function cleanup_swift {
|
function cleanup_swift {
|
||||||
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
rm -f ${SWIFT_CONF_DIR}{*.builder,*.ring.gz,backups/*.builder,backups/*.ring.gz}
|
||||||
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
||||||
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
destroy_disk ${SWIFT_DISK_IMAGE} ${SWIFT_DATA_DIR}/drives/sdb1
|
||||||
fi
|
|
||||||
if [[ -e ${SWIFT_DISK_IMAGE} ]]; then
|
|
||||||
rm ${SWIFT_DISK_IMAGE}
|
|
||||||
fi
|
|
||||||
rm -rf ${SWIFT_DATA_DIR}/run/
|
rm -rf ${SWIFT_DATA_DIR}/run/
|
||||||
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
|
if [ "$SWIFT_USE_MOD_WSGI" == "True" ]; then
|
||||||
_cleanup_swift_apache_wsgi
|
_cleanup_swift_apache_wsgi
|
||||||
@ -575,28 +572,7 @@ function create_swift_disk {
|
|||||||
sudo install -d -o ${STACK_USER} -g ${user_group} ${SWIFT_DATA_DIR}/{drives,cache,run,logs}
|
sudo install -d -o ${STACK_USER} -g ${user_group} ${SWIFT_DATA_DIR}/{drives,cache,run,logs}
|
||||||
|
|
||||||
# Create a loopback disk and format it to XFS.
|
# Create a loopback disk and format it to XFS.
|
||||||
if [[ -e ${SWIFT_DISK_IMAGE} ]]; then
|
create_disk ${SWIFT_DISK_IMAGE} ${SWIFT_DATA_DIR}/drives/sdb1 ${SWIFT_LOOPBACK_DISK_SIZE}
|
||||||
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
||||||
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
sudo rm -f ${SWIFT_DISK_IMAGE}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p ${SWIFT_DATA_DIR}/drives/images
|
|
||||||
sudo touch ${SWIFT_DISK_IMAGE}
|
|
||||||
sudo chown ${STACK_USER}: ${SWIFT_DISK_IMAGE}
|
|
||||||
|
|
||||||
truncate -s ${SWIFT_LOOPBACK_DISK_SIZE} ${SWIFT_DISK_IMAGE}
|
|
||||||
|
|
||||||
# Make a fresh XFS filesystem
|
|
||||||
/sbin/mkfs.xfs -f -i size=1024 ${SWIFT_DISK_IMAGE}
|
|
||||||
|
|
||||||
# Mount the disk with mount options to make it as efficient as possible
|
|
||||||
mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
|
||||||
sudo mount -t xfs -o loop,noatime,nodiratime,logbufs=8 \
|
|
||||||
${SWIFT_DISK_IMAGE} ${SWIFT_DATA_DIR}/drives/sdb1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create a link to the above mount and
|
# Create a link to the above mount and
|
||||||
# create all of the directories needed to emulate a few different servers
|
# create all of the directories needed to emulate a few different servers
|
||||||
|
Loading…
Reference in New Issue
Block a user