cdt->cdt_delay = 60;
cdt->cdt_timeout = 3600;
cdt->cdt_max_request = 3;
+ cdt->cdt_archive_id = 1;
atomic_set(&cdt->cdt_request_count, 0);
/* to avoid deadlock when start is made through /proc
GENERATE_PROC_METHOD(cdt_delay)
GENERATE_PROC_METHOD(cdt_timeout)
GENERATE_PROC_METHOD(cdt_max_request)
+GENERATE_PROC_METHOD(cdt_archive_id)
/*
* procfs write method for MDT/hsm_control
{ "agents", NULL, NULL, NULL, &mdt_hsm_agent_fops, 0 },
{ "agent_actions", NULL, NULL, NULL,
&mdt_agent_actions_fops, 0444 },
+ { "archive_id", lprocfs_rd_hsm_cdt_archive_id,
+ lprocfs_wr_hsm_cdt_archive_id,
+ NULL, NULL, 0 },
{ "grace_delay", lprocfs_rd_hsm_cdt_delay,
lprocfs_wr_hsm_cdt_delay,
NULL, NULL, 0 },
/* for cancel archive number is taken from canceled request
* for other request, we take from lma if not specified,
+ * or we use the default if none found in lma
* this works also for archive because the default value is 0
* /!\ there is a side effect: in case of restore on multiple
* files which are in different backend, the initial compound
* warranty an agent can serve any combinaison of archive
* backend
*/
- if (hai->hai_action != HSMA_CANCEL && archive_id == 0)
- archive_id = mh.mh_arch_id;
+ if (hai->hai_action != HSMA_CANCEL && archive_id == 0) {
+ if (mh.mh_arch_id != 0)
+ archive_id = mh.mh_arch_id;
+ else
+ archive_id = cdt->cdt_archive_id;
+ }
/* if restore, take an exclusive lock on layout */
if (hai->hai_action == HSMA_RESTORE) {
cfs_time_t cdt_loop_period; /**< llog scan period */
cfs_time_t cdt_delay; /**< request grace delay */
cfs_time_t cdt_timeout; /**< request timeout */
+ __u32 cdt_archive_id; /** archive id used when
+ * none are specified */
__u64 cdt_max_request; /**< max count of started
* requests */
atomic_t cdt_request_count; /**< current count of
}
run_test 10c "Check forbidden archive"
+test_10d() {
+ # test needs a running copytool
+ copytool_setup
+
+ mkdir -p $DIR/$tdir
+ local f=$DIR/$tdir/$tfile
+ local fid=$(copy_file /etc/hosts $f)
+ $LFS hsm_archive $f || error "cannot archive $f"
+ wait_request_state $fid ARCHIVE SUCCEED
+
+ local ar=$(get_hsm_archive_id $f)
+ local dflt=$(get_hsm_param archive_id)
+ [[ $ar == $dflt ]] ||
+ error "archived file is not on default archive: $ar != $dflt"
+
+ copytool_cleanup
+}
+run_test 10d "Archive a file on the default archive id"
+
test_11() {
mkdir -p $DIR/$tdir $HSM_ARCHIVE/$tdir
cp /etc/hosts $HSM_ARCHIVE/$tdir/$tfile
}
run_test 90 "Archive/restore a file list"
-double_verify_reset_ham_param() {
+double_verify_reset_hsm_param() {
local p=$1
echo "Testing $HSM_PARAM.$p"
local val=$(get_hsm_param $p)
}
test_100() {
- double_verify_reset_ham_param loop_period
- double_verify_reset_ham_param grace_delay
- double_verify_reset_ham_param request_timeout
- double_verify_reset_ham_param max_requests
+ double_verify_reset_hsm_param loop_period
+ double_verify_reset_hsm_param grace_delay
+ double_verify_reset_hsm_param request_timeout
+ double_verify_reset_hsm_param max_requests
+ double_verify_reset_hsm_param archive_id
}
run_test 100 "Set coordinator /proc tunables"