Whamcloud - gitweb
LU-15496 tests: fix sanity/398c to use proper OSC name
authorAndreas Dilger <adilger@whamcloud.com>
Thu, 16 May 2024 19:57:42 +0000 (21:57 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Thu, 6 Jun 2024 08:05:41 +0000 (08:05 +0000)
For ppc64le and aarch64 clients, the OSC import instance name does
not have "ffff" at the start, so use the proper device name for this
subtest.

Clean up the rest of test_398c to meet modern test code style.

Also add debugging to sanity/398c from #53462.

Lustre-change: https://review.whamcloud.com/55132
Lustre-commit: b1b57bcadeeb5a87ac75387c4aa4ae084e1a27e0

Lustre-change: https://review.whamcloud.com/53462
Lustre-commit: 304ca31e2aa15c576e468a86e45d8817c8eca391

Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: If8c72fa9b13eace009f39daf82454221eba6761b
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Reviewed-by: Alex Deiter
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/55313
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lustre/tests/sanity.sh

index de8cfe5..df18e54 100644 (file)
@@ -25918,19 +25918,18 @@ test_398b() { # LU-4198
 run_test 398b "DIO and buffer IO race"
 
 test_398c() { # LU-4198
-       local ost1_imp=$(get_osc_import_name client ost1)
-       local imp_name=$($LCTL list_param osc.$ost1_imp | head -n1 |
-                        cut -d'.' -f2)
+       local ost1_imp="osc.$(get_osc_import_name client ost1)"
+       local imp_name=($($LCTL list_param $ost1_imp | cut -d'.' -f2))
 
        which fio || skip_env "no fio installed"
 
        saved_debug=$($LCTL get_param -n debug)
        $LCTL set_param debug=0
 
-       local size=$(lctl get_param -n osc.$FSNAME-OST0000*.kbytesavail | head -1)
-       ((size /= 1024)) # by megabytes
-       ((size /= 2)) # write half of the OST at most
-       [ $size -gt 40 ] && size=40 #reduce test time anyway
+       local size=($($LCTL get_param -n $ost1_imp.kbytesavail))
+       (( size /= 1024 )) # by megabytes
+       (( size /= 2 )) # write half of the OST at most
+       (( size <= 40 )) || size=40 #reduce test time anyway
 
        $LFS setstripe -c 1 $DIR/$tfile
 
@@ -25940,7 +25939,7 @@ test_398c() { # LU-4198
        cancel_lru_locks osc
 
        # clear and verify rpc_stats later
-       $LCTL set_param osc.${FSNAME}-OST0000-osc-ffff*.rpc_stats=clear
+       $LCTL set_param $ost1_imp.rpc_stats=clear
 
        local njobs=4
        echo "writing ${size}M to OST0 by fio with $njobs jobs..."
@@ -25950,14 +25949,17 @@ test_398c() { # LU-4198
                --filename=$DIR/$tfile
        [ $? -eq 0 ] || error "fio write error"
 
-       [ $($LCTL get_param -n ldlm.namespaces.$imp_name.lock_count) -eq 0 ] ||
+       (( $($LCTL get_param -n ldlm.namespaces.$imp_name.lock_count) == 0 )) ||
                error "Locks were requested while doing AIO"
 
        # get the percentage of 1-page I/O
        pct=$($LCTL get_param osc.${imp_name}.rpc_stats |
                grep -A 1 'pages per rpc' | grep -v 'pages per rpc' |
                awk '{print $7}')
-       [ $pct -le 50 ] || error "$pct% of I/O are 1-page"
+       (( $pct <= 50 )) || {
+               $LCTL get_param osc.${imp_name}.rpc_stats
+               error "$pct% of I/O are 1-page"
+       }
 
        echo "mix rw ${size}M to OST0 by fio with $njobs jobs..."
        fio --name=rand-rw --rw=randrw --bs=$PAGE_SIZE --direct=1 \