diff mbox series

[07/19] mdadm/tests: 03assem-incr enhance

Message ID 20240522085056.54818-8-xni@redhat.com (mailing list archive)
State Accepted
Headers show
Series mdadm/tests: enhance/fix regression cases | expand

Commit Message

Xiao Ni May 22, 2024, 8:50 a.m. UTC
It fails when hostname lenght > 32. Because the super1 metadata name
doesn't include hostname when hostname length > 32. Then mdadm thinks
the array is a foreign array if no device link is specified when
assembling the array. It chooses a minor number from 127.

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 test               |  3 +++
 tests/03assem-incr | 20 +++++++++++++-------
 2 files changed, 16 insertions(+), 7 deletions(-)

Comments

Mariusz Tkaczyk May 23, 2024, 2:39 p.m. UTC | #1
On Wed, 22 May 2024 16:50:44 +0800
Xiao Ni <xni@redhat.com> wrote:

> It fails when hostname lenght > 32. Because the super1 metadata name
> doesn't include hostname when hostname length > 32. Then mdadm thinks
> the array is a foreign array if no device link is specified when
> assembling the array. It chooses a minor number from 127.
> 
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---

LGTM.
Skipping for now, obvious conflict.

Thanks,
Mariusz
diff mbox series

Patch

diff --git a/test b/test
index 814ce1992b0c..1fce6be2c4a9 100755
--- a/test
+++ b/test
@@ -33,6 +33,9 @@  LVM_VOLGROUP=mdtest
 md0=/dev/md0
 md1=/dev/md1
 md2=/dev/md2
+# if user doesn't specify minor number, mdadm chooses minor number
+# automatically from 127.
+md127=/dev/md127
 mdp0=/dev/md_d0
 mdp1=/dev/md_d1
 
diff --git a/tests/03assem-incr b/tests/03assem-incr
index 38880a7fed10..21215a34f93b 100644
--- a/tests/03assem-incr
+++ b/tests/03assem-incr
@@ -9,15 +9,21 @@  set -x -e
 levels=(raid0 raid1 raid5)
 
 if [ "$LINEAR" == "yes" ]; then
-  levels+=( linear )
+	levels+=( linear )
 fi
 
 for l in ${levels[@]}
 do
-  mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean
-  mdadm -S md0
-  mdadm -I $dev1
-  mdadm -I $dev3
-  mdadm -A /dev/md0  $dev0 $dev1 $dev2 $dev3 $dev4
-  mdadm -S /dev/md0
+	mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean
+	mdadm -S $md0
+	mdadm -I $dev1
+	mdadm -I $dev3
+	mdadm -A $md0  $dev0 $dev1 $dev2 $dev3 $dev4
+	# If one array is foreign (metadata name doesn't have the machine's
+	# hostname), mdadm chooses a minor number automatically from 127
+	if [ $is_foreign == "no" ]; then
+		mdadm -S $md0
+	else
+		mdadm -S $md127
+	fi
 done