Whamcloud - gitweb
LU-10488 tests: saved and restore layout for dom test 36/30836/2
authorJinshan Xiong <jinshan.xiong@intel.com>
Thu, 11 Jan 2018 17:47:07 +0000 (17:47 +0000)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 11 Jan 2018 22:10:35 +0000 (22:10 +0000)
Some features like FLR and quota are still not supported by dom.
It will cause failures when dom is enabled when the corresponding
test cases are running.

This patch saves and restores default layout before and after
sanity-dom runs.

Test-Parameters: trivial envdefinitions=SLOW=yes,ENABLE_QUOTA=yes testlist=sanity-dom,sanity-flr,sanity-quota
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: I69752c3c48e3edf32ff22399af32b67c718f8e0e
Reviewed-on: https://review.whamcloud.com/30836
Tested-by: Jenkins
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/tests/sanity-dom.sh
lustre/tests/test-framework.sh

index 6df949b..765b9bc 100644 (file)
@@ -39,13 +39,18 @@ DOM="yes"
 DOM_SIZE=${DOM_SIZE:-"$((1024*1024))"}
 OSC="mdc"
 
-lfs setstripe -E $DOM_SIZE -L mdt -E EOF $DIR1
+trap restore_default_layout EXIT
+restore_default_layout() {
+       [ -n "$saved_layout" ] && restore_layout $DIR1 $saved_layout ||
+               $LFS setstripe -d $DIR1
+}
+
+saved_layout=$(save_layout $DIR1)
+$LFS setstripe -E $DOM_SIZE -L mdt -E EOF $DIR1
 
 mkdir -p $MOUNT2
 mount_client $MOUNT2
 
-lctl set_param debug=0xffffffff 2> /dev/null
-
 test_1() {
        dd if=/dev/zero of=$DIR1/$tfile bs=7k count=1 || error "write 1"
        $TRUNCATE $DIR2/$tfile 1000 || error "truncate"
index ddcaccc..1ca4b45 100755 (executable)
@@ -5719,7 +5719,7 @@ check_grant() {
        server_grant=$(do_nodes $(comma_list $(osts_nodes)) \
                "$LCTL get_param "\
                "obdfilter.${FSNAME}-OST*.{tot_granted,tot_pending,grant_precreate}" |
-               sed 's/=/ /'| awk '/tot_granted/{ total += $2 }; 
+               sed 's/=/ /'| awk '/tot_granted/{ total += $2 };
                                /tot_pending/{ total -= $2 };
                                /grant_precreate/{ total -= $2 };
                                END { printf("%0.0f", total) }')
@@ -8437,7 +8437,7 @@ lfsck_verify_pfid()
         # controllable
        cancel_lru_locks mdc
        cancel_lru_locks osc
-        
+
        # make sure PFID is set correctly for files
        do_nodes $(comma_list $(osts_nodes)) \
               "$LCTL set_param -n obdfilter.${FSNAME}-OST*.lfsck_verify_pfid=1"
@@ -8489,3 +8489,20 @@ check_clients_full() {
                [ $? -eq 0 ] || error "$osc state is not FULL"
        done
 }
+
+restore_layout() {
+       local dir=$1
+       local layout=$2
+
+       [ -z "$layout" ] && return
+
+       setfattr -n trusted.lov -v $layout $dir ||
+               error "error restoring layout \"$layout\" to \"$dir\""
+}
+
+save_layout() {
+       local dir=$1
+       local str=$(getfattr -n trusted.lov --absolute-names -e hex $dir |
+                       awk -F'=' '/trusted.lov/{print $2}')
+       echo "$str"
+}