- ${SWIFT_DATA_DIR}/drives/images/swift.img replaced by
${SWIFT_DISK_IMAGE}.
- using truncate -s command instead of dd over seeking
Change-Id: I0dd29af3247ba7819ef0c74775412074b6b62017
| ... | ... |
@@ -39,6 +39,7 @@ SWIFT3_DIR=$DEST/swift3 |
| 39 | 39 |
# Set ``SWIFT_DATA_DIR`` to the location of swift drives and objects. |
| 40 | 40 |
# Default is the common DevStack data directory. |
| 41 | 41 |
SWIFT_DATA_DIR=${SWIFT_DATA_DIR:-${DATA_DIR}/swift}
|
| 42 |
+SWIFT_DISK_IMAGE=${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 42 | 43 |
|
| 43 | 44 |
# Set ``SWIFT_CONF_DIR`` to the location of the configuration files. |
| 44 | 45 |
# Default is ``/etc/swift``. |
| ... | ... |
@@ -55,10 +56,10 @@ fi |
| 55 | 55 |
# swift data. Set ``SWIFT_LOOPBACK_DISK_SIZE`` to the disk size in |
| 56 | 56 |
# kilobytes. |
| 57 | 57 |
# Default is 1 gigabyte. |
| 58 |
-SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=1048576 |
|
| 58 |
+SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=1G |
|
| 59 | 59 |
# if tempest enabled the default size is 4 Gigabyte. |
| 60 | 60 |
if is_service_enabled tempest; then |
| 61 |
- SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=${SWIFT_LOOPBACK_DISK_SIZE:-4194304}
|
|
| 61 |
+ SWIFT_LOOPBACK_DISK_SIZE_DEFAULT=${SWIFT_LOOPBACK_DISK_SIZE:-4G}
|
|
| 62 | 62 |
fi |
| 63 | 63 |
|
| 64 | 64 |
SWIFT_LOOPBACK_DISK_SIZE=${SWIFT_LOOPBACK_DISK_SIZE:-$SWIFT_LOOPBACK_DISK_SIZE_DEFAULT}
|
| ... | ... |
@@ -103,8 +104,8 @@ function cleanup_swift() {
|
| 103 | 103 |
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
| 104 | 104 |
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
| 105 | 105 |
fi |
| 106 |
- if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
|
|
| 107 |
- rm ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 106 |
+ if [[ -e ${SWIFT_DISK_IMAGE} ]]; then
|
|
| 107 |
+ rm ${SWIFT_DISK_IMAGE}
|
|
| 108 | 108 |
fi |
| 109 | 109 |
rm -rf ${SWIFT_DATA_DIR}/run/
|
| 110 | 110 |
if is_apache_enabled_service swift; then |
| ... | ... |
@@ -409,28 +410,27 @@ function create_swift_disk() {
|
| 409 | 409 |
sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
|
| 410 | 410 |
|
| 411 | 411 |
# Create a loopback disk and format it to XFS. |
| 412 |
- if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
|
|
| 412 |
+ if [[ -e ${SWIFT_DISK_IMAGE} ]]; then
|
|
| 413 | 413 |
if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
| 414 | 414 |
sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
|
| 415 |
- sudo rm -f ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 415 |
+ sudo rm -f ${SWIFT_DISK_IMAGE}
|
|
| 416 | 416 |
fi |
| 417 | 417 |
fi |
| 418 | 418 |
|
| 419 | 419 |
mkdir -p ${SWIFT_DATA_DIR}/drives/images
|
| 420 |
- sudo touch ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 421 |
- sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 420 |
+ sudo touch ${SWIFT_DISK_IMAGE}
|
|
| 421 |
+ sudo chown $USER: ${SWIFT_DISK_IMAGE}
|
|
| 422 | 422 |
|
| 423 |
- dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
|
|
| 424 |
- bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
|
|
| 423 |
+ truncate -s ${SWIFT_LOOPBACK_DISK_SIZE} ${SWIFT_DISK_IMAGE}
|
|
| 425 | 424 |
|
| 426 | 425 |
# Make a fresh XFS filesystem |
| 427 |
- mkfs.xfs -f -i size=1024 ${SWIFT_DATA_DIR}/drives/images/swift.img
|
|
| 426 |
+ mkfs.xfs -f -i size=1024 ${SWIFT_DISK_IMAGE}
|
|
| 428 | 427 |
|
| 429 | 428 |
# Mount the disk with mount options to make it as efficient as possible |
| 430 | 429 |
mkdir -p ${SWIFT_DATA_DIR}/drives/sdb1
|
| 431 | 430 |
if ! egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
|
| 432 | 431 |
sudo mount -t xfs -o loop,noatime,nodiratime,nobarrier,logbufs=8 \ |
| 433 |
- ${SWIFT_DATA_DIR}/drives/images/swift.img ${SWIFT_DATA_DIR}/drives/sdb1
|
|
| 432 |
+ ${SWIFT_DISK_IMAGE} ${SWIFT_DATA_DIR}/drives/sdb1
|
|
| 434 | 433 |
fi |
| 435 | 434 |
|
| 436 | 435 |
# Create a link to the above mount and |