Skip to content

Commit

Permalink
[US2662] check if underlying filesystem supports extents mapping. (#105)
Browse files Browse the repository at this point in the history
Signed-off-by: Utkarsh Mani Tripathi <[email protected]>
  • Loading branch information
utkarshmani1997 authored and payes committed Aug 28, 2018
1 parent 52e8a1d commit d226dfe
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
44 changes: 43 additions & 1 deletion ci/start_init_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -893,16 +893,58 @@ verify_clone_status() {
echo "0"
}

# test_extent_support_file_system tests whether the file system supports
# extent mapping. If it doesnot replica will error out.
# Creating a file system of FAT type which doesn't support extent mapping.
test_extent_support_file_system() {
echo "-----------Run_extent_supported_file_system_test-------------"
mkdir -p /tmp/vol1
# create a file
truncate -s 2100M testfat
# losetup is used to associate block device
# get the free device
device=$(sudo losetup -f)
# attach the loopback device with regular disk file testfat
losetup $device testfat
# create a FAT file system
mkfs.fat testfat
# mount as a block device in /tmp/vol1
mount $device /tmp/vol1

orig_controller_id=$(start_controller "$CONTROLLER_IP" "store1" "1")
replica1_id=$(start_replica "$CONTROLLER_IP" "$REPLICA_IP1" "vol1")
sleep 5

verify_replica_cnt "0" "Zero replica count test1"

error=$(docker logs $replica1_id 2>&1 | grep -w "underlying file system does not support extent mapping")
count=$(echo $error | wc -l)

if [ "$count" -eq 0 ]; then
echo "extent supported file system test failed"
umount /tmp/vol1
losetup -d $device
collect_logs_and_exit
else
echo "extent support file system test --passed"
fi
umount /tmp/vol1
losetup -d $device
cleanup
}


prepare_test_env
test_single_replica_stop_start
test_two_replica_delete
test_replica_ip_change
est_two_replica_stop_start
test_two_replica_stop_start
test_three_replica_stop_start
test_ctrl_stop_start
test_replica_reregistration
run_data_integrity_test
create_snapshot "$CONTROLLER_IP"
test_clone_feature
test_extent_support_file_system
run_vdbench_test_on_volume
run_libiscsi_test_suite
6 changes: 5 additions & 1 deletion replica/replica.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,11 @@ func construct(readonly bool, size, sectorSize int64, dir, head string, backingF
r.insertBackingFile()
r.ReplicaType = replicaType

PreloadLunMap(&r.volume)
if err := PreloadLunMap(&r.volume); err != nil {
logrus.Error("underlying file system does not support extent mapping")
return r, err
}

return r, r.writeVolumeMetaData(true, r.info.Rebuilding)
}

Expand Down

0 comments on commit d226dfe

Please sign in to comment.