Skip to contentSkip to conversation

btrfs-progs: cli-tests: Convert non-raid filesystem to raid

PATCH In review Lakshmipathi.G 2 participants 3 messages Jan 29, 2017 – Apr 15, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 btrfs-progs: cli-tests: Convert non-raid filesystem to raid

Simple script to verify non-raid filesystem conversion.

---
 tests/cli-tests/005-convert-btrfs-to-raid/test.sh | 32 +++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100755 tests/cli-tests/005-convert-btrfs-to-raid/test.sh
tests/cli-tests/005-convert-btrfs-to-raid/test.sh new file +32 -0
new file mode 100755
index 0000000..96772de
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# convert non-raid btrfs to raid
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper
+prepare_test_dev 1g
+run_check truncate -s1g img
+
+run_check $TOP/mkfs.btrfs -f $IMAGE
+run_check_mount_test_dev
+
+loopdev=$(run_check_stdout $SUDO_HELPER losetup --partscan --find --show img)
+
+run_check $SUDO_HELPER $TOP/btrfs device add $loopdev $TEST_MNT
+run_check $SUDO_HELPER $TOP/btrfs balance start -dconvert=raid1 -mconvert=raid1 $TEST_MNT
+
+run_check_stdout $SUDO_HELPER $TOP/btrfs filesystem show $loopdev | grep "Total devices 2" -q
+if [ $? -ne 0 ]; then
+	run_check $SUDO_HELPER losetup -d $loopdev
+	rm -f img
+        _fail "Conversion from non-raid filesystem to raid failed."
+fi
+run_check_umount_test_dev
+
+# cleanup
+run_check $SUDO_HELPER losetup -d $loopdev
+rm -f img
Signature · 1 line
2.7.4
#1 lore raw
Quoted 1 line · Lakshmipathi.G

Simple script to verify non-raid filesystem conversion.

The cli (command line interface) tests are supposed to cover the common usecases from the point of option combinations etc, not really verifying the result. It would be good if you add more than just one simple test, especially for the balance filters. Adding the helpers to prepare the filesystem (number of devices, raid profiles) would be a good start. Some code for that is in the mkfs tests, but this belongs to the common scripts so we could easily use that.

#2 lore raw
Quoted 10 lines · David Sterba
Quoted 1 line · Lakshmipathi.G

Simple script to verify non-raid filesystem conversion.

The cli (command line interface) tests are supposed to cover the common usecases from the point of option combinations etc, not really verifying the result. It would be good if you add more than just one simple test, especially for the balance filters. Adding the helpers to prepare the filesystem (number of devices, raid profiles) would be a good start. Some code for that is in the mkfs tests, but this belongs to the common scripts so we could easily use that.

Ok. I'll try to add helpers to common. So that option like this can be re-used easily.

Cheers.
Lakshmipathi.G