From ea964031d7bdc6f31fccb7f136591b682eb35087 Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Wed, 10 Mar 2021 09:20:29 -0600 Subject: [PATCH] LU-14506 hsm: correct default stripe offset in import In lhsmtool_posix, when calling llapi_hsm_import(), pass a stripe offset of -1 rather than 0 to select the default. Add sanity-hsm test_11c() to check that a file may be imported to a directory with a default striping specifing a pool that does not include OST0000. Signed-off-by: John L. Hammond Change-Id: I40636c0620b2f9314eb13bf23a8cf6d02990f851 Reviewed-on: https://review.whamcloud.com/41978 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Yingjin Qian --- lustre/tests/sanity-hsm.sh | 12 ++++++++++++ lustre/utils/lhsmtool_posix.c | 11 ++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/lustre/tests/sanity-hsm.sh b/lustre/tests/sanity-hsm.sh index 12834df..be7276b 100755 --- a/lustre/tests/sanity-hsm.sh +++ b/lustre/tests/sanity-hsm.sh @@ -994,6 +994,18 @@ test_11b() { } run_test 11b "Import a deleted file using its FID" +test_11c() { + pool_add $TESTNAME || error "Pool creation failed" + pool_add_targets $TESTNAME 1 1 || error "pool_add_targets failed" + + mkdir -p $DIR/$tdir + $LFS setstripe -p "$TESTNAME" $DIR/$tdir + + copy2archive /etc/hosts $tdir/$tfile + copytool import $tdir/$tfile $DIR/$tdir/$tfile +} +run_test 11c "Import a file to a directory with a pool" + test_12a() { # test needs a running copytool copytool setup diff --git a/lustre/utils/lhsmtool_posix.c b/lustre/utils/lhsmtool_posix.c index 3a75678..707cbab 100644 --- a/lustre/utils/lhsmtool_posix.c +++ b/lustre/utils/lhsmtool_posix.c @@ -1477,9 +1477,14 @@ static int ct_import_one(const char *src, const char *dst) return 0; rc = llapi_hsm_import(dst, - opt.o_archive_id_used ? - opt.o_archive_id[0] : 0, - &st, 0, 0, 0, 0, NULL, &fid); + opt.o_archive_id_used ? opt.o_archive_id[0] : 0, + &st, + 0 /* default stripe_size */, + -1 /* default stripe offset */, + 0 /* default stripe count */, + 0 /* stripe pattern (will be RAID0+RELEASED) */, + NULL /* pool_name */, + &fid); if (rc < 0) { CT_ERROR(rc, "cannot import '%s' from '%s'", dst, src); return rc; -- 1.8.3.1