]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm/tests: 07autoassemble
authorXiao Ni <xni@redhat.com>
Wed, 22 May 2024 08:50:53 +0000 (16:50 +0800)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Fri, 24 May 2024 08:43:06 +0000 (10:43 +0200)
This test is used to test stacked array auto assemble.

There are two different cases depends on if array is foreign or not.
If the array is foreign, the stacked array (md0 is on md1 and md2)
can't be assembled with name md0. Because udev rule will run when md1
and md2 are assembled and mdadm -I doesn't specify homehost. So it
will treat stacked array (md0) as foreign array and choose md127 as
the device node name (/dev/md127)

Add the case that stacked array is local.

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
test
tests/07autoassemble
tests/07autoassemble.broken [deleted file]

diff --git a/test b/test
index f09994e781072cfe4e75a37af1d80ae10ca59617..4a88de58fdf5481a667848e0c872530498b167d8 100755 (executable)
--- a/test
+++ b/test
@@ -39,6 +39,8 @@ md2=/dev/md2
 # if user doesn't specify minor number, mdadm chooses minor number
 # automatically from 127.
 md127=/dev/md127
+md126=/dev/md126
+md125=/dev/md125
 mdp0=/dev/md_d0
 mdp1=/dev/md_d1
 
index e689be7c4a10422d95bd98905b5102dfbd16e87c..9dc78149707061011e60688751a45ff3d2089ea9 100644 (file)
@@ -10,7 +10,14 @@ mdadm -Ss
 mdadm -As -c /dev/null --homehost=testing -vvv
 testdev $md1 1 $mdsize1a 64
 testdev $md2 1 $mdsize1a 64
-testdev $md0 2 $mdsize11a 512
+# md1 and md2 will be incremental assemble by udev rule. And
+# the testing machines' hostname is not testing. The md0 will
+# be considered as a foreign array. It can use 0 as metadata
+# name. md127 will be used
+testdev $md127 2 $mdsize11a 512
+mdadm --stop $md127
+mdadm --zero-superblock $md1
+mdadm --zero-superblock $md2
 mdadm -Ss
 
 mdadm --zero-superblock $dev0 $dev1 $dev2 $dev3
@@ -20,5 +27,31 @@ mdadm -CR $md0 -l0 -n2 $md1 $dev2  --homehost=testing
 mdadm -Ss
 mdadm -As -c /dev/null --homehost=testing -vvv
 testdev $md1 1 $mdsize1a 64
-testdev $md0 1 $[mdsize1a+mdsize11a] 512
+testdev $md127 1 $[mdsize1a+mdsize11a] 512
+mdadm --stop $md127
+mdadm --zero-superblock $md1
+mdadm -Ss
+
+# Don't specify homehost when creating raid and use the test
+# machine's homehost. For super1.2, if homehost name's length
+# is > 32, it doesn't use homehost name in metadata name and
+# the array will be treated as foreign array
+mdadm --zero-superblock $dev0 $dev1 $dev2 $dev3
+mdadm -CR $md1 -l1 -n2 $dev0 $dev1
+mdadm -CR $md2 -l1 -n2 $dev2 $dev3
+mdadm -CR $md0 -l0 -n2 $md1 $md2
+mdadm -Ss
+mdadm -As -c /dev/null
+if [ $is_foreign == "yes" ]; then
+       # md127 is md1
+       testdev $md127 1 $mdsize1a 64
+       # md126 is md0, udev rule incremental assemble it
+       testdev $md126 2 $mdsize11a 512
+       # md125 is md2
+       testdev $md125 1 $mdsize1a 64
+else
+       testdev $md1 1 $mdsize1a 64
+       testdev $md2 1 $mdsize1a 64
+       testdev $md0 2 $mdsize11a 512
+fi
 mdadm -Ss
diff --git a/tests/07autoassemble.broken b/tests/07autoassemble.broken
deleted file mode 100644 (file)
index 8be0940..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-always fails
-
-Prints lots of messages, but the array doesn't assemble. Error
-possibly related to:
-
-  mdadm: /dev/md/1 is busy - skipping
-  mdadm: no recogniseable superblock on /dev/md/testing:0
-  mdadm: /dev/md/2 is busy - skipping