Browse code

Merge "Create new swift data store filesystem every time"

Jenkins authored on 2012/05/23 04:32:48
Showing 1 changed files
... ...
@@ -1362,16 +1362,20 @@ if is_service_enabled swift; then
1362 1362
     sudo chown -R $USER:${USER_GROUP} ${SWIFT_DATA_DIR}
1363 1363
 
1364 1364
     # We then create a loopback disk and format it to XFS.
1365
-    # TODO: Reset disks on new pass.
1366
-    if [[ ! -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
1365
+    if [[ -e ${SWIFT_DATA_DIR}/drives/images/swift.img ]]; then
1366
+        if egrep -q ${SWIFT_DATA_DIR}/drives/sdb1 /proc/mounts; then
1367
+            sudo umount ${SWIFT_DATA_DIR}/drives/sdb1
1368
+        fi
1369
+    else
1367 1370
         mkdir -p  ${SWIFT_DATA_DIR}/drives/images
1368 1371
         sudo touch  ${SWIFT_DATA_DIR}/drives/images/swift.img
1369 1372
         sudo chown $USER: ${SWIFT_DATA_DIR}/drives/images/swift.img
1370 1373
 
1371 1374
         dd if=/dev/zero of=${SWIFT_DATA_DIR}/drives/images/swift.img \
1372 1375
             bs=1024 count=0 seek=${SWIFT_LOOPBACK_DISK_SIZE}
1373
-        mkfs.xfs -f -i size=1024  ${SWIFT_DATA_DIR}/drives/images/swift.img
1374 1376
     fi
1377
+    # Make a fresh XFS filesystem
1378
+    mkfs.xfs -f -i size=1024  ${SWIFT_DATA_DIR}/drives/images/swift.img
1375 1379
 
1376 1380
     # After the drive being created we mount the disk with a few mount
1377 1381
     # options to make it most efficient as possible for swift.