#!/bin/bash # Copyright 2013 Frank Liepold / 1&1 Internet AG # # Copying and distribution of this file, with or without modification, # are permitted in any medium without royalty provided the copyright # notice and this notice are preserved. This file is offered as-is, # without any warranty. ##################################################################### ## defaults for module resource ## ## this module administrates the test resources ## the names of the resources used in the current test resource_name_list=(lv-1-2) ## directories used for attempts to mount certain devices ## maps resource name lv-- to /mnt/mars-test- declare -g -A resource_mount_point_list ## resource dir of resource res is given by ## $main_mars_directory/resource-$res declare -g -A resource_dir_list ## filesystem type of resource devices is set to xfs declare -g -A resource_fs_type_list ## messages to be grepped for in abnormal situations declare -g -A resource_mars_dir_full_err_pattern_list ## because some global variable depend from other global variables ## (e.g. resource_mount_point_list from resource_name_list) it's ## necessary to give *.conf files the possibility if they change a global ## variable to reset all dependend global variables. ## This can be done by a call to this function. function resource_set_globals_depending_on_resource_name_list { eval resource_mount_point_list=($(for i in ${!resource_name_list[*]};do printf "[${resource_name_list[$i]}]=/mnt/mars-test-$(($i + 1)) ";done)) eval resource_dir_list=($(for i in ${!resource_name_list[*]};do printf "[${resource_name_list[$i]}]=$main_mars_directory/resource-${resource_name_list[$i]} ";done)) eval resource_fs_type_list=($(for i in ${!resource_name_list[*]};do printf "[${resource_name_list[$i]}]=xfs ";done)) ## messages to be grepped for in abnormal situations resource_mars_dir_full_err_pattern_list["jammed"]='DISK SPACE IS EXTREMELY LOW on '"${resource_dir_list[${resource_name_list[0]}]}" resource_mars_dir_full_err_pattern_list["sequence_hole"]='EMERGENCY MODE on '"${resource_dir_list[${resource_name_list[0]}]}"'.*stopped transaction logging.*created a hole in the logfile sequence' } resource_set_globals_depending_on_resource_name_list ## mounting of the data device must fail on a secondary resource. Because ## the marsadm join-resource command may return *before* the kernel has locked ## the data device, mounting may succeed in some cases. So we need to try ## the join-resource again. resource_number_of_mount_join_resource_cycles=4 ## create-resource may fail, because the data device is still locked by ## the kernel. So we try it a few times again. resource_number_of_create_retries=5 ## because nearly all tests start with create-resource we are using ## --force to avoid errors caused by already existing resource directories resource_create_flag='--force' ## maxtime to wait for successfull ls /dev/mars - command resource_maxtime_to_wait_for_ls=10 ## max number of loops to wait for leave-resource to be done resource_maxloop_leave_resource=10 ## maxtime to wait for initial sync after join resource to stop resource_maxtime_initial_sync=300 ## time for which the amount of data to sync must be constant ## to declare the sync process as inactive resource_time_constant_initial_sync=10 ## time for which the amount of data to apply must be constant to declare ## the apply process as having stopped resource_time_constant_apply=5 ## time for which the amount of data to fetch must be constant to declare ## the fetch process as having stopped resource_time_constant_fetch=10 ## time for which the amount of data to sync must be constant ## to declare the sync process as inactive resource_time_constant_sync=10 ## maxtime to wait for apply to stop (after pause-apply) resource_maxtime_apply=300 ## maxtime to wait for fetch to stop (after pause-fetch) resource_maxtime_fetch=300 ## maxtime to wait for sync to stop resource_maxtime_sync=300 ## maxtime to wait for disk or replication state to take a required value resource_maxtime_state_constant=300 ## flag if a file system on the data device will be used for writing data resource_fs_on_data_device_necessary=1 ## flag if /mars should be filled by writing the data device or by writing ## a file resource_use_data_dev_writes_to_fill_mars_dir=1 ## file to use for filling /mars resource_big_file=$main_mars_directory/mars_test_bigfile ## msg files declare -g -A resource_msgfile_list resource_msgfile_list=([err]='3.error.status' [warn]='2.warn.status') ## file used to reset after emergency mode resource_proc_sys_mars_reset_emergency_file="/proc/sys/mars/mars_reset_emergency" resource_mars_dir_full_warn_pattern_list[0]='EMERGENCY: the space on '$main_mars_directory'/ is very low.'