Whamcloud - gitweb
LU-18582 tests: fix conf-sanity/82b random OST idx 31/57531/3
authorSergey Cheremencev <scherementsev@ddn.com>
Thu, 19 Dec 2024 15:26:24 +0000 (18:26 +0300)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Jan 2025 22:05:34 +0000 (22:05 +0000)
Sometimes (RANDOM * 2) % 65532 gives the
same results in a small selection. This
caused smaller number OSTs than requested
and resulted in a following failure:

 wait_update pool_list lustre.test_82b failed

Test-Parameters: trivial testlist=conf-sanity env=ONLY=82b
Signed-off-by: Sergey Cheremencev <scherementsev@ddn.com>
Change-Id: Iebaf2fedd52803eb918b4ee9c8111537930a6e38
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57531
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Artem Blagodarenko <ablagodarenko@ddn.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/tests/conf-sanity.sh

index a9f11e8..6c2d1a3 100755 (executable)
@@ -7296,6 +7296,27 @@ test_81() { # LU-4665
 }
 run_test 81 "sparse OST indexing"
 
+random_ost_indices() {
+       local num=$1
+       local LOV_V1_INSANE_STRIPE_COUNT=65532
+       local index
+       local skip
+       local i=0
+
+       while ((i < num)); do
+               skip=false
+
+               index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
+               for k in $ost_indices; do
+                       ((index == k)) && skip=true
+               done
+               $skip && continue
+               ost_indices+=" $index"
+               i=$((i+1))
+       done
+       echo $ost_indices
+}
+
 # Here we exercise the stripe placement functionality on a file system that
 # has formatted the OST with a random index. With the file system the following
 # functionality is tested:
@@ -7321,14 +7342,9 @@ test_82a() { # LU-4665
 
        # Format OSTs with random sparse indices.
        local i
-       local index
        local ost_indices
-       local LOV_V1_INSANE_STRIPE_COUNT=65532
-       for i in $(seq $OSTCOUNT); do
-               index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
-               ost_indices+=" $index"
-       done
-       ost_indices=$(comma_list $ost_indices)
+
+       ost_indices=$(comma_list $(random_ost_indices 3))
 
        stack_trap "restore_ostindex" EXIT
        echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"
@@ -7430,14 +7446,9 @@ test_82b() { # LU-4665
 
        # Format OSTs with random sparse indices.
        local i
-       local index
        local ost_indices
-       local LOV_V1_INSANE_STRIPE_COUNT=65532
-       for i in $(seq $OSTCOUNT); do
-               index=$(((RANDOM * 2) % LOV_V1_INSANE_STRIPE_COUNT))
-               ost_indices+=" $index"
-       done
-       ost_indices=$(comma_list $ost_indices)
+
+       ost_indices=$(comma_list $(random_ost_indices 4))
 
        stack_trap "restore_ostindex" EXIT
        echo -e "\nFormat $OSTCOUNT OSTs with sparse indices $ost_indices"