f1b7707f26
For issue RHEL-40729, patch 0142 fixes it. For issue RHEL-31448, patch 0125 fixes it. Resolves: RHEL-31448,RHEL-40729,RHEL-52059 Signed-off-by: Xiao Ni <xni@redhat.com>
104 lines
3.0 KiB
Diff
104 lines
3.0 KiB
Diff
From 23aef35113553cb97ef2e7b01c760d5449592e14 Mon Sep 17 00:00:00 2001
|
|
From: Xiao Ni <xni@redhat.com>
|
|
Date: Fri, 14 Jun 2024 10:45:01 +0800
|
|
Subject: [PATCH 107/201] mdadm/tests: judge foreign array in test cases
|
|
|
|
It needs to use array name when judging if one array is foreign or not.
|
|
So calling is_raid_foreign in test cases which need it.
|
|
|
|
Fixes: 41706a915684 ('mdadm/tests: names_template enhance')
|
|
Signed-off-by: Xiao Ni <xni@redhat.com>
|
|
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
|
|
---
|
|
tests/03assem-incr | 2 ++
|
|
tests/06name | 2 ++
|
|
tests/07autoassemble | 3 +++
|
|
tests/func.sh | 9 +++++----
|
|
tests/templates/names_template | 2 ++
|
|
5 files changed, 14 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/tests/03assem-incr b/tests/03assem-incr
|
|
index 21215a34..56afbf2c 100644
|
|
--- a/tests/03assem-incr
|
|
+++ b/tests/03assem-incr
|
|
@@ -12,6 +12,8 @@ if [ "$LINEAR" == "yes" ]; then
|
|
levels+=( linear )
|
|
fi
|
|
|
|
+is_raid_foreign $md0
|
|
+
|
|
for l in ${levels[@]}
|
|
do
|
|
mdadm -CR $md0 -l $l -n5 $dev0 $dev1 $dev2 $dev3 $dev4 --assume-clean
|
|
diff --git a/tests/06name b/tests/06name
|
|
index c3213f6c..9ec3437b 100644
|
|
--- a/tests/06name
|
|
+++ b/tests/06name
|
|
@@ -2,6 +2,8 @@ set -x
|
|
|
|
# create an array with a name
|
|
|
|
+is_raid_foreign $md0
|
|
+
|
|
mdadm -CR $md0 -l0 -n2 --metadata=1 --name="Fred" $dev0 $dev1
|
|
|
|
if [ $is_foreign == "no" ]; then
|
|
diff --git a/tests/07autoassemble b/tests/07autoassemble
|
|
index 9dc78149..b6630e17 100644
|
|
--- a/tests/07autoassemble
|
|
+++ b/tests/07autoassemble
|
|
@@ -2,6 +2,9 @@
|
|
# create two raid1s, build a raid0 on top, then
|
|
# tear it down and get auto-assemble to rebuild it.
|
|
|
|
+#the length of md0/md1/md2 is same. So use md0 here.
|
|
+is_raid_foreign $md0
|
|
+
|
|
mdadm -CR $md1 -l1 -n2 $dev0 $dev1 --homehost=testing
|
|
mdadm -CR $md2 -l1 -n2 $dev2 $dev3 --homehost=testing
|
|
mdadm -CR $md0 -l0 -n2 $md1 $md2 --homehost=testing
|
|
diff --git a/tests/func.sh b/tests/func.sh
|
|
index 8c142c76..e7ccc4fc 100644
|
|
--- a/tests/func.sh
|
|
+++ b/tests/func.sh
|
|
@@ -181,10 +181,12 @@ restore_system_speed_limit() {
|
|
|
|
is_raid_foreign() {
|
|
|
|
- # If the length of hostname is >= 32, super1 doesn't use
|
|
- # hostname in metadata
|
|
+ name=$1
|
|
+ # super1 uses this formula strlen(homehost)+1+strlen(name) < 32
|
|
+ # to decide if an array is foreign or local. It adds homehost if
|
|
+ # one array is local
|
|
hostname=$(hostname)
|
|
- if [ `expr length $(hostname)` -lt 32 ]; then
|
|
+ if [ `expr length "$(hostname)$name"` -lt 31 ]; then
|
|
is_foreign="no"
|
|
else
|
|
is_foreign="yes"
|
|
@@ -299,7 +301,6 @@ do_setup() {
|
|
[ -f /proc/mdstat ] || modprobe md_mod
|
|
echo 0 > /sys/module/md_mod/parameters/start_ro
|
|
record_system_speed_limit
|
|
- is_raid_foreign
|
|
record_selinux
|
|
}
|
|
|
|
diff --git a/tests/templates/names_template b/tests/templates/names_template
|
|
index 88ad5b8c..c94245ea 100644
|
|
--- a/tests/templates/names_template
|
|
+++ b/tests/templates/names_template
|
|
@@ -4,6 +4,8 @@ function names_create() {
|
|
local NAME=$2
|
|
local NEG_TEST=$3
|
|
|
|
+ is_raid_foreign $DEVNAME
|
|
+
|
|
if [[ -z "$NAME" ]]; then
|
|
mdadm -CR "$DEVNAME" -l0 -n 1 $dev0 --force
|
|
else
|
|
--
|
|
2.41.0
|
|
|