Whamcloud - gitweb
LU-13635 lfs: add -D option back to lfs_migrate 40/38840/3
authorEmoly Liu <emoly@whamcloud.com>
Fri, 5 Jun 2020 03:39:37 +0000 (11:39 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 16 Jun 2020 02:21:39 +0000 (02:21 +0000)
Enable "-D" option with its long option "--non-direct" correctly
in lfs_migrate.
sanity.sh test_56we is added to verify this patch.

Test-Parameters: trivial
Signed-off-by: Emoly Liu <emoly@whamcloud.com>
Change-Id: I6ab051c0f2e0cde9de6a5b8ace8962cc293e7656
Reviewed-on: https://review.whamcloud.com/38840
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/scripts/lfs_migrate
lustre/tests/sanity.sh

index 6e78e99..f410840 100755 (executable)
@@ -121,7 +121,6 @@ OPT_PASSTHROUGH=()
 OPT_POOL=""
 OPT_RESTRIPE=false
 OPT_YES=false
-LFS_OPT_DIRECTIO=""
 OPT_AUTOSTRIPE=false
 OPT_STRIPE_COUNT=""
 OPT_STRIPE_SIZE=""
@@ -147,7 +146,7 @@ while [ -n "$*" ]; do
        -v|--verbose) OPT_DEBUG=true; ECHO=echo;;
        -y|--yes) OPT_YES=true;;
        -0) OPT_NULL=true;;
-       -b|--block|--non-block|--non-direct|--no-verify)
+       -b|--block|--non-block|--non-direct|-D|--no-verify)
           # Always pass non-layout options to 'lfs migrate'
           OPT_PASSTHROUGH+=("$arg");;
        --rsync) OPT_RSYNC=true;;
@@ -157,7 +156,6 @@ while [ -n "$*" ]; do
           OPT_LAYOUT+="$arg $2 "; shift;;
        --auto-stripe|-A) OPT_AUTOSTRIPE=true;;
        -C) OPT_CAP="$2"; shift;;
-       -D) LFS_OPT_DIRECTIO="-D";;
        -M|--min-free) OPT_MINFREE="$2"; shift;;
        -X|--max-free) OPT_MAXFREE="$2"; shift;;
        -c|--stripe-count) OPT_STRIPE_COUNT="$2"; shift;;
@@ -483,6 +481,7 @@ lfs_migrate() {
 
                # first try to migrate via Lustre tools, then fall back to rsync
                if ! $OPT_RSYNC; then
+                       $OPT_DEBUG && echo -e "\n$LFS migrate $layout $OLDNAME"
                        if $LFS migrate $layout "$OLDNAME"; then
                                $ECHO "done"
                                # no-op if hlinks empty for 1-link files
index 1e10a42..ac3f1aa 100755 (executable)
@@ -6796,6 +6796,24 @@ test_56wd() {
 }
 run_test 56wd "check lfs_migrate --rsync and --no-rsync work"
 
+test_56we() {
+       local td=$DIR/$tdir
+       local tf=$td/$tfile
+
+       test_mkdir $td || error "cannot create $td"
+       touch $tf || error "cannot touch $tf"
+
+       echo -n "Make sure --non-direct|-D works..."
+       $LFS_MIGRATE -y --non-direct -v $tf 2>&1 |
+               grep -q "lfs migrate --non-direct" ||
+               error "--non-direct option cannot work correctly"
+       $LFS_MIGRATE -y -D -v $tf 2>&1 |
+               grep -q "lfs migrate -D" ||
+               error "-D option cannot work correctly"
+       echo "done."
+}
+run_test 56we "check lfs_migrate --non-direct|-D support"
+
 test_56x() {
        [[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
        check_swap_layouts_support