dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0017-mdadm-tests-add-one-test-case-for-failfast-of-raid1.patch

5d5466
From 76b906d2406cdf136f64de77e881eb2d180108d9 Mon Sep 17 00:00:00 2001
5d5466
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
5d5466
Date: Fri, 7 Dec 2018 14:30:09 +0100
5d5466
Subject: [RHEL7.7 PATCH 17/24] mdadm/tests: add one test case for failfast of
5d5466
 raid1
5d5466
5d5466
This creates raid1 device with the failfast option and check all
5d5466
slaves have the failfast flag. And it does assembling and growing
5d5466
the raid1 device and check the failfast works fine.
5d5466
5d5466
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
5d5466
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
5d5466
---
5d5466
 tests/05r1-failfast | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++++
5d5466
 1 file changed, 74 insertions(+)
5d5466
 create mode 100644 tests/05r1-failfast
5d5466
5d5466
diff --git a/tests/05r1-failfast b/tests/05r1-failfast
5d5466
new file mode 100644
5d5466
index 0000000..823dd6f
5d5466
--- /dev/null
5d5466
+++ b/tests/05r1-failfast
5d5466
@@ -0,0 +1,74 @@
5d5466
+
5d5466
+# create a simple mirror and check failfast flag works
5d5466
+mdadm -CR $md0 -e1.2 --level=raid1 --failfast -n2 $dev0 $dev1
5d5466
+check raid1
5d5466
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+
5d5466
+# Removing works with the failfast flag
5d5466
+mdadm $md0 -f $dev0
5d5466
+mdadm $md0 -r $dev0
5d5466
+if grep -v failfast /sys/block/md0/md/rd1/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+
5d5466
+# Adding works with the failfast flag
5d5466
+mdadm $md0 -a --failfast $dev0
5d5466
+check wait
5d5466
+if grep -v failfast /sys/block/md0/md/rd0/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+
5d5466
+mdadm -S $md0
5d5466
+
5d5466
+# Assembling works with the failfast flag
5d5466
+mdadm -A $md0 $dev0 $dev1
5d5466
+check raid1
5d5466
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+
5d5466
+# Adding works with the nofailfast flag
5d5466
+mdadm $md0 -f $dev0
5d5466
+mdadm $md0 -r $dev0
5d5466
+mdadm $md0 -a --nofailfast $dev0
5d5466
+check wait
5d5466
+if grep failfast /sys/block/md0/md/rd0/state > /dev/null
5d5466
+then
5d5466
+   die "failfast should be missing"
5d5466
+fi
5d5466
+
5d5466
+# Assembling with one faulty slave works with the failfast flag
5d5466
+mdadm $md0 -f $dev0
5d5466
+mdadm $md0 -r $dev0
5d5466
+mdadm -S $md0
5d5466
+mdadm -A $md0 $dev0 $dev1
5d5466
+check raid1
5d5466
+mdadm -S $md0
5d5466
+
5d5466
+# Spare works with the failfast flag
5d5466
+mdadm -CR $md0 -e1.2 --level=raid1 --failfast -n2 $dev0 $dev1
5d5466
+check raid1
5d5466
+mdadm $md0 -a --failfast $dev2
5d5466
+check wait
5d5466
+check spares 1
5d5466
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+
5d5466
+# Grow works with the failfast flag
5d5466
+mdadm -G $md0 --raid-devices=3
5d5466
+check wait
5d5466
+if grep -v failfast /sys/block/md0/md/rd*/state > /dev/null
5d5466
+then
5d5466
+   die "failfast missing"
5d5466
+fi
5d5466
+mdadm -S $md0
5d5466
+
5d5466
+exit 0
5d5466
-- 
5d5466
2.7.5
5d5466