blob: 35ee9d4c7ee349e336ed6ccd125b4f1806cb82fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
#!/bin/bash -ex
#
# cephfs_mirror_ha_gen.sh - generate workload to synchronize
#
. $(dirname $0)/cephfs_mirror_helpers.sh
cleanup()
{
for i in `seq 1 $NR_DIRECTORIES`
do
local repo_name="${REPO_PATH_PFX}_$i"
for j in `seq 1 $NR_SNAPSHOTS`
do
snap_name=$repo_name/.snap/snap_$j
if test -d $snap_name; then
rmdir $snap_name
fi
done
done
exit 1
}
trap cleanup EXIT
configure_peer()
{
ceph mgr module enable mirroring
ceph fs snapshot mirror enable $PRIMARY_FS
ceph fs snapshot mirror peer_add $PRIMARY_FS client.mirror_remote@ceph $BACKUP_FS
for i in `seq 1 $NR_DIRECTORIES`
do
local repo_name="${REPO_PATH_PFX}_$i"
ceph fs snapshot mirror add $PRIMARY_FS "$MIRROR_SUBDIR/$repo_name"
done
}
create_snaps()
{
for i in `seq 1 $NR_DIRECTORIES`
do
local repo_name="${REPO_PATH_PFX}_$i"
for j in `seq 1 $NR_SNAPSHOTS`
do
snap_name=$repo_name/.snap/snap_$j
r=$(( $RANDOM % 100 + 5 ))
arr=($repo_name "reset" "--hard" "HEAD~$r")
exec_git_cmd "${arr[@]}"
mkdir $snap_name
store_checksum $snap_name
done
done
}
unset CEPH_CLI_TEST_DUP_COMMAND
echo "running generator on prmary file system..."
# setup git repos to be used as data set
setup_repos
# turn on mirroring, add peers...
configure_peer
# snapshots on primary
create_snaps
# do not cleanup when exiting on success..
trap - EXIT
|