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

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