]> git.proxmox.com Git - ceph.git/blob - ceph/qa/workunits/rbd/rbd_mirror_bootstrap.sh
bump version to 18.2.2-pve1
[ceph.git] / ceph / qa / workunits / rbd / rbd_mirror_bootstrap.sh
1 #!/bin/sh -ex
2 #
3 # rbd_mirror_bootstrap.sh - test peer bootstrap create/import
4 #
5
6 RBD_MIRROR_MANUAL_PEERS=1
7 RBD_MIRROR_INSTANCES=${RBD_MIRROR_INSTANCES:-1}
8 . $(dirname $0)/rbd_mirror_helpers.sh
9
10 setup
11
12 testlog "TEST: bootstrap cluster2 from cluster1"
13 # create token on cluster1 and import to cluster2
14 TOKEN=${TEMPDIR}/peer-token
15 TOKEN_2=${TEMPDIR}/peer-token-2
16 CEPH_ARGS='' rbd --cluster ${CLUSTER1} mirror pool peer bootstrap create ${POOL} > ${TOKEN}
17 CEPH_ARGS='' rbd --cluster ${CLUSTER1} mirror pool peer bootstrap create ${PARENT_POOL} > ${TOKEN_2}
18 cmp ${TOKEN} ${TOKEN_2}
19
20 CEPH_ARGS='' rbd --cluster ${CLUSTER2} --pool ${POOL} mirror pool peer bootstrap import ${TOKEN} --direction rx-only
21 CEPH_ARGS='' rbd --cluster ${CLUSTER2} --pool ${PARENT_POOL} mirror pool peer bootstrap import ${TOKEN} --direction rx-tx
22
23 start_mirrors ${CLUSTER1}
24 start_mirrors ${CLUSTER2}
25
26 testlog "TEST: verify rx-only direction"
27 # rx-only peer is added immediately by "rbd mirror pool peer bootstrap import"
28 rbd --cluster ${CLUSTER2} --pool ${POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-only"'
29 # tx-only peer is added asynchronously by mirror_peer_ping class method
30 while ! rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format json | jq -e '.peers | length > 0'; do
31 sleep 1
32 done
33 rbd --cluster ${CLUSTER1} --pool ${POOL} mirror pool info --format json | jq -e '.peers[0].direction == "tx-only"'
34
35 create_image_and_enable_mirror ${CLUSTER1} ${POOL} image1
36
37 wait_for_image_replay_started ${CLUSTER2} ${POOL} image1
38 write_image ${CLUSTER1} ${POOL} image1 100
39 wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${POOL} image1
40
41 testlog "TEST: verify rx-tx direction"
42 # both rx-tx peers are added immediately by "rbd mirror pool peer bootstrap import"
43 rbd --cluster ${CLUSTER1} --pool ${PARENT_POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-tx"'
44 rbd --cluster ${CLUSTER2} --pool ${PARENT_POOL} mirror pool info --format json | jq -e '.peers[0].direction == "rx-tx"'
45
46 create_image ${CLUSTER1} ${PARENT_POOL} image1
47 create_image ${CLUSTER2} ${PARENT_POOL} image2
48
49 enable_mirror ${CLUSTER1} ${PARENT_POOL} image1
50 enable_mirror ${CLUSTER2} ${PARENT_POOL} image2
51
52 wait_for_image_replay_started ${CLUSTER2} ${PARENT_POOL} image1
53 write_image ${CLUSTER1} ${PARENT_POOL} image1 100
54 wait_for_replay_complete ${CLUSTER2} ${CLUSTER1} ${PARENT_POOL} image1
55
56 wait_for_image_replay_started ${CLUSTER1} ${PARENT_POOL} image2
57 write_image ${CLUSTER2} ${PARENT_POOL} image2 100
58 wait_for_replay_complete ${CLUSTER1} ${CLUSTER2} ${PARENT_POOL} image2