Whamcloud - gitweb
LU-14506 hsm: correct default stripe offset in import 78/41978/2
authorJohn L. Hammond <jhammond@whamcloud.com>
Wed, 10 Mar 2021 15:20:29 +0000 (09:20 -0600)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Mar 2021 04:16:40 +0000 (04:16 +0000)
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 <jhammond@whamcloud.com>
Change-Id: I40636c0620b2f9314eb13bf23a8cf6d02990f851
Reviewed-on: https://review.whamcloud.com/41978
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yingjin Qian <qian@ddn.com>
lustre/tests/sanity-hsm.sh
lustre/utils/lhsmtool_posix.c

index 12834df..be7276b 100755 (executable)
@@ -994,6 +994,18 @@ test_11b() {
 }
 run_test 11b "Import a deleted file using its FID"
 
 }
 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
 test_12a() {
        # test needs a running copytool
        copytool setup
index 3a75678..707cbab 100644 (file)
@@ -1477,9 +1477,14 @@ static int ct_import_one(const char *src, const char *dst)
                return 0;
 
        rc = llapi_hsm_import(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;
        if (rc < 0) {
                CT_ERROR(rc, "cannot import '%s' from '%s'", dst, src);
                return rc;