#!/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 function resource_set_globals { 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[0]='DISK SPACE IS EXTREMELY LOW on '"${resource_dir_list[${resource_name_list[0]}]}" resource_mars_dir_full_err_pattern_list[1]='EMERGENCY MODE on '"${resource_dir_list[${resource_name_list[0]}]}"'.*stopped transaction logging.*created a hole in the logfile sequence' } resource_set_globals ## 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 ## flag if a file system on the data device should be created resource_recreate_fs_on_data_device_required=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.'