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

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